Files
MeshCore/variants/rak3401/platformio.ini
T
mikecarper d5a6df6283 Detect SSD1306 and SH1106 screens on RAK boards
Use repeated status reads at screen initialization and preserve SSD1306 for ambiguous responses. Share the existing framebuffer, drawing, rotation and power handling; use SH1106 page transfers when detected.

Enable this for RAK4631 and RAK3401, including WisMesh Pocket v2/v3. Add controller overrides, protocol tests and CI coverage. Addresses meshcore-dev/MeshCore#3296.
2026-10-20 09:43:25 -07:00

265 lines
8.9 KiB
INI

[rak3401]
extends = nrf52_base
board = rak3401
board_check = true
board_build.ldscript = boards/nrf52840_s140_v6.ld
extra_scripts = ${nrf52_base.extra_scripts}
post:variants/rak3401/fix_bsec_lib.py
build_flags = ${nrf52_base.build_flags}
${sensor_base.build_flags}
-I variants/rak3401
-D RAK_3401
-D RAK_BOARD
-D RECOVERABLE_EXTERNAL_RADIO
; RAK13300/RAK13302 BUSY and DIO1 use nRF52840 P0.09/P0.10. A full
; chip erase restores those pads to NFC mode, so SystemInit must repair
; UICR and reset once before the external SX1262 can be reached.
-D CONFIG_NFCT_PINS_AS_GPIOS
-D NRF52_POWER_MANAGEMENT
-D OLED_AUTO_DETECT=1 ; shared WisBlock SSD1306 / SH1106 screen support
-D RADIO_CLASS=CustomSX1262
-D WRAPPER_CLASS=CustomSX1262Wrapper
-D LORA_TX_POWER=22
-D SX126X_CURRENT_LIMIT=140
-D SX126X_RX_BOOSTED_GAIN=1
-D SX126X_REGISTER_PATCH=1 ; Patch register 0x8B5 for improved RX with SKY66122 FEM
; WB_IO2 also powers the radio frontend: its immutable rail hold stays HIGH.
; GPS may stop parsing, but it must never remove this shared radio supply.
-D PIN_GPS_EN=-1 ; -1 = no dedicated GPS enable pin (power is the shared 3V3_S rail), same as rak4631
-UENV_INCLUDE_BME680
-D ENV_INCLUDE_BME680_BSEC=1
build_src_filter = ${nrf52_base.build_src_filter}
+<../variants/rak3401>
+<helpers/sensors>
+<helpers/ui/SSD1306Display.cpp>
+<helpers/ui/MomentaryButton.cpp>
lib_deps =
${nrf52_base.lib_deps}
${sensor_base.lib_deps}
adafruit/Adafruit SSD1306 @ ^2.5.13
sparkfun/SparkFun u-blox GNSS Arduino Library@^2.2.27
boschsensortec/BSEC Software Library @ ^1.8.1492
[env:RAK_3401_repeater]
extends = rak3401
extra_scripts = ${nrf52_lora_ota.extra_scripts}
post:variants/rak3401/fix_bsec_lib.py
build_flags =
${rak3401.build_flags}
-UENABLE_OTA
-D DISABLE_LORA_OTA=1 ; Full external-sensor build exceeds the in-place OTA ceiling
-D DISPLAY_CLASS=SSD1306Display
-D ADVERT_NAME='"RAK3401 1W 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 = ${rak3401.build_src_filter}
+<helpers/ota/*.cpp>
+<helpers/ui/SSD1306Display.cpp>
+<../examples/simple_repeater>
; Explicit lean alternative to the full-sensor, non-OTA repeater above. It removes optional
; environmental telemetry sensors while retaining the common INA I2C voltage/current monitors,
; board display/RTC support, and both RAK12500 I2C and RAK12501 UART GPS paths. Use sensor slot A:
; slot D conflicts with the RAK13302 radio's BUSY/DIO1 wiring.
; RAK12500 and the configured INA3221 both use I2C address 0x42, so they cannot be installed
; together at those addresses. Keep GPS at 0x42, strap INA3221 A0 to SCL for 0x43, and build
; with -DTELEM_INA3221_ADDRESS=0x43 when both modules are required.
; The legacy target name remains stable for OTA compatibility.
[env:RAK_3401_repeater_lora_ota_no_external_sensors]
extends = rak3401
extra_scripts = ${nrf52_lora_ota.extra_scripts}
post:variants/rak3401/fix_bsec_lib.py
build_flags =
${rak3401.build_flags}
${nrf52_reduced_sensors_keep_ina_gps.build_flags}
-D DISPLAY_CLASS=SSD1306Display
-D ADVERT_NAME='"RAK3401 1W Repeater"'
-D ADVERT_LAT=0.0
-D ADVERT_LON=0.0
-D ADMIN_PASSWORD='"password"'
-D MAX_NEIGHBOURS=50
-D ENABLE_OTA=1
-D OTA_FLASH_STORE=1
-D OTA_FOLDER_SERIAL
-D OTA_TARGET_NAME_TABLE=0 ; IDs remain authoritative; omit the 540-entry display-name table
-D OTA_LOCAL_TARGET_ID=0x2fa509c1
-D OTA_LOCAL_TARGET_NAME='"RAK_3401_repeater_lora_ota_no_external_sensors"'
-D OTA_FETCH_PIPELINE=4 ; adaptive one-packet flights grow 1 -> 2 -> 3 -> 4 on a clean link
build_src_filter = ${rak3401.build_src_filter}
+<helpers/ota/*.cpp>
+<helpers/ui/SSD1306Display.cpp>
+<../examples/simple_repeater>
lib_deps =
${nrf52_lora_ota.lib_deps}
${nrf52_reduced_sensors_keep_ina_gps.lib_deps}
adafruit/Adafruit SSD1306 @ ^2.5.13
sparkfun/SparkFun u-blox GNSS Arduino Library@^2.2.27
; Full-sensor/GPS repeater with RAK13302 1 W radio and an exact 2 MiB Winbond
; W25Q16JV breakout. The flash shares SCK/MOSI/MISO with the RAK13302 but uses
; its own CS on J11 AIN1. The QSPI store temporarily releases and restores SPI1
; while holding the radio NSS high. GPS remains supported in sensor slot A.
[env:RAK_3401_repeater_rak13302_w25q16_lora_ota]
extends = rak3401
extra_scripts = ${nrf52_lora_ota.extra_scripts}
post:variants/rak3401/fix_bsec_lib.py
build_flags =
${rak3401.build_flags}
${nrf52_wisblock_w25q16_ota.build_flags}
-D OTA_QSPI_RAK3401_RADIO_BUS_HANDOFF=1
-D MOTA_HW_ID='"RAK3401_RAK13302_W25Q16"'
-D DISPLAY_CLASS=SSD1306Display
-D ADVERT_NAME='"RAK3401 1W + W25Q16 OTA"'
-D ADVERT_LAT=0.0
-D ADVERT_LON=0.0
-D ADMIN_PASSWORD='"password"'
-D MAX_NEIGHBOURS=50
-D ENABLE_OTA=1
-D OTA_FOLDER_SERIAL
-D OTA_FETCH_PIPELINE=4
build_src_filter = ${rak3401.build_src_filter}
+<helpers/ota/*.cpp>
+<helpers/ui/SSD1306Display.cpp>
+<../examples/simple_repeater>
; One full-sensor repeater image for internal flash or the separate-CS W25Q16.
; RAK15001 cannot be selected: it shares the RAK13302 radio chip-select.
[env:RAK_3401_repeater_unified_lora_ota]
extends = rak3401
extra_scripts = ${nrf52_lora_ota.extra_scripts}
post:variants/rak3401/fix_bsec_lib.py
build_flags =
${rak3401.build_flags}
${nrf52_wisblock_auto_ota.build_flags}
-D OTA_QSPI_RAK3401_RADIO_BUS_HANDOFF=1
-D DISPLAY_CLASS=SSD1306Display
-D ADVERT_NAME='"RAK3401 1W Repeater"'
-D ADVERT_LAT=0.0
-D ADVERT_LON=0.0
-D ADMIN_PASSWORD='"password"'
-D MAX_NEIGHBOURS=50
-D ENABLE_OTA=1
-D OTA_FOLDER_SERIAL
-D OTA_TARGET_NAME_TABLE=0
-D OTA_FETCH_PIPELINE=4
build_src_filter = ${rak3401.build_src_filter}
+<helpers/ota/*.cpp>
+<helpers/ui/SSD1306Display.cpp>
+<../examples/simple_repeater>
[env:RAK_3401_repeater_bridge_rs232_serial1]
extends = env:RAK_3401_repeater
build_flags =
${env:RAK_3401_repeater.build_flags}
; This dedicated bridge owns the GPS connector's UART1. Never probe or
; restart GPS on the same pins while the external serial peer is attached.
-UENV_INCLUDE_GPS
-D ENV_INCLUDE_GPS=0
-D ADVERT_NAME='"RAK3401 1W RS232 Bridge"'
-D WITH_RS232_BRIDGE=Serial1
-D WITH_RS232_BRIDGE_UART=1
-D WITH_RS232_BRIDGE_RX=PIN_SERIAL1_RX
-D WITH_RS232_BRIDGE_TX=PIN_SERIAL1_TX
build_src_filter = ${env:RAK_3401_repeater.build_src_filter}
+<helpers/bridges/RS232Bridge.cpp>
[env:RAK_3401_room_server]
extends = rak3401
build_flags =
${rak3401.build_flags}
-D DISPLAY_CLASS=SSD1306Display
-D ADVERT_NAME='"Test 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 = ${rak3401.build_src_filter}
+<helpers/ui/SSD1306Display.cpp>
+<../examples/simple_room_server>
[env:RAK_3401_companion_radio_usb]
extends = rak3401
board_build.ldscript = boards/nrf52840_s140_v6_extrafs.ld
board_upload.maximum_size = 712704
build_flags =
${rak3401.build_flags}
-I examples/companion_radio/ui-new
-D PIN_USER_BTN_ANA=31
-D DISPLAY_CLASS=SSD1306Display
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D ENABLE_USB_INTERFACE
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
build_src_filter = ${rak3401.build_src_filter}
+<../examples/companion_radio/*.cpp>
+<../examples/companion_radio/ui-new/*.cpp>
lib_deps =
${rak3401.lib_deps}
densaugeo/base64 @ ~1.4.0
[env:RAK_3401_companion_radio_ble]
extends = rak3401
board_build.ldscript = boards/nrf52840_s140_v6_extrafs.ld
board_upload.maximum_size = 712704
build_flags =
${rak3401.build_flags}
-I examples/companion_radio/ui-new
-D PIN_USER_BTN_ANA=31
-D DISPLAY_CLASS=SSD1306Display
-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 MESH_PACKET_LOGGING=1
;-D MESH_DEBUG=1
build_src_filter = ${rak3401.build_src_filter}
+<helpers/nrf52/SerialBLEInterface.cpp>
+<../examples/companion_radio/*.cpp>
+<../examples/companion_radio/ui-new/*.cpp>
lib_deps =
${rak3401.lib_deps}
densaugeo/base64 @ ~1.4.0
[env:RAK_3401_terminal_chat]
extends = rak3401
build_flags =
${rak3401.build_flags}
-D MAX_CONTACTS=100
-D MAX_GROUP_CHANNELS=1
;-D MESH_PACKET_LOGGING=1
;-D MESH_DEBUG=1
build_src_filter = ${rak3401.build_src_filter}
+<../examples/simple_secure_chat/main.cpp>
lib_deps =
${rak3401.lib_deps}
densaugeo/base64 @ ~1.4.0
[env:RAK_3401_sensor]
extends = rak3401
build_flags =
${rak3401.build_flags}
-D DISPLAY_CLASS=SSD1306Display
-D ADVERT_NAME='"RAK3401 Sensor"'
-D ADVERT_LAT=0.0
-D ADVERT_LON=0.0
-D ADMIN_PASSWORD='"password"'
-D USER_GPIO_CONTROL=1
;-D MESH_PACKET_LOGGING=1
;-D MESH_DEBUG=1
build_src_filter = ${rak3401.build_src_filter}
+<helpers/ui/SSD1306Display.cpp>
+<../examples/simple_sensor>
[env:RAK_3401_kiss_modem]
extends = rak3401
build_src_filter = ${rak3401.build_src_filter}
+<../examples/kiss_modem/>