[ThinkNode_M5]
extends = esp32_base
board = ESP32-S3-WROOM-1-N4
build_flags = ${esp32_base.build_flags}
  -I variants/thinknode_m5
  -I src/helpers/sensors
  -D THINKNODE_M5
  -D PIN_BUZZER=9
  -D PIN_BOARD_SCL=1
  -D PIN_BOARD_SDA=2
  -D P_LORA_EN=46
  -D P_LORA_DIO_1=4
  -D P_LORA_NSS=17
  -D P_LORA_RESET=6  ; RADIOLIB_NC
  -D P_LORA_BUSY=5   ;  DIO2 = 38
  -D P_LORA_SCLK=16
  -D P_LORA_MISO=7
  -D P_LORA_MOSI=15
  -D PIN_USER_BTN=21
  -D PIN_BUTTON2=14
  -D EXP_PIN_LED=1   ; led is on bus expander
  -D DISPLAY_ROTATION=4
  -D DISPLAY_CLASS=GxEPDDisplay
  -D EINK_DISPLAY_MODEL=GxEPD2_154_D67
  -D EINK_SCALE_X=1.5625f
  -D EINK_SCALE_Y=1.5625f
  -D EINK_X_OFFSET=0
  -D EINK_Y_OFFSET=10
  -D BACKLIGHT_BTN=PIN_BUTTON2
  -D AUTO_OFF_MILLIS=0
  -D DISABLE_DIAGNOSTIC_OUTPUT
  -D SX126X_DIO2_AS_RF_SWITCH=true
  -D SX126X_DIO3_TCXO_VOLTAGE=3.3
  -D SX126X_CURRENT_LIMIT=140
  -D USE_SX1262
  -D RADIO_CLASS=CustomSX1262
  -D WRAPPER_CLASS=CustomSX1262Wrapper
  -D LORA_TX_POWER=22
  -D SX126X_RX_BOOSTED_GAIN=1
;  -D MESH_DEBUG=1
  -D ENV_INCLUDE_GPS=1
  -D PERSISTANT_GPS=1
  -D ENV_SKIP_GPS_DETECT=1
build_src_filter = ${esp32_base.build_src_filter}
  +<helpers/sensors/EnvironmentSensorManager.cpp>
  +<helpers/ui/MomentaryButton.cpp>
  +<helpers/ui/GxEPDDisplay.cpp>
  +<../variants/thinknode_m5>
lib_deps = ${esp32_base.lib_deps}
  zinggjm/GxEPD2 @ 1.6.2
  bakercp/CRC32 @ ^2.0.0
  maxpromer/PCA9557-arduino
  stevemarple/MicroNMEA @ ^2.0.6

[env:ThinkNode_M5_Repeater]
extends = ThinkNode_M5
build_src_filter = ${ThinkNode_M5.build_src_filter}
  +<../examples/simple_repeater/*.cpp>
build_flags =
  ${ThinkNode_M5.build_flags}
  -D ADVERT_NAME='"Thinknode M5 Repeater"'
  -D ADVERT_LAT=0.0
  -D ADVERT_LON=0.0
  -D ADMIN_PASSWORD='"password"'
  -D MAX_NEIGHBOURS=8
;  -D MESH_PACKET_LOGGING=1
;  -D MESH_DEBUG=1
lib_deps =
  ${ThinkNode_M5.lib_deps}
  ${esp32_ota.lib_deps}

; [env:ThinkNode_M5_Repeater_bridge_rs232]
; extends = ThinkNode_M5
; build_src_filter = ${ThinkNode_M5.build_src_filter}
;   +<helpers/bridges/RS232Bridge.cpp>
;   +<../examples/simple_repeater/*.cpp>
; build_flags =
;   ${ThinkNode_M5.build_flags}
;   -D ADVERT_NAME='"RS232 Bridge"'
;   -D ADVERT_LAT=0.0
;   -D ADVERT_LON=0.0
;   -D ADMIN_PASSWORD='"password"'
;   -D MAX_NEIGHBOURS=8
;   -D WITH_RS232_BRIDGE=Serial2
;   -D WITH_RS232_BRIDGE_RX=5
;   -D WITH_RS232_BRIDGE_TX=6
; ;  -D MESH_PACKET_LOGGING=1
; ;  -D MESH_DEBUG=1
; lib_deps =
;   ${ThinkNode_M5.lib_deps}
;   ${esp32_ota.lib_deps}

[env:ThinkNode_M5_Repeater_bridge_espnow]
extends = ThinkNode_M5
build_src_filter = ${ThinkNode_M5.build_src_filter}
  +<helpers/bridges/ESPNowBridge.cpp>
  +<../examples/simple_repeater/*.cpp>
build_flags =
  ${ThinkNode_M5.build_flags}
  -D ADVERT_NAME='"ESPNow Bridge"'
  -D ADVERT_LAT=0.0
  -D ADVERT_LON=0.0
  -D ADMIN_PASSWORD='"password"'
  -D MAX_NEIGHBOURS=8
  -D WITH_ESPNOW_BRIDGE=1
  -D WITH_ESPNOW_BRIDGE_SECRET='"shared-secret"'
;  -D MESH_PACKET_LOGGING=1
;  -D MESH_DEBUG=1
lib_deps =
  ${ThinkNode_M5.lib_deps}
  ${esp32_ota.lib_deps}

[env:ThinkNode_M5_room_server]
extends = ThinkNode_M5
build_src_filter = ${ThinkNode_M5.build_src_filter}
  +<../examples/simple_room_server>
build_flags =
  ${ThinkNode_M5.build_flags}
  -D ADVERT_NAME='"Thinknode M5 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_M5.lib_deps}
  ${esp32_ota.lib_deps}

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

[env:ThinkNode_M5_companion_radio_ble]
extends = ThinkNode_M5
build_flags =
  ${ThinkNode_M5.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 UI_RECENT_LIST_SIZE=9
;  -D BLE_DEBUG_LOGGING=1
;  -D MESH_PACKET_LOGGING=1
;  -D GPS_NMEA_DEBUG
build_src_filter = ${ThinkNode_M5.build_src_filter}
  +<helpers/esp32/*.cpp>
  +<helpers/ui/MomentaryButton.cpp>
  +<../examples/companion_radio/*.cpp>
  +<../examples/companion_radio/ui-new/*.cpp>
  +<helpers/ui/buzzer.cpp>
lib_deps =
  ${ThinkNode_M5.lib_deps}
  densaugeo/base64 @ ~1.4.0
  end2endzone/NonBlockingRTTTL@^1.3.0

[env:ThinkNode_M5_companion_radio_usb]
extends = ThinkNode_M5
build_flags =
  ${ThinkNode_M5.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_M5.build_src_filter}
  +<helpers/esp32/*.cpp>
  +<helpers/ui/MomentaryButton.cpp>
  +<../examples/companion_radio/*.cpp>
  +<../examples/companion_radio/ui-new/*.cpp>
  +<helpers/ui/buzzer.cpp>
lib_deps =
  ${ThinkNode_M5.lib_deps}
  densaugeo/base64 @ ~1.4.0
  end2endzone/NonBlockingRTTTL@^1.3.0

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

[env:ThinkNode_M5_companion_radio_serial]
extends = ThinkNode_M5
build_flags =
  ${ThinkNode_M5.build_flags}
  -I examples/companion_radio/ui-new
  -D MAX_CONTACTS=350
  -D MAX_GROUP_CHANNELS=40
  -D SERIAL_TX=D6
  -D SERIAL_RX=D7
;  -D MESH_PACKET_LOGGING=1
;  -D MESH_DEBUG=1
build_src_filter = ${ThinkNode_M5.build_src_filter}
  +<helpers/esp32/*.cpp>
  +<helpers/ui/MomentaryButton.cpp>
  +<../examples/companion_radio/*.cpp>
  +<../examples/companion_radio/ui-new/*.cpp>
  +<helpers/ui/buzzer.cpp>
lib_deps =
  ${ThinkNode_M5.lib_deps}
  densaugeo/base64 @ ~1.4.0
  end2endzone/NonBlockingRTTTL@^1.3.0

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