[meshnology_w12]
extends = esp32_base
board = meshnology_w12
build_flags =
  ${esp32_base.build_flags}
  ${sensor_base.build_flags}
  -I variants/meshnology_w12
  -D MESHNOLOGY_W12
  -D ESP32_CPU_FREQ=80
  -D RADIO_CLASS=CustomLR2021
  -D WRAPPER_CLASS=CustomLR2021Wrapper
  -D USE_LR2021
  -D NEOPIXEL_LED=46
  -D NEOPIXEL_BRIGHTNESS=64
  -D P_LORA_DIO_1=14
  -D LR2021_IRQ_DIO=8         ; GPIO14 is connected to LR2021 DIO8
  -D P_LORA_NSS=8
  -D P_LORA_SCLK=9
  -D P_LORA_MOSI=10
  -D P_LORA_MISO=11
  -D P_LORA_RESET=12
  -D P_LORA_BUSY=13
  -D LR2021_TCXO_VOLTAGE=0.0f ; this board has no tcxo 
  -D RF_SWITCH_TABLE          ; used below in commented code for the RF switch table.
  -D P_LORA_LF_PA_POWER=4     ; PA_EN_M - power enable for the GC1109 868/915 PA
  -D P_LORA_HF_PA_POWER=3     ; PA_EN_G - power enable for RFX2402E 2.4G PA
  -D PIN_USER_BTN=0
  -D PIN_VEXT_EN=45
  -D PIN_VEXT_EN_ACTIVE=HIGH
  -D LORA_TX_POWER=4
  -D MAX_LORA_TX_POWER=4      ; GC1109 datasheet says max input at TX port is +5dbm, confirmed full saturation seems to occur at around 3-4dbm
  -D PIN_GPS_RX=38
  -D PIN_GPS_TX=39
  -D PIN_GPS_RESET=42
  -D PIN_GPS_RESET_ACTIVE=LOW
  -D PIN_GPS_EN=48
  -D PIN_GPS_EN_ACTIVE=LOW
  ; -D ENV_INCLUDE_GPS=1
  -D PIN_VBAT_READ=1
  -D PIN_ADC_CTRL=2
  -D PIN_BOARD_SDA=17
  -D PIN_BOARD_SCL=18
  -D PIN_RESET=47
build_src_filter = ${esp32_base.build_src_filter}
  +<../variants/meshnology_w12>
  +<helpers/sensors>
lib_deps =
  ${esp32_base.lib_deps}
  ${sensor_base.lib_deps}

[env:meshnology_w12_repeater]
extends = meshnology_w12
build_flags =
  ${meshnology_w12.build_flags}
  -D DISPLAY_CLASS=SSD1306Display
  -D ADVERT_NAME='"Meshnology W12 Repeater"'
  -D ADVERT_LAT=0.0
  -D ADVERT_LON=0.0
  -D ADMIN_PASSWORD='"password"'
  -D MAX_NEIGHBOURS=50
  ; -D MESH_PACKET_LOGGING=1
  ; -D MESH_DEBUG=1
build_src_filter = ${meshnology_w12.build_src_filter}
  +<helpers/ui/SSD1306Display.cpp>
  +<../examples/simple_repeater>
lib_deps =
  ${meshnology_w12.lib_deps}
  ${esp32_ota.lib_deps}
  bakercp/CRC32 @ ^2.0.0

[env:meshnology_w12_repeater_bridge_espnow]
extends = meshnology_w12
build_flags =
  ${meshnology_w12.build_flags}
  -D DISPLAY_CLASS=SSD1306Display
  -D ADVERT_NAME='"ESPNow Bridge"'
  -D ADVERT_LAT=0.0
  -D ADVERT_LON=0.0
  -D ADMIN_PASSWORD='"password"'
  -D MAX_NEIGHBOURS=50
  -D WITH_ESPNOW_BRIDGE=1
  ; -D BRIDGE_DEBUG=1
  ; -D MESH_PACKET_LOGGING=1
  ; -D MESH_DEBUG=1
build_src_filter = ${meshnology_w12.build_src_filter}
  +<helpers/bridges/ESPNowBridge.cpp>
  +<helpers/ui/SSD1306Display.cpp>
  +<../examples/simple_repeater>
lib_deps =
  ${meshnology_w12.lib_deps}
  ${esp32_ota.lib_deps}

[env:meshnology_w12_room_server]
extends = meshnology_w12
build_flags =
  ${meshnology_w12.build_flags}
  -D DISPLAY_CLASS=SSD1306Display
  -D ADVERT_NAME='"Meshnology W12 Room"'
  -D ADVERT_LAT=0.0
  -D ADVERT_LON=0.0
  -D ADMIN_PASSWORD='"password"'
  -D ROOM_PASSWORD='"hello"'
  ; -D MESH_PACKET_LOGGING=1
  ; -D MESH_DEBUG=1
build_src_filter = ${meshnology_w12.build_src_filter}
  +<helpers/ui/SSD1306Display.cpp>
  +<../examples/simple_room_server>
lib_deps =
  ${meshnology_w12.lib_deps}
  ${esp32_ota.lib_deps}

[env:meshnology_w12_terminal_chat]
extends = meshnology_w12
build_flags =
  ${meshnology_w12.build_flags}
  -D MAX_CONTACTS=350
  -D MAX_GROUP_CHANNELS=1
  ; -D MESH_PACKET_LOGGING=1
  ; -D MESH_DEBUG=1
build_src_filter = ${meshnology_w12.build_src_filter}
  +<../examples/simple_secure_chat/main.cpp>
lib_deps =
  ${meshnology_w12.lib_deps}
  densaugeo/base64 @ ~1.4.0

[env:meshnology_w12_companion_radio_usb]
extends = meshnology_w12
build_flags =
  ${meshnology_w12.build_flags}
  -I examples/companion_radio/ui-new
  -D MAX_CONTACTS=350
  -D MAX_GROUP_CHANNELS=40
  -D DISPLAY_CLASS=SSD1306Display
; NOTE: DO NOT ENABLE -->  -D MESH_PACKET_LOGGING=1
; NOTE: DO NOT ENABLE -->  -D MESH_DEBUG=1
build_src_filter = ${meshnology_w12.build_src_filter}
  +<helpers/ui/SSD1306Display.cpp>
  +<helpers/ui/MomentaryButton.cpp>
  +<../examples/companion_radio/*.cpp>
  +<../examples/companion_radio/ui-new/*.cpp>
lib_deps =
  ${meshnology_w12.lib_deps}
  densaugeo/base64 @ ~1.4.0

[env:meshnology_w12_companion_radio_ble]
extends = meshnology_w12
build_flags =
  ${meshnology_w12.build_flags}
  -I examples/companion_radio/ui-new
  -D MAX_CONTACTS=350
  -D MAX_GROUP_CHANNELS=40
  -D DISPLAY_CLASS=SSD1306Display
  -D BLE_PIN_CODE=123456   ; dynamic, random PIN
  ; -D AUTO_SHUTDOWN_MILLIVOLTS=3400  ; disabled by default, otherwise reading bounce causes shutdown when there's no battery connected.
  ; -D BLE_DEBUG_LOGGING=1
  -D OFFLINE_QUEUE_SIZE=256
  ; -D MESH_PACKET_LOGGING=1
  ; -D MESH_DEBUG=1
build_src_filter = ${meshnology_w12.build_src_filter}
  +<helpers/ui/SSD1306Display.cpp>
  +<helpers/ui/MomentaryButton.cpp>
  +<helpers/esp32/*.cpp>
  +<../examples/companion_radio/*.cpp>
  +<../examples/companion_radio/ui-new/*.cpp>
lib_deps =
  ${meshnology_w12.lib_deps}
  densaugeo/base64 @ ~1.4.0

[env:meshnology_w12_companion_radio_wifi]
extends = meshnology_w12
build_flags =
  ${meshnology_w12.build_flags}
  -I examples/companion_radio/ui-new
  -D MAX_CONTACTS=350
  -D MAX_GROUP_CHANNELS=40
  -D OFFLINE_QUEUE_SIZE=256
  -D DISPLAY_CLASS=SSD1306Display
  ; -D WIFI_DEBUG_LOGGING=1
  -D WIFI_SSID='"myssid"'
  -D WIFI_PWD='"mypwd"'
  ; -D MESH_PACKET_LOGGING=1
  ; -D MESH_DEBUG=1
build_src_filter = ${meshnology_w12.build_src_filter}
  +<helpers/ui/SSD1306Display.cpp>
  +<helpers/ui/MomentaryButton.cpp>
  +<helpers/esp32/*.cpp>
  +<../examples/companion_radio/*.cpp>
  +<../examples/companion_radio/ui-new/*.cpp>
lib_deps =
  ${meshnology_w12.lib_deps}
  densaugeo/base64 @ ~1.4.0

[env:meshnology_w12_sensor]
extends = meshnology_w12
build_flags =
  ${meshnology_w12.build_flags}
  -D ADVERT_NAME='"Meshnology W12 Sensor"'
  -D ADVERT_LAT=0.0
  -D ADVERT_LON=0.0
  -D ADMIN_PASSWORD='"password"'
  -D ENV_PIN_SDA=3
  -D ENV_PIN_SCL=4
  -D DISPLAY_CLASS=SSD1306Display
  ; -D MESH_PACKET_LOGGING=1
  ; -D MESH_DEBUG=1
build_src_filter = ${meshnology_w12.build_src_filter}
  +<helpers/ui/SSD1306Display.cpp>
  +<../examples/simple_sensor>
lib_deps =
  ${meshnology_w12.lib_deps}
  ${esp32_ota.lib_deps}

[env:meshnology_w12_kiss_modem]
extends = meshnology_w12
build_src_filter = ${meshnology_w12.build_src_filter}
  +<../examples/kiss_modem/>
