diff --git a/Boards.h b/Boards.h index 8f7c6b8..000caee 100644 --- a/Boards.h +++ b/Boards.h @@ -61,7 +61,9 @@ #define MODEL_D9 0xD9 // LilyGO T-Deck, 868 MHz #define PRODUCT_TBEAM_S_V1 0xEA + #define PRODUCT_TBEAM_S_V3 0xEC #define BOARD_TBEAM_S_V1 0x3D + #define BOARD_TBEAM_S_V3 0x43 #define MODEL_DB 0xDB // LilyGO T-Beam Supreme, 433 MHz #define MODEL_DC 0xDC // LilyGO T-Beam Supreme, 868 MHz @@ -829,6 +831,59 @@ #endif #endif + #elif BOARD_MODEL == BOARD_TBEAM_S_V3 + #define IS_ESP32S3 true + #define MODEM SX1262 + #define DIO2_AS_RF_SWITCH true + #define HAS_BUSY true + #define HAS_TCXO true + #define OCP_TUNED 0x18 + + #define HAS_DISPLAY true + #define HAS_CONSOLE true + #define HAS_WIFI true + #define HAS_BLUETOOTH false + #define HAS_BLE true + #define HAS_PMU true + #define HAS_NP false + #define HAS_SD false + #define HAS_EEPROM true + + #define HAS_INPUT true + #define HAS_SLEEP false + + #define PMU_IRQ 40 + #define I2C_SCL 41 + #define I2C_SDA 42 + + const int pin_btn_usr1 = 0; + + const int pin_cs = 10; + const int pin_reset = 5; + const int pin_sclk = 12; + const int pin_mosi = 11; + const int pin_miso = 13; + const int pin_tcxo_enable = -1; + const int pin_dio = 1; + const int pin_busy = 4; + + const int SD_MISO = 37; + const int SD_MOSI = 35; + const int SD_CLK = 36; + const int SD_CS = 47; + + const int IMU_CS = 34; + + #if HAS_NP == false + #if defined(EXTERNAL_LEDS) + const int pin_led_rx = 43; + const int pin_led_tx = 43; + #else + const int pin_led_rx = 43; + const int pin_led_tx = 43; + #endif + #endif + #elif BOARD_MODEL == BOARD_XIAO_S3 #define IS_ESP32S3 true #define MODEM SX1262 diff --git a/Display.h b/Display.h index 346e729..2f251f2 100644 --- a/Display.h +++ b/Display.h @@ -22,7 +22,7 @@ #elif BOARD_MODEL == BOARD_HELTEC_T114 #include "ST7789.h" #define COLOR565(r, g, b) (((r & 0xF8) << 8) | ((g & 0xFC) << 3) | ((b & 0xF8) >> 3)) - #elif BOARD_MODEL == BOARD_TBEAM_S_V1 + #elif BOARD_MODEL == BOARD_TBEAM_S_V1 || BOARD_MODEL == BOARD_TBEAM_S_V3 #include #else #include @@ -120,6 +120,12 @@ #define SCL_OLED 18 #define SDA_OLED 17 #define DISP_CUSTOM_ADDR false +#elif BOARD_MODEL == BOARD_TBEAM_S_V3 + #define DISP_RST -1 + #define DISP_ADDR 0x3D + #define SCL_OLED 18 + #define SDA_OLED 17 + #define DISP_CUSTOM_ADDR false #elif BOARD_MODEL == BOARD_XIAO_S3 #define DISP_RST -1 #define DISP_ADDR 0x3C @@ -142,7 +148,7 @@ ST7789Spi display(&SPI1, DISPLAY_RST, DISPLAY_DC, DISPLAY_CS); #define SSD1306_WHITE ST77XX_WHITE #define SSD1306_BLACK ST77XX_BLACK -#elif BOARD_MODEL == BOARD_TBEAM_S_V1 +#elif BOARD_MODEL == BOARD_TBEAM_S_V1 || BOARD_MODEL == BOARD_TBEAM_S_V3 Adafruit_SH1106G display = Adafruit_SH1106G(128, 64, &Wire, -1); #define SSD1306_WHITE SH110X_WHITE #define SSD1306_BLACK SH110X_BLACK @@ -255,7 +261,7 @@ void update_area_positions() { } uint8_t display_contrast = 0x00; -#if BOARD_MODEL == BOARD_TBEAM_S_V1 +#if BOARD_MODEL == BOARD_TBEAM_S_V1 || BOARD_MODEL == BOARD_TBEAM_S_V3 void set_contrast(Adafruit_SH1106G *display, uint8_t value) { } #elif BOARD_MODEL == BOARD_HELTEC_T114 @@ -355,7 +361,7 @@ bool display_init() { pinMode(pin_backlight, OUTPUT); analogWrite(pin_backlight, 0); #endif - #elif BOARD_MODEL == BOARD_TBEAM_S_V1 + #elif BOARD_MODEL == BOARD_TBEAM_S_V1 || BOARD_MODEL == BOARD_TBEAM_S_V3 Wire.begin(SDA_OLED, SCL_OLED); #elif BOARD_MODEL == BOARD_XIAO_S3 Wire.begin(SDA_OLED, SCL_OLED); @@ -412,7 +418,7 @@ bool display_init() { // set white as default pixel colour for Heltec T114 display.setRGB(COLOR565(0xFF, 0xFF, 0xFF)); if (false) { - #elif BOARD_MODEL == BOARD_TBEAM_S_V1 + #elif BOARD_MODEL == BOARD_TBEAM_S_V1 || BOARD_MODEL == BOARD_TBEAM_S_V3 if (!display.begin(display_address, true)) { #else if (!display.begin(SSD1306_SWITCHCAPVCC, display_address)) { @@ -446,7 +452,7 @@ bool display_init() { #elif BOARD_MODEL == BOARD_TBEAM disp_mode = DISP_MODE_LANDSCAPE; display.setRotation(0); - #elif BOARD_MODEL == BOARD_TBEAM_S_V1 + #elif BOARD_MODEL == BOARD_TBEAM_S_V1 || BOARD_MODEL == BOARD_TBEAM_S_V3 disp_mode = DISP_MODE_PORTRAIT; display.setRotation(1); #elif BOARD_MODEL == BOARD_HELTEC32_V2 diff --git a/Makefile b/Makefile index f6d0f12..71c1abb 100644 --- a/Makefile +++ b/Makefile @@ -153,6 +153,9 @@ firmware-tbeam: check_bt_buffers firmware-tbeam_supreme: arduino-cli compile --log --fqbn "esp32:esp32:esp32s3:CDCOnBoot=cdc" -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=-DBOARD_MODEL=0x3D" +firmware-tbeam_supreme_v3: + arduino-cli compile --log --fqbn "esp32:esp32:esp32s3:CDCOnBoot=cdc" -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=-DBOARD_MODEL=0x43" + firmware-tbeam_sx126x: check_bt_buffers arduino-cli compile --log --fqbn esp32:esp32:t-beam -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x33\" \"-DMODEM=0x03\"" @@ -289,6 +292,13 @@ upload-tbeam_supreme: @sleep 3 python ./Release/esptool/esptool.py --chip esp32s3 --port /dev/ttyACM0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x210000 ./Release/console_image.bin +upload-tbeam_supreme_v3: + arduino-cli upload -p /dev/ttyACM0 --fqbn esp32:esp32:esp32s3 + @sleep 1 + rnodeconf /dev/ttyACM0 --firmware-hash $$(./partition_hashes ./build/esp32.esp32.esp32s3/RNode_Firmware.ino.bin) + @sleep 3 + python ./Release/esptool/esptool.py --chip esp32s3 --port /dev/ttyACM0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x210000 ./Release/console_image.bin + upload-rnode_ng_20: arduino-cli upload -p /dev/ttyUSB0 --fqbn esp32:esp32:ttgo-lora32 @sleep 1 @@ -346,7 +356,7 @@ upload-xiao_s3: release: release-all -release-all: console-site spiffs-image release-tbeam release-tbeam_sx1262 release-lora32_v10 release-lora32_v20 release-lora32_v21 release-lora32_v10_extled release-lora32_v20_extled release-lora32_v21_extled release-lora32_v21_tcxo release-featheresp32 release-genericesp32 release-heltec32_v2 release-heltec32_v3 release-heltec32_v4 release-heltec32_v2_extled release-heltec_t114 release-techo release-rnode_ng_20 release-rnode_ng_21 release-t3s3 release-t3s3_sx127x release-t3s3_sx1280_pa release-tdeck release-tbeam_supreme release-rak4631 release-xiao_s3 release-hashes +release-all: console-site spiffs-image release-tbeam release-tbeam_sx1262 release-lora32_v10 release-lora32_v20 release-lora32_v21 release-lora32_v10_extled release-lora32_v20_extled release-lora32_v21_extled release-lora32_v21_tcxo release-featheresp32 release-genericesp32 release-heltec32_v2 release-heltec32_v3 release-heltec32_v4 release-heltec32_v2_extled release-heltec_t114 release-techo release-rnode_ng_20 release-rnode_ng_21 release-t3s3 release-t3s3_sx127x release-t3s3_sx1280_pa release-tdeck release-tbeam_supreme release-tbeam_supreme_v3 release-rak4631 release-xiao_s3 release-hashes release-hashes: python ./release_hashes.py > ./Release/release.json @@ -536,6 +546,15 @@ release-tbeam_supreme: zip --junk-paths ./Release/rnode_firmware_tbeam_supreme.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_tbeam_supreme.boot_app0 build/rnode_firmware_tbeam_supreme.bin build/rnode_firmware_tbeam_supreme.bootloader build/rnode_firmware_tbeam_supreme.partitions rm -r build +release-tbeam_supreme_v3: + arduino-cli compile --fqbn "esp32:esp32:esp32s3:CDCOnBoot=cdc" -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x43\"" + cp ~/.arduino15/packages/esp32/hardware/esp32/$(ARDUINO_ESP_CORE_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_tbeam_supreme_v3.boot_app0 + cp build/esp32.esp32.esp32s3/RNode_Firmware.ino.bin build/rnode_firmware_tbeam_supreme_v3.bin + cp build/esp32.esp32.esp32s3/RNode_Firmware.ino.bootloader.bin build/rnode_firmware_tbeam_supreme_v3.bootloader + cp build/esp32.esp32.esp32s3/RNode_Firmware.ino.partitions.bin build/rnode_firmware_tbeam_supreme_v3.partitions + zip --junk-paths ./Release/rnode_firmware_tbeam_supreme_v3.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_tbeam_supreme_v3.boot_app0 build/rnode_firmware_tbeam_supreme_v3.bin build/rnode_firmware_tbeam_supreme_v3.bootloader build/rnode_firmware_tbeam_supreme_v3.partitions + rm -r build + release-featheresp32: check_bt_buffers arduino-cli compile --fqbn esp32:esp32:featheresp32 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x34\"" cp ~/.arduino15/packages/esp32/hardware/esp32/$(ARDUINO_ESP_CORE_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_featheresp32.boot_app0 @@ -581,6 +600,16 @@ release-diy_v1: check_bt_buffers zip --junk-paths ./Release/rnode_firmware_diy_v1.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_diy_v1.boot_app0 build/rnode_firmware_diy_v1.bin build/rnode_firmware_diy_v1.bootloader build/rnode_firmware_diy_v1.partitions rm -r build +release-merged-diy_v1: check_bt_buffers + arduino-cli compile --fqbn esp32:esp32:esp32 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0xF6\"" + cp ~/.arduino15/packages/esp32/hardware/esp32/$(ARDUINO_ESP_CORE_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_diy_v1.boot_app0 + cp build/esp32.esp32.esp32/RNode_Firmware.ino.bin build/rnode_firmware_diy_v1.bin + cp build/esp32.esp32.esp32/RNode_Firmware.ino.bootloader.bin build/rnode_firmware_diy_v1.bootloader + cp build/esp32.esp32.esp32/RNode_Firmware.ino.partitions.bin build/rnode_firmware_diy_v1.partitions + python ./Release/esptool/esptool.py --chip esp32 merge_bin -o build/rnode_firmware_diy_v1.merged.bin --flash_mode dio --flash_freq 40m --flash_size 4MB 0x1000 build/rnode_firmware_diy_v1.bootloader 0x8000 build/rnode_firmware_diy_v1.partitions 0xe000 build/rnode_firmware_diy_v1.boot_app0 0x10000 build/rnode_firmware_diy_v1.bin + cp build/rnode_firmware_diy_v1.merged.bin ./Release/rnode_firmware_diy_v1.merged.bin + rm -r build + release-aethernode: check_bt_buffers arduino-cli compile --fqbn esp32:esp32:esp32 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x35\"" cp ~/.arduino15/packages/esp32/hardware/esp32/$(ARDUINO_ESP_CORE_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_aethernode.boot_app0 diff --git a/Power.h b/Power.h index ff42676..62ee607 100644 --- a/Power.h +++ b/Power.h @@ -19,12 +19,12 @@ bool pmu_temp_sensor_ready = false; float pmu_temperature = PMU_TEMP_MIN-1; -#if BOARD_MODEL == BOARD_TBEAM || BOARD_MODEL == BOARD_TBEAM_S_V1 +#if BOARD_MODEL == BOARD_TBEAM || BOARD_MODEL == BOARD_TBEAM_S_V1 || BOARD_MODEL == BOARD_TBEAM_S_V3 #include XPowersLibInterface* PMU = NULL; #ifndef PMU_WIRE_PORT - #if BOARD_MODEL == BOARD_TBEAM_S_V1 + #if BOARD_MODEL == BOARD_TBEAM_S_V1 || BOARD_MODEL == BOARD_TBEAM_S_V3 #define PMU_WIRE_PORT Wire1 #else #define PMU_WIRE_PORT Wire @@ -327,7 +327,7 @@ void measure_battery() { // } } - #elif BOARD_MODEL == BOARD_TBEAM || BOARD_MODEL == BOARD_TBEAM_S_V1 + #elif BOARD_MODEL == BOARD_TBEAM || BOARD_MODEL == BOARD_TBEAM_S_V1 || BOARD_MODEL == BOARD_TBEAM_S_V3 if (PMU) { float discharge_current = 0; float charge_current = 0; @@ -583,7 +583,7 @@ bool init_pmu() { PMU->setPowerKeyPressOffTime(XPOWERS_POWEROFF_4S); return true; - #elif BOARD_MODEL == BOARD_TBEAM_S_V1 + #elif BOARD_MODEL == BOARD_TBEAM_S_V1 || BOARD_MODEL == BOARD_TBEAM_S_V3 Wire1.begin(I2C_SDA, I2C_SCL); if (!PMU) { diff --git a/RNode_Firmware.ino b/RNode_Firmware.ino index 29e58a6..e1716cc 100644 --- a/RNode_Firmware.ino +++ b/RNode_Firmware.ino @@ -135,7 +135,7 @@ void setup() { boot_seq(); #endif - #if BOARD_MODEL != BOARD_RAK4631 && BOARD_MODEL != BOARD_HELTEC_T114 && BOARD_MODEL != BOARD_MESHADVENTURER_S3 && BOARD_MODEL != BOARD_PROMICRO && BOARD_MODEL != BOARD_TECHO && BOARD_MODEL != BOARD_T3S3 && BOARD_MODEL != BOARD_TBEAM_S_V1 && BOARD_MODEL != BOARD_HELTEC32_V4 + #if BOARD_MODEL != BOARD_RAK4631 && BOARD_MODEL != BOARD_HELTEC_T114 && BOARD_MODEL != BOARD_MESHADVENTURER_S3 && BOARD_MODEL != BOARD_PROMICRO && BOARD_MODEL != BOARD_TECHO && BOARD_MODEL != BOARD_T3S3 && BOARD_MODEL != BOARD_TBEAM_S_V1 && BOARD_MODEL != BOARD_TBEAM_S_V3 && BOARD_MODEL != BOARD_HELTEC32_V4 // Some boards need to wait until the hardware UART is set up before booting // the full firmware. In the case of the RAK4631 and Heltec T114, the line below will wait // until a serial connection is actually established with a master. Thus, it diff --git a/Release/rnode_firmware_diy_v1.merged.bin b/Release/rnode_firmware_diy_v1.merged.bin new file mode 100644 index 0000000..2982e1a Binary files /dev/null and b/Release/rnode_firmware_diy_v1.merged.bin differ diff --git a/Utilities.h b/Utilities.h index 10df950..dbbe7e7 100644 --- a/Utilities.h +++ b/Utilities.h @@ -250,6 +250,13 @@ uint8_t boot_vector = 0x00; void led_tx_off() { } void led_id_on() { } void led_id_off() { } + #elif BOARD_MODEL == BOARD_TBEAM_S_V3 + void led_rx_on() { } + void led_rx_off() { } + void led_tx_on() { } + void led_tx_off() { } + void led_id_on() { } + void led_id_off() { } #elif BOARD_MODEL == BOARD_LORA32_V1_0 #if defined(EXTERNAL_LEDS) void led_rx_on() { digitalWrite(pin_led_rx, HIGH); } diff --git a/sx126x.cpp b/sx126x.cpp index 560b120..7ed65eb 100644 --- a/sx126x.cpp +++ b/sx126x.cpp @@ -730,6 +730,8 @@ void sx126x::enableTCXO() { uint8_t buf[4] = {MODE_TCXO_1_8V_6X, 0x00, 0x00, 0xFF}; #elif BOARD_MODEL == BOARD_TBEAM_S_V1 uint8_t buf[4] = {MODE_TCXO_1_8V_6X, 0x00, 0x00, 0xFF}; + #elif BOARD_MODEL == BOARD_TBEAM_S_V3 + uint8_t buf[4] = {MODE_TCXO_1_8V_6X, 0x00, 0x00, 0xFF}; #elif BOARD_MODEL == BOARD_T3S3 uint8_t buf[4] = {MODE_TCXO_1_8V_6X, 0x00, 0x00, 0xFF}; #elif BOARD_MODEL == BOARD_HELTEC_T114