[ThinkNode_M6]
extends = nrf52_base
board = thinknode_m6
board_build.ldscript = boards/nrf52840_s140_v6.ld
build_flags = ${nrf52_base.build_flags}
  ${sensor_base.build_flags}
  -I src/helpers/nrf52
  -I lib/nrf52/s140_nrf52_6.1.1_API/include
  -I lib/nrf52/s140_nrf52_6.1.1_API/include/nrf52
  -I variants/thinknode_m6
  -D THINKNODE_M6=1
  -D USE_SX1262
  -D RADIO_CLASS=CustomSX1262
  -D WRAPPER_CLASS=CustomSX1262Wrapper
  -D P_LORA_DIO_1=38
  -D P_LORA_NSS=44
  -D P_LORA_RESET=42
  -D P_LORA_BUSY=43
  -D P_LORA_SCLK=45
  -D P_LORA_MISO=47
  -D P_LORA_MOSI=46
  -D SX126X_DIO2_AS_RF_SWITCH=true
  -D SX126X_DIO3_TCXO_VOLTAGE=3.3
  -D SX126X_CURRENT_LIMIT=140
  -D SX126X_RX_BOOSTED_GAIN=1
  -D LORA_TX_POWER=22
  -D P_LORA_TX_LED=PIN_LED_BLUE
;  -D PERSISTANT_GPS=1
;  -D ENV_SKIP_GPS_DETECT=1
build_src_filter = ${nrf52_base.build_src_filter}
  +<helpers/*.cpp>
  +<helpers/sensors>
  +<ThinkNodeM6Board.cpp>
  +<../variants/thinknode_m6>
lib_deps =
  ${nrf52_base.lib_deps}
  ${sensor_base.lib_deps}
debug_tool = jlink
upload_protocol = nrfutil

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

[env:ThinkNode_M6_room_server]
extends = ThinkNode_M6
build_flags =
  ${ThinkNode_M6.build_flags}
  -D ADVERT_NAME='"ThinkNode Room"'
  -D ADVERT_LAT=0.0
  -D ADVERT_LON=0.0
  -D ADMIN_PASSWORD='"password"'
;  -D MESH_PACKET_LOGGING=1
;  -D MESH_DEBUG=1
build_src_filter = ${ThinkNode_M6.build_src_filter}
  +<../examples/simple_room_server/*.cpp>
lib_deps =
  ${ThinkNode_M6.lib_deps}

[env:ThinkNode_M6_companion_radio_ble]
extends = ThinkNode_M6
board_build.ldscript = boards/nrf52840_s140_v6_extrafs.ld
board_upload.maximum_size = 712704
build_flags =
  ${ThinkNode_M6.build_flags}
  -I src/helpers/ui
  -I examples/companion_radio/ui-new
  -D MAX_CONTACTS=350
  -D MAX_GROUP_CHANNELS=40
  -D BLE_PIN_CODE=123456
  -D BLE_DEBUG_LOGGING=1
  -D OFFLINE_QUEUE_SIZE=256
  -D AUTO_SHUTDOWN_MILLIVOLTS=3300
  -D QSPIFLASH=1
;  -D MESH_PACKET_LOGGING=1
;  -D MESH_DEBUG=1
build_src_filter = ${ThinkNode_M6.build_src_filter}
  +<helpers/nrf52/SerialBLEInterface.cpp>
  +<helpers/ui/MomentaryButton.cpp>
  +<../examples/companion_radio/*.cpp>
lib_deps =
  ${ThinkNode_M6.lib_deps}
  densaugeo/base64 @ ~1.4.0
  end2endzone/NonBlockingRTTTL@^1.3.0

[env:ThinkNode_M6_companion_radio_usb]
extends = ThinkNode_M6
board_build.ldscript = boards/nrf52840_s140_v6_extrafs.ld
board_upload.maximum_size = 712704
build_flags =
  ${ThinkNode_M6.build_flags}
  -I src/helpers/ui
  -I examples/companion_radio/ui-new
  -D MAX_CONTACTS=350
  -D MAX_GROUP_CHANNELS=40
  -D QSPIFLASH=1
  -D OFFLINE_QUEUE_SIZE=256
  -D AUTO_SHUTDOWN_MILLIVOLTS=3300
build_src_filter = ${ThinkNode_M6.build_src_filter}
  +<helpers/ui/buzzer.cpp>
  +<helpers/ui/MomentaryButton.cpp>
  +<../examples/companion_radio/*.cpp>
lib_deps =
  ${ThinkNode_M6.lib_deps}
  densaugeo/base64 @ ~1.4.0
  end2endzone/NonBlockingRTTTL@^1.3.0