diff --git a/examples/simple_repeater/main.cpp b/examples/simple_repeater/main.cpp index fe444bfb..145c0b59 100644 --- a/examples/simple_repeater/main.cpp +++ b/examples/simple_repeater/main.cpp @@ -50,6 +50,10 @@ #include #include static XiaoC3Board board; +#elif defined(SEEED_XIAO_S3) + #include + #include + static ESP32Board board; #else #error "need to provide a 'board' object" #endif @@ -377,6 +381,7 @@ void setup() { int status = radio.begin(LORA_FREQ, LORA_BW, LORA_SF, LORA_CR, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, LORA_TX_POWER, 8, tcxo); #endif if (status != RADIOLIB_ERR_NONE) { + delay(5000); Serial.print("ERROR: radio init failed: "); Serial.println(status); halt(); diff --git a/platformio.ini b/platformio.ini index cf53e5a7..bc4a068b 100644 --- a/platformio.ini +++ b/platformio.ini @@ -118,6 +118,9 @@ build_flags = -D P_LORA_NSS=D4 -D P_LORA_RESET=RADIOLIB_NC -D P_LORA_BUSY=D1 + -D SX126X_DIO2_AS_RF_SWITCH=true + -D SX126X_DIO3_TCXO_VOLTAGE=1.8 + -D SX126X_CURRENT_LIMIT=130.0f ; for best TX power! [env:Xiao_C3_Repeater_sx1262] extends = Xiao_esp32_C3 @@ -130,9 +133,8 @@ build_flags = -D LORA_FREQ=915.0 -D LORA_BW=250 -D LORA_SF=10 - -D REPEATER_NAME="\"Xiao Repeater1\"" - -D MESH_PACKET_LOGGING=1 - -D MESH_DEBUG=1 +; -D MESH_PACKET_LOGGING=1 +; -D MESH_DEBUG=1 [env:Xiao_C3_Repeater_sx1268] extends = Xiao_esp32_C3 @@ -145,9 +147,38 @@ build_flags = -D LORA_FREQ=433.0 -D LORA_BW=250 -D LORA_SF=10 - -D REPEATER_NAME="\"Xiao Repeater1\"" ; -D MESH_PACKET_LOGGING=1 ; -D MESH_DEBUG=1 ; ============= +[Xiao_S3_WIO] +extends = esp32_base +board = seeed_xiao_esp32s3 +board_check = true +board_build.mcu = esp32s3 +build_flags = ${esp32_base.build_flags} + -D SEEED_XIAO_S3 + -D P_LORA_DIO_1=39 + -D P_LORA_NSS=41 + -D P_LORA_RESET=42 ; RADIOLIB_NC + -D P_LORA_BUSY=40 ; DIO2 = 38 + -D P_LORA_SCLK=7 + -D P_LORA_MISO=8 + -D P_LORA_MOSI=9 + -D SX126X_DIO2_AS_RF_SWITCH=true + -D SX126X_DIO3_TCXO_VOLTAGE=1.8 + -D SX126X_CURRENT_LIMIT=130 +[env:Xiao_S3_WIO_Repeater] +extends = Xiao_S3_WIO +build_src_filter = ${Xiao_S3_WIO.build_src_filter} +<../examples/simple_repeater/main.cpp> +build_flags = + ${Xiao_S3_WIO.build_flags} + -D RADIO_CLASS=CustomSX1262 + -D WRAPPER_CLASS=CustomSX1262Wrapper + -D LORA_TX_POWER=22 + -D LORA_FREQ=915.0 + -D LORA_BW=250 + -D LORA_SF=10 +; -D MESH_PACKET_LOGGING=1 +; -D MESH_DEBUG=1 diff --git a/src/helpers/ESP32Board.h b/src/helpers/ESP32Board.h index 37066233..7b88b25e 100644 --- a/src/helpers/ESP32Board.h +++ b/src/helpers/ESP32Board.h @@ -8,10 +8,24 @@ #include #include -class ESP32Board : public mesh::MainBoard { // abstract class +class ESP32Board : public mesh::MainBoard { +protected: + uint8_t startup_reason; + public: void begin() { // for future use, sub-classes SHOULD call this from their begin() + startup_reason = BD_STARTUP_NORMAL; + } + + uint8_t getStartupReason() const override { return startup_reason; } + + uint16_t getBattMilliVolts() override { + return 0; // not supported + } + + const char* getManufacturerName() const override { + return "Generic ESP32"; } void reboot() override { diff --git a/src/helpers/HeltecV3Board.h b/src/helpers/HeltecV3Board.h index 5ed2b1cf..1e619300 100644 --- a/src/helpers/HeltecV3Board.h +++ b/src/helpers/HeltecV3Board.h @@ -22,10 +22,8 @@ #include class HeltecV3Board : public ESP32Board { - uint8_t startup_reason; public: void begin() { - startup_reason = BD_STARTUP_NORMAL; ESP32Board::begin(); esp_reset_reason_t reason = esp_reset_reason(); @@ -46,8 +44,6 @@ public: pinMode(PIN_ADC_CTRL, OUTPUT); } - uint8_t getStartupReason() const { return startup_reason; } - void enterDeepSleep(uint32_t secs, int pin_wake_btn = -1) { esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON); diff --git a/src/helpers/XiaoC3Board.h b/src/helpers/XiaoC3Board.h index d9f9db28..c97f22b7 100644 --- a/src/helpers/XiaoC3Board.h +++ b/src/helpers/XiaoC3Board.h @@ -12,10 +12,8 @@ #include class XiaoC3Board : public ESP32Board { - uint8_t startup_reason; public: void begin() { - startup_reason = BD_STARTUP_NORMAL; ESP32Board::begin(); esp_reset_reason_t reason = esp_reset_reason(); @@ -47,8 +45,6 @@ public: #endif } - uint8_t getStartupReason() const { return startup_reason; } - void enterDeepSleep(uint32_t secs, int8_t wake_pin = -1) { gpio_set_direction(gpio_num_t(P_LORA_DIO_1), GPIO_MODE_INPUT); if (wake_pin >= 0) { @@ -111,7 +107,7 @@ public: return ((5.78 * raw) / 1024.0) * 1000; #else - return 0; + return 0; // not supported #endif }