[Heltec_RC32]
extends = esp32_base
board = heltec-rc32
board_build.partitions = default_16MB.csv
build_flags =
  ${esp32_base.build_flags}
  ${sensor_base.build_flags}
  -I variants/heltec_rc32
  -I src/helpers/ui
  -D HELTEC_RC32
  -D USE_SX1262
  -D ESP32_CPU_FREQ=160
  -D RADIO_CLASS=CustomSX1262
  -D WRAPPER_CLASS=CustomSX1262Wrapper
  -D P_LORA_DIO_1=14
  -D P_LORA_NSS=10
  -D P_LORA_RESET=9
  -D P_LORA_BUSY=1
  -D P_LORA_SCLK=11
  -D P_LORA_MISO=13
  -D P_LORA_MOSI=12
  -D LORA_TX_POWER=22
  -D PIN_USER_BTN=0
  -D PIN_BOARD_SDA=21
  -D PIN_BOARD_SCL=18
  -D SENSOR_POWER_CTRL_PIN=46
  -D SENSOR_POWER_ON=HIGH
  -D SENSOR_RST_PIN=2
  -D P_LORA_TX_LED=47
  -D PIN_BUZZER=48
  -D PIN_TFT_SCL=17
  -D PIN_TFT_SDA=38
  -D PIN_TFT_CS=39
  -D PIN_TFT_DC=16
  -D PIN_TFT_RST=4
  -D PIN_TFT_EN=6
  -D PIN_TFT_EN_ACTIVE=LOW
  -D PIN_TFT_BL=5
  -D PIN_TFT_BL_ACTIVE=HIGH
  -D SPI_FREQUENCY=8000000
  -D PIN_GPS_TX=44
  -D PIN_GPS_RX=43
  -D PIN_GPS_EN=45
  -D PIN_GPS_EN_ACTIVE=HIGH
  -D PIN_GPS_RESET=40
  -D PIN_GPS_RESET_ACTIVE=LOW
  -D PIN_GPS_PPS=41
  -D GPS_BAUD_RATE=9600
  -D ENV_INCLUDE_GPS=1
  -D PIN_ADC_CTRL=15
  -D PIN_VBAT_READ=7
  -D ADC_CTRL_ENABLED=HIGH
  -D ADC_MULTIPLIER=4.9
  -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 SX126X_REGISTER_PATCH=1       ; Patch register 0x8B5 for improved RX
build_src_filter = ${esp32_base.build_src_filter}
  +<../variants/heltec_rc32>
  +<helpers/sensors>
lib_deps =
  ${esp32_base.lib_deps}
  ${sensor_base.lib_deps}

[Heltec_RC32_with_display]
extends = Heltec_RC32
build_flags =
  ${Heltec_RC32.build_flags}
  -D HELTEC_RC32_WITH_DISPLAY
  -D DISPLAY_CLASS=NV3001BDisplay
build_src_filter = ${Heltec_RC32.build_src_filter}
  +<helpers/ui/NV3001BDisplay.cpp>
  +<helpers/ui/MomentaryButton.cpp>
lib_deps =
  ${Heltec_RC32.lib_deps}

[env:heltec_rc32_without_display_repeater]
extends = Heltec_RC32
build_flags =
  ${Heltec_RC32.build_flags}
  -D ADVERT_NAME='"Heltec RC32 Repeater"'
  -D ADVERT_LAT=0.0
  -D ADVERT_LON=0.0
  -D ADMIN_PASSWORD='"password"'
  -D MAX_NEIGHBOURS=50
build_src_filter = ${Heltec_RC32.build_src_filter}
  +<../examples/simple_repeater>
lib_deps =
  ${Heltec_RC32.lib_deps}
  ${esp32_ota.lib_deps}
  bakercp/CRC32 @ ^2.0.0

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

[env:heltec_rc32_without_display_room_server]
extends = Heltec_RC32
build_flags =
  ${Heltec_RC32.build_flags}
  -D ADVERT_NAME='"Heltec RC32 Room"'
  -D ADVERT_LAT=0.0
  -D ADVERT_LON=0.0
  -D ADMIN_PASSWORD='"password"'
  -D ROOM_PASSWORD='"hello"'
build_src_filter = ${Heltec_RC32.build_src_filter}
  +<../examples/simple_room_server>
lib_deps =
  ${Heltec_RC32.lib_deps}
  ${esp32_ota.lib_deps}

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

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

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

[env:heltec_rc32_without_display_sensor]
extends = Heltec_RC32
build_flags =
  ${Heltec_RC32.build_flags}
  -D ADVERT_NAME='"Heltec RC32 Sensor"'
  -D ADVERT_LAT=0.0
  -D ADVERT_LON=0.0
  -D ADMIN_PASSWORD='"password"'
  -D ENV_PIN_SDA=21
  -D ENV_PIN_SCL=18
build_src_filter = ${Heltec_RC32.build_src_filter}
  +<../examples/simple_sensor>
lib_deps =
  ${Heltec_RC32.lib_deps}
  ${esp32_ota.lib_deps}

[env:heltec_rc32_repeater]
extends = Heltec_RC32_with_display
build_flags =
  ${Heltec_RC32_with_display.build_flags}
  -D ADVERT_NAME='"Heltec RC32 Repeater"'
  -D ADVERT_LAT=0.0
  -D ADVERT_LON=0.0
  -D ADMIN_PASSWORD='"password"'
  -D MAX_NEIGHBOURS=50
build_src_filter = ${Heltec_RC32_with_display.build_src_filter}
  +<../examples/simple_repeater>
lib_deps =
  ${Heltec_RC32_with_display.lib_deps}
  ${esp32_ota.lib_deps}
  bakercp/CRC32 @ ^2.0.0

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

[env:heltec_rc32_room_server]
extends = Heltec_RC32_with_display
build_flags =
  ${Heltec_RC32_with_display.build_flags}
  -D ADVERT_NAME='"Heltec RC32 Room"'
  -D ADVERT_LAT=0.0
  -D ADVERT_LON=0.0
  -D ADMIN_PASSWORD='"password"'
  -D ROOM_PASSWORD='"hello"'
build_src_filter = ${Heltec_RC32_with_display.build_src_filter}
  +<../examples/simple_room_server>
lib_deps =
  ${Heltec_RC32_with_display.lib_deps}
  ${esp32_ota.lib_deps}

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

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

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

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

[env:heltec_rc32_sensor]
extends = Heltec_RC32_with_display
build_flags =
  ${Heltec_RC32_with_display.build_flags}
  -D ADVERT_NAME='"Heltec RC32 Sensor"'
  -D ADVERT_LAT=0.0
  -D ADVERT_LON=0.0
  -D ADMIN_PASSWORD='"password"'
  -D ENV_PIN_SDA=21
  -D ENV_PIN_SCL=18
build_src_filter = ${Heltec_RC32_with_display.build_src_filter}
  +<../examples/simple_sensor>
lib_deps =
  ${Heltec_RC32_with_display.lib_deps}
  ${esp32_ota.lib_deps}

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