[ThinkNode_M9]
extends = esp32_base
board = thinknode_m9
board_check = true
board_build.partitions = default_16MB.csv
upload_protocol = esptool
build_flags =
  ${esp32_base.build_flags}
  ${sensor_base.build_flags}
  -I variants/thinknode_m9
  -I src/helpers/esp32
  -I src/helpers/sensors
  -D THINKNODE_M9
  -D PIN_BUZZER=9
  -D PIN_BOARD_SCL=6
  -D PIN_BOARD_SDA=7
  -D P_LORA_NSS=39
  -D P_LORA_RESET=45
  -D P_LORA_BUSY=41
  -D P_LORA_SCLK=40
  -D P_LORA_MISO=38
  -D P_LORA_MOSI=47
  -D P_LORA_DIO_1=42
  -D USE_LR1110
  -D RF_SWITCH_TABLE
  -D RADIO_CLASS=CustomLR1110
  -D WRAPPER_CLASS=CustomLR1110Wrapper
  -D LR11X0_DIO_AS_RF_SWITCH=true
  -D LR11X0_DIO3_TCXO_VOLTAGE=3.3
  -D LORA_TX_POWER=22
  -D DISPLAY_CLASS=ST7789Display
  -D DISPLAY_FLIP_VERTICALLY=1
  -D DISPLAY_SCALE_X=2.5f ; 320 / 128
  -D DISPLAY_SCALE_Y=3.75f ; 240 / 64
  -D ST7789
  -D PIN_TFT_VDD_CTL=-1
  -D PIN_TFT_LEDA_CTL=17
  -D PIN_TFT_RST=14
  -D PIN_GPS_RX=3
  -D PIN_GPS_TX=2
  -D PIN_GPS_EN=11
  -D PIN_GPS_EN_ACTIVE=LOW
  -D PIN_GPS_RESET=5
  -D PIN_GPS_RESET_ACTIVE=HIGH
  -D GPS_BAUD_RATE=115200
  -D ENV_INCLUDE_GPS=1
  -D PIN_VBAT_READ=13
build_src_filter = ${esp32_base.build_src_filter}
  +<helpers/sensors/EnvironmentSensorManager.cpp>
  +<helpers/ui/ST7789Display.cpp>
  +<helpers/ui/OLEDDisplay.cpp>
  +<helpers/ui/OLEDDisplayFonts.cpp>
  +<helpers/*.cpp>
  +<../variants/thinknode_m9>
lib_deps = ${esp32_base.lib_deps}
  ${sensor_base.lib_deps}
  adafruit/Adafruit GFX Library @ ^1.12.1

[env:ThinkNode_M9_repeater_]
extends = ThinkNode_M9
build_flags =
  ${ThinkNode_M9.build_flags}
  -D ADVERT_NAME='"ThinkNode M9 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 = ${ThinkNode_M9.build_src_filter}
  +<../examples/simple_repeater/*.cpp>
lib_deps =
  ${ThinkNode_M9.lib_deps}
  ${esp32_ota.lib_deps}  

[env:ThinkNode_M9_room_server_]
extends = ThinkNode_M9
build_src_filter = ${ThinkNode_M9.build_src_filter}
  +<../examples/simple_room_server>
build_flags =
  ${ThinkNode_M9.build_flags}
  -D ADVERT_NAME='"ThinkNode M9 Room Server"'
  -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
lib_deps =
  ${ThinkNode_M9.lib_deps}
  ${esp32_ota.lib_deps}

[env:ThinkNode_M9_companion_radio_ble_]
extends = ThinkNode_M9
build_flags =
  ${ThinkNode_M9.build_flags}
  -I examples/companion_radio/ui-new
  -D MAX_CONTACTS=350
  -D MAX_GROUP_CHANNELS=40
  -D BLE_PIN_CODE=123456
  -D OFFLINE_QUEUE_SIZE=256
  ; -D BLE_DEBUG_LOGGING=1
  ; -D MESH_PACKET_LOGGING=1
build_src_filter = ${ThinkNode_M9.build_src_filter}
  +<helpers/esp32/*.cpp>
  +<helpers/ui/buzzer.cpp>
  +<helpers/ui/MomentaryButton.cpp>
  +<../examples/companion_radio/*.cpp>
  +<../examples/companion_radio/ui-new/*.cpp>
lib_deps =
  ${ThinkNode_M9.lib_deps}
  densaugeo/base64 @ ~1.4.0
  end2endzone/NonBlockingRTTTL@^1.3.0

[env:ThinkNode_M9_companion_radio_usb_]
extends = ThinkNode_M9
build_flags =
  ${ThinkNode_M9.build_flags}
  -I examples/companion_radio/ui-new
  -D MAX_CONTACTS=350
  -D MAX_GROUP_CHANNELS=40
  -D OFFLINE_QUEUE_SIZE=256
  -D ENABLE_USB_INTERFACE
build_src_filter = ${ThinkNode_M9.build_src_filter}
  +<helpers/esp32/*.cpp>
  +<helpers/ui/buzzer.cpp>
  +<helpers/ui/MomentaryButton.cpp>
  +<../examples/companion_radio/*.cpp>
  +<../examples/companion_radio/ui-new/*.cpp>
lib_deps =
  ${ThinkNode_M9.lib_deps}
  densaugeo/base64 @ ~1.4.0
  end2endzone/NonBlockingRTTTL@^1.3.0

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

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