[LilyGo_TBeam_SX1262]
extends = esp32_base
board = ttgo-t-beam
build_flags =
  ${esp32_base.build_flags}
  -I variants/lilygo_tbeam_SX1262
  -D TBEAM_SX1262
  -D SX126X_DIO2_AS_RF_SWITCH=true
  -D SX126X_DIO3_TCXO_VOLTAGE=1.8
  -D SX126X_CURRENT_LIMIT=140
  -D SX126X_RX_BOOSTED_GAIN=1
  -D USE_SX1262
  -D RADIO_CLASS=CustomSX1262
  -D WRAPPER_CLASS=CustomSX1262Wrapper
  -D DISPLAY_CLASS=SSD1306Display
  -D LORA_TX_POWER=22
  -D P_LORA_TX_LED=4
  -D PIN_BOARD_SDA=21
  -D PIN_BOARD_SCL=22
  -D PIN_GPS_RX=12
  -D PIN_GPS_TX=34
  -D PIN_USER_BTN=38
  -D ENV_INCLUDE_GPS=1
build_src_filter = ${esp32_base.build_src_filter}
  +<../variants/lilygo_tbeam_SX1262>
  +<helpers/ui/SSD1306Display.cpp>
  +<helpers/esp32/TBeamBoard.cpp>
  +<helpers/sensors>
board_build.partitions = min_spiffs.csv ; get around 4mb flash limit
lib_deps =
  ${esp32_base.lib_deps}
  lewisxhe/XPowersLib@^0.2.7
  adafruit/Adafruit SSD1306 @ ^2.5.13
  stevemarple/MicroNMEA @ ^2.0.6

[env:Tbeam_SX1262_companion_radio_ble]
extends = LilyGo_TBeam_SX1262
board_build.upload.maximum_ram_size=2000000
build_flags =
  ${LilyGo_TBeam_SX1262.build_flags}
  -I examples/companion_radio/ui-new
  -D MAX_CONTACTS=160
  -D MAX_GROUP_CHANNELS=8
  -D BLE_PIN_CODE=123456
  -D OFFLINE_QUEUE_SIZE=256
;  -D BLE_DEBUG_LOGGING=1
;  -D MESH_PACKET_LOGGING=1
;  -D MESH_DEBUG=1
;  -D RADIOLIB_DEBUG_BASIC=1
;  -D MESH_PACKET_LOGGING=1
;  -D MESH_DEBUG=1
build_src_filter = ${LilyGo_TBeam_SX1262.build_src_filter}
  +<helpers/esp32/*.cpp>
  +<helpers/ui/MomentaryButton.cpp>
  +<../examples/companion_radio/*.cpp>
  +<../examples/companion_radio/ui-new/*.cpp>
lib_deps =
  ${LilyGo_TBeam_SX1262.lib_deps}
  densaugeo/base64 @ ~1.4.0

[env:Tbeam_SX1262_repeater]
extends = LilyGo_TBeam_SX1262
build_flags =
  ${LilyGo_TBeam_SX1262.build_flags}
  -D ADVERT_NAME='"Tbeam SX1262 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 = ${LilyGo_TBeam_SX1262.build_src_filter}
  +<../examples/simple_repeater>
lib_deps =
  ${LilyGo_TBeam_SX1262.lib_deps}
  ${esp32_ota.lib_deps}

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

[env:Tbeam_SX1262_repeater_bridge_espnow]
extends = LilyGo_TBeam_SX1262
build_flags =
  ${LilyGo_TBeam_SX1262.build_flags}
  -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 = ${LilyGo_TBeam_SX1262.build_src_filter}
  +<helpers/bridges/ESPNowBridge.cpp>
  +<../examples/simple_repeater>
lib_deps =
  ${LilyGo_TBeam_SX1262.lib_deps}
  ${esp32_ota.lib_deps}

[env:Tbeam_SX1262_room_server]
extends = LilyGo_TBeam_SX1262
build_flags =
  ${LilyGo_TBeam_SX1262.build_flags}
  -D ADVERT_NAME='"Tbeam SX1262 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 = ${LilyGo_TBeam_SX1262.build_src_filter}
  +<../examples/simple_room_server>
lib_deps =
  ${LilyGo_TBeam_SX1262.lib_deps}
  ${esp32_ota.lib_deps}
