diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index 87ba8cf85..54e721083 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -1,4 +1,7 @@ name: CI +concurrency: + group: ${{ github.head_ref || github.run_id }} + cancel-in-progress: true #concurrency: # group: ${{ github.ref }} # cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} @@ -32,7 +35,11 @@ jobs: name: Checkout base - id: jsonStep run: | - TARGETS=$(./bin/generate_ci_matrix.py ${{matrix.arch}} quick) + if [[ "${{ github.ref }}" == "refs/heads/master" ]]; then + TARGETS=$(./bin/generate_ci_matrix.py ${{matrix.arch}}) + else + TARGETS=$(./bin/generate_ci_matrix.py ${{matrix.arch}} quick) + fi echo "$TARGETS" echo "${{matrix.arch}}=$(jq -cn --argjson environments "$TARGETS" '{board: $environments}')" >> $GITHUB_OUTPUT outputs: diff --git a/arch/esp32/esp32c6.ini b/arch/esp32/esp32c6.ini new file mode 100644 index 000000000..3c2165642 --- /dev/null +++ b/arch/esp32/esp32c6.ini @@ -0,0 +1,40 @@ +[esp32c6_base] +extends = esp32_base +platform = https://github.com/Jason2866/platform-espressif32.git#22faa566df8c789000f8136cd8d0aca49617af55 +build_flags = + ${arduino_base.build_flags} + -Wall + -Wextra + -Isrc/platform/esp32 + -std=c++11 + -DESP_OPENSSL_SUPPRESS_LEGACY_WARNING + -DSERIAL_BUFFER_SIZE=4096 + -DLIBPAX_ARDUINO + -DLIBPAX_WIFI + -DLIBPAX_BLE + -DMESHTASTIC_EXCLUDE_WEBSERVER + ;-DDEBUG_HEAP + ; TEMP + -DHAS_BLUETOOTH=0 + -DMESHTASTIC_EXCLUDE_PAXCOUNTER + -DMESHTASTIC_EXCLUDE_BLUETOOTH + +lib_deps = + ${arduino_base.lib_deps} + ${networking_base.lib_deps} + ${environmental_base.lib_deps} + https://github.com/lewisxhe/XPowersLib.git#84b7373faea3118b6c37954d52f98b8a337148d6 + https://github.com/meshtastic/ESP32_Codec2.git#633326c78ac251c059ab3a8c430fcdf25b41672f + rweather/Crypto@^0.4.0 + +build_src_filter = + ${esp32_base.build_src_filter} - + +monitor_speed = 460800 +monitor_filters = esp32_c3_exception_decoder + +lib_ignore = + NonBlockingRTTTL + NimBLE-Arduino + libpax + \ No newline at end of file diff --git a/platformio.ini b/platformio.ini index 81aa2041e..f528a6fde 100644 --- a/platformio.ini +++ b/platformio.ini @@ -157,13 +157,11 @@ lib_deps = emotibit/EmotiBit MLX90632@^1.0.8 dfrobot/DFRobot_RTU@^1.0.3 - https://github.com/boschsensortec/Bosch-BSEC2-Library#v1.7.2502 boschsensortec/BME68x Sensor Library@^1.1.40407 https://github.com/KodinLanewave/INA3221@^1.0.0 lewisxhe/SensorLib@0.2.0 mprograms/QMC5883LCompass@^1.2.0 - https://github.com/meshtastic/DFRobot_LarkWeatherStation#dee914270dc7cb3e43fbf034edd85a63a16a12ee https://github.com/gjelsoe/STK8xxx-Accelerometer.git#v0.1.1 diff --git a/protobufs b/protobufs index 6ac91926c..83c78e26e 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 6ac91926c201c15c429cb5d41684f0f40cb7dce8 +Subproject commit 83c78e26e39031ae1c17ba5e50d0898842719c7f diff --git a/src/SerialConsole.cpp b/src/SerialConsole.cpp index 15366d222..fe6ccdefe 100644 --- a/src/SerialConsole.cpp +++ b/src/SerialConsole.cpp @@ -46,7 +46,8 @@ SerialConsole::SerialConsole() : StreamAPI(&Port), RedirectablePrint(&Port), con Port.setRX(SERIAL2_RX); #endif Port.begin(SERIAL_BAUD); -#if defined(ARCH_NRF52) || defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3) || defined(ARCH_RP2040) +#if defined(ARCH_NRF52) || defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3) || defined(ARCH_RP2040) || \ + defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32C6) time_t timeout = millis(); while (!Port) { if (Throttle::isWithinTimespanMs(timeout, FIVE_SECONDS_MS)) { diff --git a/src/configuration.h b/src/configuration.h index 55206bf4e..3cd93ec83 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -69,6 +69,9 @@ along with this program. If not, see . #ifndef RTC_DATA_ATTR #define RTC_DATA_ATTR #endif +#ifndef EXT_RAM_BSS_ATTR +#define EXT_RAM_BSS_ATTR EXT_RAM_ATTR +#endif // ----------------------------------------------------------------------------- // Regulatory overrides diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index fdad2b24b..b6d2776bc 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -62,7 +62,8 @@ const char *getGPSPowerStateString(GPSPowerState state) case GPS_OFF: return "OFF"; default: - assert(false); // Unhandled enum value.. + assert(false); // Unhandled enum value.. + return "FALSE"; // to make new ESP-IDF happy } } @@ -332,7 +333,7 @@ int GPS::getACK(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t { uint16_t ubxFrameCounter = 0; uint32_t startTime = millis(); - uint16_t needRead; + uint16_t needRead = 0; while (Throttle::isWithinTimespanMs(startTime, waitMillis)) { if (_serial_gps->available()) { diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index f95146318..4f6a5a45f 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -58,10 +58,11 @@ along with this program. If not, see . #ifdef ARCH_ESP32 #include "esp_task_wdt.h" -#include "modules/esp32/StoreForwardModule.h" +#include "modules/StoreForwardModule.h" #endif #if ARCH_PORTDUINO +#include "modules/StoreForwardModule.h" #include "platform/portduino/PortduinoGlue.h" #endif @@ -1007,55 +1008,55 @@ static void drawTextMessageFrame(OLEDDisplay *display, OLEDDisplayUiState *state display->setColor(WHITE); #ifndef EXCLUDE_EMOJI - if (strcmp(reinterpret_cast(mp.decoded.payload.bytes), u8"\U0001F44D") == 0) { + if (strcmp(reinterpret_cast(mp.decoded.payload.bytes), "\U0001F44D") == 0) { display->drawXbm(x + (SCREEN_WIDTH - thumbs_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - thumbs_height) / 2 + 2 + 5, thumbs_width, thumbs_height, thumbup); - } else if (strcmp(reinterpret_cast(mp.decoded.payload.bytes), u8"\U0001F44E") == 0) { + } else if (strcmp(reinterpret_cast(mp.decoded.payload.bytes), "\U0001F44E") == 0) { display->drawXbm(x + (SCREEN_WIDTH - thumbs_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - thumbs_height) / 2 + 2 + 5, thumbs_width, thumbs_height, thumbdown); - } else if (strcmp(reinterpret_cast(mp.decoded.payload.bytes), u8"❓") == 0) { + } else if (strcmp(reinterpret_cast(mp.decoded.payload.bytes), "❓") == 0) { display->drawXbm(x + (SCREEN_WIDTH - question_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - question_height) / 2 + 2 + 5, question_width, question_height, question); - } else if (strcmp(reinterpret_cast(mp.decoded.payload.bytes), u8"‼️") == 0) { + } else if (strcmp(reinterpret_cast(mp.decoded.payload.bytes), "‼️") == 0) { display->drawXbm(x + (SCREEN_WIDTH - bang_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - bang_height) / 2 + 2 + 5, bang_width, bang_height, bang); - } else if (strcmp(reinterpret_cast(mp.decoded.payload.bytes), u8"\U0001F4A9") == 0) { + } else if (strcmp(reinterpret_cast(mp.decoded.payload.bytes), "\U0001F4A9") == 0) { display->drawXbm(x + (SCREEN_WIDTH - poo_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - poo_height) / 2 + 2 + 5, poo_width, poo_height, poo); } else if (strcmp(reinterpret_cast(mp.decoded.payload.bytes), "\xf0\x9f\xa4\xa3") == 0) { display->drawXbm(x + (SCREEN_WIDTH - haha_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - haha_height) / 2 + 2 + 5, haha_width, haha_height, haha); - } else if (strcmp(reinterpret_cast(mp.decoded.payload.bytes), u8"\U0001F44B") == 0) { + } else if (strcmp(reinterpret_cast(mp.decoded.payload.bytes), "\U0001F44B") == 0) { display->drawXbm(x + (SCREEN_WIDTH - wave_icon_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - wave_icon_height) / 2 + 2 + 5, wave_icon_width, wave_icon_height, wave_icon); - } else if (strcmp(reinterpret_cast(mp.decoded.payload.bytes), u8"\U0001F920") == 0) { + } else if (strcmp(reinterpret_cast(mp.decoded.payload.bytes), "\U0001F920") == 0) { display->drawXbm(x + (SCREEN_WIDTH - cowboy_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - cowboy_height) / 2 + 2 + 5, cowboy_width, cowboy_height, cowboy); - } else if (strcmp(reinterpret_cast(mp.decoded.payload.bytes), u8"\U0001F42D") == 0) { + } else if (strcmp(reinterpret_cast(mp.decoded.payload.bytes), "\U0001F42D") == 0) { display->drawXbm(x + (SCREEN_WIDTH - deadmau5_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - deadmau5_height) / 2 + 2 + 5, deadmau5_width, deadmau5_height, deadmau5); - } else if (strcmp(reinterpret_cast(mp.decoded.payload.bytes), u8"\xE2\x98\x80\xEF\xB8\x8F") == 0) { + } else if (strcmp(reinterpret_cast(mp.decoded.payload.bytes), "\xE2\x98\x80\xEF\xB8\x8F") == 0) { display->drawXbm(x + (SCREEN_WIDTH - sun_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - sun_height) / 2 + 2 + 5, sun_width, sun_height, sun); - } else if (strcmp(reinterpret_cast(mp.decoded.payload.bytes), u8"\u2614") == 0) { + } else if (strcmp(reinterpret_cast(mp.decoded.payload.bytes), "\u2614") == 0) { display->drawXbm(x + (SCREEN_WIDTH - rain_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - rain_height) / 2 + 2 + 10, rain_width, rain_height, rain); - } else if (strcmp(reinterpret_cast(mp.decoded.payload.bytes), u8"☁️") == 0) { + } else if (strcmp(reinterpret_cast(mp.decoded.payload.bytes), "☁️") == 0) { display->drawXbm(x + (SCREEN_WIDTH - cloud_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - cloud_height) / 2 + 2 + 5, cloud_width, cloud_height, cloud); - } else if (strcmp(reinterpret_cast(mp.decoded.payload.bytes), u8"🌫️") == 0) { + } else if (strcmp(reinterpret_cast(mp.decoded.payload.bytes), "🌫️") == 0) { display->drawXbm(x + (SCREEN_WIDTH - fog_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - fog_height) / 2 + 2 + 5, fog_width, fog_height, fog); - } else if (strcmp(reinterpret_cast(mp.decoded.payload.bytes), u8"\xf0\x9f\x98\x88") == 0) { + } else if (strcmp(reinterpret_cast(mp.decoded.payload.bytes), "\xf0\x9f\x98\x88") == 0) { display->drawXbm(x + (SCREEN_WIDTH - devil_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - devil_height) / 2 + 2 + 5, devil_width, devil_height, devil); - } else if (strcmp(reinterpret_cast(mp.decoded.payload.bytes), u8"♥️") == 0) { + } else if (strcmp(reinterpret_cast(mp.decoded.payload.bytes), "♥️") == 0) { display->drawXbm(x + (SCREEN_WIDTH - heart_width) / 2, y + (SCREEN_HEIGHT - FONT_HEIGHT_MEDIUM - heart_height) / 2 + 2 + 5, heart_width, heart_height, heart); } else { @@ -2822,4 +2823,4 @@ int Screen::handleAdminMessage(const meshtastic_AdminMessage *arg) } // namespace graphics #else graphics::Screen::Screen(ScanI2C::DeviceAddress, meshtastic_Config_DisplayConfig_OledType, OLEDDISPLAY_GEOMETRY) {} -#endif // HAS_SCREEN +#endif // HAS_SCREEN \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 4e16f565f..dfad9efbf 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -323,15 +323,19 @@ void setup() #ifdef BUTTON_PIN #ifdef ARCH_ESP32 - // If the button is connected to GPIO 12, don't enable the ability to use - // meshtasticAdmin on the device. - pinMode(config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN, INPUT); - +#if ESP_ARDUINO_VERSION_MAJOR >= 3 +#ifdef BUTTON_NEED_PULLUP + pinMode(config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN, INPUT_PULLUP); +#else + pinMode(config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN, INPUT); // default to BUTTON_PIN +#endif +#else + pinMode(config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN, INPUT); // default to BUTTON_PIN #ifdef BUTTON_NEED_PULLUP gpio_pullup_en((gpio_num_t)(config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN)); delay(10); #endif - +#endif #endif #endif diff --git a/src/memGet.cpp b/src/memGet.cpp index e982ef7ee..ef1102f1e 100644 --- a/src/memGet.cpp +++ b/src/memGet.cpp @@ -57,6 +57,8 @@ uint32_t MemGet::getFreePsram() { #ifdef ARCH_ESP32 return ESP.getFreePsram(); +#elif defined(ARCH_PORTDUINO) + return 4194252; #else return 0; #endif @@ -71,6 +73,8 @@ uint32_t MemGet::getPsramSize() { #ifdef ARCH_ESP32 return ESP.getPsramSize(); +#elif defined(ARCH_PORTDUINO) + return 4194252; #else return 0; #endif diff --git a/src/mesh/LR11x0Interface.cpp b/src/mesh/LR11x0Interface.cpp index 00d84dc0d..f0f9119ea 100644 --- a/src/mesh/LR11x0Interface.cpp +++ b/src/mesh/LR11x0Interface.cpp @@ -3,6 +3,15 @@ #include "configuration.h" #include "error.h" #include "mesh/NodeDB.h" +#ifdef LR11X0_DIO_AS_RF_SWITCH +#include "rfswitch.h" +#else +static const uint32_t rfswitch_dio_pins[] = {RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC}; +static const Module::RfSwitchMode_t rfswitch_table[] = { + {LR11x0::MODE_STBY, {}}, {LR11x0::MODE_RX, {}}, {LR11x0::MODE_TX, {}}, {LR11x0::MODE_TX_HP, {}}, + {LR11x0::MODE_TX_HF, {}}, {LR11x0::MODE_GNSS, {}}, {LR11x0::MODE_WIFI, {}}, END_OF_MODE_TABLE, +}; +#endif #ifdef ARCH_PORTDUINO #include "PortduinoGlue.h" @@ -62,66 +71,6 @@ template bool LR11x0Interface::init() limitPower(); -#ifdef TRACKER_T1000_E // Tracker T1000E uses DIO5, DIO6, DIO7, DIO8 for RF switching - - static const uint32_t rfswitch_dio_pins[] = {RADIOLIB_LR11X0_DIO5, RADIOLIB_LR11X0_DIO6, RADIOLIB_LR11X0_DIO7, - RADIOLIB_LR11X0_DIO8, RADIOLIB_NC}; - - static const Module::RfSwitchMode_t rfswitch_table[] = { - // mode DIO5 DIO6 DIO7 DIO8 - {LR11x0::MODE_STBY, {LOW, LOW, LOW, LOW}}, {LR11x0::MODE_RX, {HIGH, LOW, LOW, HIGH}}, - {LR11x0::MODE_TX, {HIGH, HIGH, LOW, HIGH}}, {LR11x0::MODE_TX_HP, {LOW, HIGH, LOW, HIGH}}, - {LR11x0::MODE_TX_HF, {LOW, LOW, LOW, LOW}}, {LR11x0::MODE_GNSS, {LOW, LOW, HIGH, LOW}}, - {LR11x0::MODE_WIFI, {LOW, LOW, LOW, LOW}}, END_OF_MODE_TABLE, - }; - -#elif defined(TLORA_T3S3_V1) - static const uint32_t rfswitch_dio_pins[] = {RADIOLIB_LR11X0_DIO5, RADIOLIB_LR11X0_DIO6, RADIOLIB_NC, RADIOLIB_NC, - RADIOLIB_NC}; - - static const Module::RfSwitchMode_t rfswitch_table[] = { - // mode DIO5 DIO6 - {LR11x0::MODE_STBY, {LOW, LOW}}, {LR11x0::MODE_RX, {HIGH, LOW}}, - {LR11x0::MODE_TX, {LOW, HIGH}}, {LR11x0::MODE_TX_HP, {LOW, HIGH}}, - {LR11x0::MODE_TX_HF, {LOW, LOW}}, {LR11x0::MODE_GNSS, {LOW, LOW}}, - {LR11x0::MODE_WIFI, {LOW, LOW}}, END_OF_MODE_TABLE, - }; - -#else - - // set RF switch configuration for Wio WM1110 - // Wio WM1110 uses DIO5 and DIO6 for RF switching - - static const uint32_t rfswitch_dio_pins[] = {RADIOLIB_LR11X0_DIO5, RADIOLIB_LR11X0_DIO6, RADIOLIB_NC, RADIOLIB_NC, - RADIOLIB_NC}; - - static const Module::RfSwitchMode_t rfswitch_table[] = { - // mode DIO5 DIO6 - {LR11x0::MODE_STBY, {LOW, LOW}}, {LR11x0::MODE_RX, {HIGH, LOW}}, - {LR11x0::MODE_TX, {HIGH, HIGH}}, {LR11x0::MODE_TX_HP, {LOW, HIGH}}, - {LR11x0::MODE_TX_HF, {LOW, LOW}}, {LR11x0::MODE_GNSS, {LOW, LOW}}, - {LR11x0::MODE_WIFI, {LOW, LOW}}, END_OF_MODE_TABLE, - }; - -#endif - -// We need to do this before begin() call -#ifdef LR11X0_DIO_AS_RF_SWITCH - LOG_DEBUG("Setting DIO RF switch\n"); - bool dioAsRfSwitch = true; -#elif defined(ARCH_PORTDUINO) - bool dioAsRfSwitch = false; - if (settingsMap[dio2_as_rf_switch]) { - LOG_DEBUG("Setting DIO RF switch\n"); - dioAsRfSwitch = true; - } -#else - bool dioAsRfSwitch = false; -#endif - - if (dioAsRfSwitch) - lora.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table); - int res = lora.begin(getFreq(), bw, sf, cr, syncWord, power, preambleLength, tcxoVoltage); // \todo Display actual typename of the adapter, not just `LR11x0` LOG_INFO("LR11x0 init result %d\n", res); @@ -145,6 +94,23 @@ template bool LR11x0Interface::init() // FIXME: May want to set depending on a definition, currently all LR1110 variant files use the DC-DC regulator option if (res == RADIOLIB_ERR_NONE) res = lora.setRegulatorDCDC(); + +#ifdef LR11X0_DIO_AS_RF_SWITCH + bool dioAsRfSwitch = true; +#elif defined(ARCH_PORTDUINO) + bool dioAsRfSwitch = false; + if (settingsMap[dio2_as_rf_switch]) { + dioAsRfSwitch = true; + } +#else + bool dioAsRfSwitch = false; +#endif + + if (dioAsRfSwitch) { + lora.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table); + LOG_DEBUG("Setting DIO RF switch\n", res); + } + if (res == RADIOLIB_ERR_NONE) { if (config.lora.sx126x_rx_boosted_gain) { // the name is unfortunate but historically accurate res = lora.setRxBoostedGainMode(true); diff --git a/src/mesh/MeshService.h b/src/mesh/MeshService.h index e78c2be2c..b91fedada 100644 --- a/src/mesh/MeshService.h +++ b/src/mesh/MeshService.h @@ -13,9 +13,9 @@ #if defined(ARCH_PORTDUINO) && !HAS_RADIO #include "../platform/portduino/SimRadio.h" #endif -#ifdef ARCH_ESP32 +#if defined(ARCH_ESP32) || defined(ARCH_PORTDUINO) #if !MESHTASTIC_EXCLUDE_STOREFORWARD -#include "modules/esp32/StoreForwardModule.h" +#include "modules/StoreForwardModule.h" #endif #endif diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 869729890..7760ae0e1 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -32,12 +32,13 @@ #if HAS_WIFI #include "mesh/wifi/WiFiAPClient.h" #endif -#include "modules/esp32/StoreForwardModule.h" +#include "modules/StoreForwardModule.h" #include #include #endif #ifdef ARCH_PORTDUINO +#include "modules/StoreForwardModule.h" #include "platform/portduino/PortduinoGlue.h" #endif @@ -49,7 +50,7 @@ NodeDB *nodeDB = nullptr; // we have plenty of ram so statically alloc this tempbuf (for now) -EXT_RAM_ATTR meshtastic_DeviceState devicestate; +EXT_RAM_BSS_ATTR meshtastic_DeviceState devicestate; meshtastic_MyNodeInfo &myNodeInfo = devicestate.my_node; meshtastic_LocalConfig config; meshtastic_LocalModuleConfig moduleConfig; diff --git a/src/mesh/RadioLibInterface.cpp b/src/mesh/RadioLibInterface.cpp index 0968a6d89..aee43676d 100644 --- a/src/mesh/RadioLibInterface.cpp +++ b/src/mesh/RadioLibInterface.cpp @@ -167,7 +167,7 @@ ErrorCode RadioLibInterface::send(meshtastic_MeshPacket *p) } } else { - LOG_WARN("send - lora tx disable because RegionCode_Unset\n"); + LOG_WARN("send - lora tx disabled because RegionCode_Unset\n"); packetPool.release(p); return ERRNO_DISABLED; } @@ -379,6 +379,14 @@ void RadioLibInterface::handleReceiveInterrupt() xmitMsec = getPacketTime(length); +#ifndef DISABLE_WELCOME_UNSET + if (config.lora.region == meshtastic_Config_LoRaConfig_RegionCode_UNSET) { + LOG_WARN("recv - lora rx disabled because RegionCode_Unset\n"); + airTime->logAirtime(RX_ALL_LOG, xmitMsec); + return; + } +#endif + int state = iface->readData(radiobuf, length); if (state != RADIOLIB_ERR_NONE) { LOG_ERROR("ignoring received packet due to error=%d\n", state); diff --git a/src/mesh/TypedQueue.h b/src/mesh/TypedQueue.h index c96edae8e..f7d016f10 100644 --- a/src/mesh/TypedQueue.h +++ b/src/mesh/TypedQueue.h @@ -14,7 +14,7 @@ */ template class TypedQueue { - static_assert(std::is_pod::value, "T must be pod"); + static_assert(std::is_standard_layout::value, "T must be standard layout"); QueueHandle_t h; concurrency::OSThread *reader = NULL; diff --git a/src/mesh/api/ServerAPI.cpp b/src/mesh/api/ServerAPI.cpp index 3a483aac1..42217428d 100644 --- a/src/mesh/api/ServerAPI.cpp +++ b/src/mesh/api/ServerAPI.cpp @@ -45,7 +45,15 @@ template void APIServerPort::init() template int32_t APIServerPort::runOnce() { +#ifdef ARCH_ESP32 +#if ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(3, 0, 0) + auto client = U::accept(); +#else auto client = U::available(); +#endif +#else + auto client = U::available(); +#endif if (client) { // Close any previous connection (see FIXME in header file) if (openAPI) { diff --git a/src/mesh/generated/meshtastic/mesh.pb.h b/src/mesh/generated/meshtastic/mesh.pb.h index b323ddf07..c04f4adb9 100644 --- a/src/mesh/generated/meshtastic/mesh.pb.h +++ b/src/mesh/generated/meshtastic/mesh.pb.h @@ -209,6 +209,8 @@ typedef enum _meshtastic_HardwareModel { meshtastic_HardwareModel_SEEED_XIAO_S3 = 81, /* Nordic nRF52840+Semtech SX1262 LoRa BLE Combo Module. nRF52840+SX1262 MS24SF1 */ meshtastic_HardwareModel_MS24SF1 = 82, + /* Lilygo TLora-C6 with the new ESP32-C6 MCU */ + meshtastic_HardwareModel_TLORA_C6 = 83, /* ------------------------------------------------------------------------------------------------------------------------------------------ Reserved ID For developing private Ports. These will show up in live traffic sparsely, so we can use a high number. Keep it within 8 bits. ------------------------------------------------------------------------------------------------------------------------------------------ */ diff --git a/src/mesh/wifi/WiFiAPClient.cpp b/src/mesh/wifi/WiFiAPClient.cpp index d1169dc3b..c835878d3 100644 --- a/src/mesh/wifi/WiFiAPClient.cpp +++ b/src/mesh/wifi/WiFiAPClient.cpp @@ -310,7 +310,12 @@ static void WiFiEvent(WiFiEvent_t event) onNetworkConnected(); break; case ARDUINO_EVENT_WIFI_STA_GOT_IP6: +#if ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(3, 0, 0) + LOG_INFO("Obtained Local IP6 address: %s\n", WiFi.linkLocalIPv6().toString().c_str()); + LOG_INFO("Obtained GlobalIP6 address: %s\n", WiFi.globalIPv6().toString().c_str()); +#else LOG_INFO("Obtained IP6 address: %s\n", WiFi.localIPv6().toString().c_str()); +#endif break; case ARDUINO_EVENT_WIFI_STA_LOST_IP: LOG_INFO("Lost IP address and IP address is reset to 0\n"); diff --git a/src/modules/ExternalNotificationModule.h b/src/modules/ExternalNotificationModule.h index 08e72c35a..a5dff3651 100644 --- a/src/modules/ExternalNotificationModule.h +++ b/src/modules/ExternalNotificationModule.h @@ -3,7 +3,7 @@ #include "SinglePortModule.h" #include "concurrency/OSThread.h" #include "configuration.h" -#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) +#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL) && !defined(CONFIG_IDF_TARGET_ESP32C6) #include #else // Noop class for portduino. diff --git a/src/modules/Modules.cpp b/src/modules/Modules.cpp index eca0e8ac9..eedb3a37d 100644 --- a/src/modules/Modules.cpp +++ b/src/modules/Modules.cpp @@ -47,6 +47,9 @@ #endif #if ARCH_PORTDUINO #include "input/LinuxInputImpl.h" +#if !MESHTASTIC_EXCLUDE_STOREFORWARD +#include "modules/StoreForwardModule.h" +#endif #endif #if HAS_TELEMETRY #include "modules/Telemetry/DeviceTelemetry.h" @@ -67,7 +70,7 @@ #include "modules/esp32/PaxcounterModule.h" #endif #if !MESHTASTIC_EXCLUDE_STOREFORWARD -#include "modules/esp32/StoreForwardModule.h" +#include "modules/StoreForwardModule.h" #endif #endif #if defined(ARCH_ESP32) || defined(ARCH_NRF52) || defined(ARCH_RP2040) diff --git a/src/modules/PositionModule.cpp b/src/modules/PositionModule.cpp index 6ae990bab..f49a654af 100644 --- a/src/modules/PositionModule.cpp +++ b/src/modules/PositionModule.cpp @@ -274,7 +274,7 @@ meshtastic_MeshPacket *PositionModule::allocAtakPli() meshtastic_TAKPacket takPacket = {.is_compressed = true, .has_contact = true, - .contact = {0}, + .contact = meshtastic_Contact_init_default, .has_group = true, .group = {meshtastic_MemberRole_TeamMember, meshtastic_Team_Cyan}, .has_status = true, @@ -283,13 +283,13 @@ meshtastic_MeshPacket *PositionModule::allocAtakPli() .battery = powerStatus->getBatteryChargePercent(), }, .which_payload_variant = meshtastic_TAKPacket_pli_tag, - {.pli = { - .latitude_i = localPosition.latitude_i, - .longitude_i = localPosition.longitude_i, - .altitude = localPosition.altitude_hae, - .speed = localPosition.ground_speed, - .course = static_cast(localPosition.ground_track), - }}}; + .payload_variant = {.pli = { + .latitude_i = localPosition.latitude_i, + .longitude_i = localPosition.longitude_i, + .altitude = localPosition.altitude_hae, + .speed = localPosition.ground_speed, + .course = static_cast(localPosition.ground_track), + }}}; auto length = unishox2_compress_lines(owner.long_name, strlen(owner.long_name), takPacket.contact.device_callsign, sizeof(takPacket.contact.device_callsign) - 1, USX_PSET_DFLT, NULL); diff --git a/src/modules/SerialModule.cpp b/src/modules/SerialModule.cpp index a4dbb072f..6d6a947bc 100644 --- a/src/modules/SerialModule.cpp +++ b/src/modules/SerialModule.cpp @@ -63,6 +63,9 @@ SerialModuleRadio *serialModuleRadio; #if defined(TTGO_T_ECHO) || defined(CANARYONE) SerialModule::SerialModule() : StreamAPI(&Serial), concurrency::OSThread("SerialModule") {} static Print *serialPrint = &Serial; +#elif defined(CONFIG_IDF_TARGET_ESP32C6) +SerialModule::SerialModule() : StreamAPI(&Serial1), concurrency::OSThread("SerialModule") {} +static Print *serialPrint = &Serial1; #else SerialModule::SerialModule() : StreamAPI(&Serial2), concurrency::OSThread("SerialModule") {} static Print *serialPrint = &Serial2; @@ -137,7 +140,16 @@ int32_t SerialModule::runOnce() // Give it a chance to flush out 💩 delay(10); } -#ifdef ARCH_ESP32 +#if defined(CONFIG_IDF_TARGET_ESP32C6) + if (moduleConfig.serial.rxd && moduleConfig.serial.txd) { + Serial1.setRxBufferSize(RX_BUFFER); + Serial1.begin(baud, SERIAL_8N1, moduleConfig.serial.rxd, moduleConfig.serial.txd); + } else { + Serial.begin(baud); + Serial.setTimeout(moduleConfig.serial.timeout > 0 ? moduleConfig.serial.timeout : TIMEOUT); + } + +#elif defined(ARCH_ESP32) if (moduleConfig.serial.rxd && moduleConfig.serial.txd) { Serial2.setRxBufferSize(RX_BUFFER); @@ -205,8 +217,13 @@ int32_t SerialModule::runOnce() processWXSerial(); } else { +#if defined(CONFIG_IDF_TARGET_ESP32C6) + while (Serial1.available()) { + serialPayloadSize = Serial1.readBytes(serialBytes, meshtastic_Constants_DATA_PAYLOAD_LEN); +#else while (Serial2.available()) { serialPayloadSize = Serial2.readBytes(serialBytes, meshtastic_Constants_DATA_PAYLOAD_LEN); +#endif serialModuleRadio->sendPayload(); } } @@ -392,7 +409,7 @@ uint32_t SerialModule::getBaudRate() */ void SerialModule::processWXSerial() { -#if !defined(TTGO_T_ECHO) && !defined(CANARYONE) +#if !defined(TTGO_T_ECHO) && !defined(CANARYONE) && !defined(CONFIG_IDF_TARGET_ESP32C6) static unsigned int lastAveraged = 0; static unsigned int averageIntervalMillis = 300000; // 5 minutes hard coded. static double dir_sum_sin = 0; diff --git a/src/modules/esp32/StoreForwardModule.cpp b/src/modules/StoreForwardModule.cpp similarity index 98% rename from src/modules/esp32/StoreForwardModule.cpp rename to src/modules/StoreForwardModule.cpp index 51ec2a942..29fbd8d92 100644 --- a/src/modules/esp32/StoreForwardModule.cpp +++ b/src/modules/StoreForwardModule.cpp @@ -35,7 +35,7 @@ uint32_t heartbeatInterval = 60; // Default to 60 seconds, adjust as needed int32_t StoreForwardModule::runOnce() { -#ifdef ARCH_ESP32 +#if defined(ARCH_ESP32) || defined(ARCH_PORTDUINO) if (moduleConfig.store_forward.enabled && is_server) { // Send out the message queue. if (this->busy) { @@ -82,8 +82,12 @@ void StoreForwardModule::populatePSRAM() uint32_t numberOfPackets = (this->records ? this->records : (((memGet.getFreePsram() / 3) * 2) / sizeof(PacketHistoryStruct))); this->records = numberOfPackets; - +#if defined(ARCH_ESP32) this->packetHistory = static_cast(ps_calloc(numberOfPackets, sizeof(PacketHistoryStruct))); +#elif defined(ARCH_PORTDUINO) + this->packetHistory = static_cast(calloc(numberOfPackets, sizeof(PacketHistoryStruct))); + +#endif LOG_DEBUG("*** After PSRAM initialization: heap %d/%d PSRAM %d/%d\n", memGet.getFreeHeap(), memGet.getHeapSize(), memGet.getFreePsram(), memGet.getPsramSize()); @@ -376,7 +380,7 @@ void StoreForwardModule::statsSend(uint32_t to) */ ProcessMessage StoreForwardModule::handleReceived(const meshtastic_MeshPacket &mp) { -#ifdef ARCH_ESP32 +#if defined(ARCH_ESP32) || defined(ARCH_PORTDUINO) if (moduleConfig.store_forward.enabled) { if ((mp.decoded.portnum == meshtastic_PortNum_TEXT_MESSAGE_APP) && is_server) { @@ -559,7 +563,7 @@ StoreForwardModule::StoreForwardModule() ProtobufModule("StoreForward", meshtastic_PortNum_STORE_FORWARD_APP, &meshtastic_StoreAndForward_msg) { -#ifdef ARCH_ESP32 +#if defined(ARCH_ESP32) || defined(ARCH_PORTDUINO) isPromiscuous = true; // Brown chicken brown cow diff --git a/src/modules/esp32/StoreForwardModule.h b/src/modules/StoreForwardModule.h similarity index 100% rename from src/modules/esp32/StoreForwardModule.h rename to src/modules/StoreForwardModule.h diff --git a/src/mqtt/MQTT.cpp b/src/mqtt/MQTT.cpp index 891d4b549..8d08f97a6 100644 --- a/src/mqtt/MQTT.cpp +++ b/src/mqtt/MQTT.cpp @@ -329,6 +329,7 @@ void MQTT::reconnect() mqttPassword = moduleConfig.mqtt.password; } #if HAS_WIFI && !defined(ARCH_PORTDUINO) +#if !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(RPI_PICO) if (moduleConfig.mqtt.tls_enabled) { // change default for encrypted to 8883 try { @@ -344,6 +345,9 @@ void MQTT::reconnect() LOG_INFO("Using non-TLS-encrypted session\n"); pubSub.setClient(mqttClient); } +#else + pubSub.setClient(mqttClient); +#endif #elif HAS_NETWORKING pubSub.setClient(mqttClient); #endif diff --git a/src/mqtt/MQTT.h b/src/mqtt/MQTT.h index ba0987783..c827e12ca 100644 --- a/src/mqtt/MQTT.h +++ b/src/mqtt/MQTT.h @@ -9,9 +9,11 @@ #if HAS_WIFI #include #if !defined(ARCH_PORTDUINO) +#if defined(ESP_ARDUINO_VERSION_MAJOR) && ESP_ARDUINO_VERSION_MAJOR < 3 #include #endif #endif +#endif #if HAS_ETHERNET #include #endif @@ -33,9 +35,11 @@ class MQTT : private concurrency::OSThread #if HAS_WIFI WiFiClient mqttClient; #if !defined(ARCH_PORTDUINO) +#if defined(ESP_ARDUINO_VERSION_MAJOR) && ESP_ARDUINO_VERSION_MAJOR < 3 WiFiClientSecure wifiSecureClient; #endif #endif +#endif #if HAS_ETHERNET EthernetClient mqttClient; #endif diff --git a/src/platform/esp32/architecture.h b/src/platform/esp32/architecture.h index a2e7dfc4e..01f416629 100644 --- a/src/platform/esp32/architecture.h +++ b/src/platform/esp32/architecture.h @@ -90,6 +90,8 @@ #define HW_VENDOR meshtastic_HardwareModel_TLORA_V2_1_1P6 #elif defined(TLORA_V2_1_18) #define HW_VENDOR meshtastic_HardwareModel_TLORA_V2_1_1P8 +#elif defined(TLORA_C6) +#define HW_VENDOR meshtastic_HardwareModel_TLORA_C6 #elif defined(T_DECK) #define HW_VENDOR meshtastic_HardwareModel_T_DECK #elif defined(T_WATCH_S3) diff --git a/src/platform/esp32/main-esp32.cpp b/src/platform/esp32/main-esp32.cpp index 0b6f7cf23..f16accab6 100644 --- a/src/platform/esp32/main-esp32.cpp +++ b/src/platform/esp32/main-esp32.cpp @@ -13,6 +13,7 @@ #include "mesh/wifi/WiFiAPClient.h" #endif +#include "esp_mac.h" #include "meshUtils.h" #include "sleep.h" #include "soc/rtc.h" @@ -147,9 +148,16 @@ void esp32Setup() // #define APP_WATCHDOG_SECS 45 #define APP_WATCHDOG_SECS 90 +#ifdef CONFIG_IDF_TARGET_ESP32C6 + esp_task_wdt_config_t *wdt_config = (esp_task_wdt_config_t *)malloc(sizeof(esp_task_wdt_config_t)); + wdt_config->timeout_ms = APP_WATCHDOG_SECS * 1000; + wdt_config->trigger_panic = true; + res = esp_task_wdt_init(wdt_config); + assert(res == ESP_OK); +#else res = esp_task_wdt_init(APP_WATCHDOG_SECS, true); assert(res == ESP_OK); - +#endif res = esp_task_wdt_add(NULL); assert(res == ESP_OK); @@ -223,7 +231,7 @@ void cpuDeepSleep(uint32_t msecToWake) // to detect wake and in normal operation the external part drives them hard. #ifdef BUTTON_PIN // Only GPIOs which are have RTC functionality can be used in this bit map: 0,2,4,12-15,25-27,32-39. -#if SOC_RTCIO_HOLD_SUPPORTED +#if SOC_RTCIO_HOLD_SUPPORTED && SOC_PM_SUPPORT_EXT_WAKEUP uint64_t gpioMask = (1ULL << (config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN)); #endif diff --git a/src/power.h b/src/power.h index 19a4f1228..63335104b 100644 --- a/src/power.h +++ b/src/power.h @@ -5,6 +5,7 @@ #include "configuration.h" #ifdef ARCH_ESP32 +// "legacy adc calibration driver is deprecated, please migrate to use esp_adc/adc_cali.h and esp_adc/adc_cali_scheme.h #include #include #endif diff --git a/src/serialization/JSON.cpp b/src/serialization/JSON.cpp index e98bf47b9..42e615108 100644 --- a/src/serialization/JSON.cpp +++ b/src/serialization/JSON.cpp @@ -184,7 +184,7 @@ bool JSON::ExtractString(const char **data, std::string &str) // End of the string? else if (next_char == '"') { (*data)++; - str.reserve(); // Remove unused capacity + str.shrink_to_fit(); // Remove unused capacity return true; } diff --git a/src/sleep.cpp b/src/sleep.cpp index f32d24caa..60f83f537 100644 --- a/src/sleep.cpp +++ b/src/sleep.cpp @@ -18,6 +18,7 @@ #include "target_specific.h" #ifdef ARCH_ESP32 +// "esp_pm_config_esp32_t is deprecated, please include esp_pm.h and use esp_pm_config_t instead" #include "esp32/pm.h" #include "esp_pm.h" #if HAS_WIFI @@ -450,12 +451,17 @@ esp_sleep_wakeup_cause_t doLightSleep(uint64_t sleepMsec) // FIXME, use a more r */ void enableModemSleep() { +#if ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(3, 0, 0) + static esp_pm_config_t esp32_config; // filled with zeros because bss +#else static esp_pm_config_esp32_t esp32_config; // filled with zeros because bss - +#endif #if CONFIG_IDF_TARGET_ESP32S3 esp32_config.max_freq_mhz = CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ; #elif CONFIG_IDF_TARGET_ESP32S2 esp32_config.max_freq_mhz = CONFIG_ESP32S2_DEFAULT_CPU_FREQ_MHZ; +#elif CONFIG_IDF_TARGET_ESP32C6 + esp32_config.max_freq_mhz = CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ; #elif CONFIG_IDF_TARGET_ESP32C3 esp32_config.max_freq_mhz = CONFIG_ESP32C3_DEFAULT_CPU_FREQ_MHZ; #else diff --git a/variants/ME25LS01-4Y10TD/platformio.ini b/variants/ME25LS01-4Y10TD/platformio.ini index 985919d2d..479a4e79c 100644 --- a/variants/ME25LS01-4Y10TD/platformio.ini +++ b/variants/ME25LS01-4Y10TD/platformio.ini @@ -3,7 +3,7 @@ extends = nrf52840_base board = me25ls01-4y10td board_level = extra ; platform = https://github.com/maxgerhardt/platform-nordicnrf52#cac6fcf943a41accd2aeb4f3659ae297a73f422e -build_flags = ${nrf52840_base.build_flags} -Ivariants/ME25LS01-4Y10TD -Isrc/platform/nrf52/softdevice -Isrc/platform/nrf52/softdevice/nrf52 -DME25LS01_4Y10TD ;-DRADIOLIB_GODMODE +build_flags = ${nrf52840_base.build_flags} -Ivariants/ME25LS01-4Y10TD -Isrc/platform/nrf52/softdevice -Isrc/platform/nrf52/softdevice/nrf52 -DME25LS01_4Y10TD -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" -DGPS_POWER_TOGGLE ; comment this line to disable triple press function on the user button to turn off gps entirely. board_build.ldscript = src/platform/nrf52/nrf52840_s140_v7.ld @@ -12,4 +12,4 @@ lib_deps = ${nrf52840_base.lib_deps} ; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm) upload_protocol = nrfutil -upload_port = /dev/ttyACM1 +upload_port = /dev/ttyACM1 \ No newline at end of file diff --git a/variants/ME25LS01-4Y10TD/rfswitch.h b/variants/ME25LS01-4Y10TD/rfswitch.h new file mode 100644 index 000000000..cda6364f5 --- /dev/null +++ b/variants/ME25LS01-4Y10TD/rfswitch.h @@ -0,0 +1,15 @@ +#include "RadioLib.h" +#include "nrf.h" + +// set RF switch configuration for Wio WM1110 +// Wio WM1110 uses DIO5 and DIO6 for RF switching + +static const uint32_t rfswitch_dio_pins[] = {RADIOLIB_LR11X0_DIO5, RADIOLIB_LR11X0_DIO6, RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC}; + +static const Module::RfSwitchMode_t rfswitch_table[] = { + // mode DIO5 DIO6 + {LR11x0::MODE_STBY, {LOW, LOW}}, {LR11x0::MODE_RX, {HIGH, LOW}}, + {LR11x0::MODE_TX, {HIGH, HIGH}}, {LR11x0::MODE_TX_HP, {LOW, HIGH}}, + {LR11x0::MODE_TX_HF, {LOW, LOW}}, {LR11x0::MODE_GNSS, {LOW, LOW}}, + {LR11x0::MODE_WIFI, {LOW, LOW}}, END_OF_MODE_TABLE, +}; diff --git a/variants/ME25LS01-4Y10TD/variant.h b/variants/ME25LS01-4Y10TD/variant.h index 0da391f0b..e772069da 100644 --- a/variants/ME25LS01-4Y10TD/variant.h +++ b/variants/ME25LS01-4Y10TD/variant.h @@ -103,7 +103,6 @@ extern "C" { #define LR11X0_DIO3_TCXO_VOLTAGE 1.6 #define LR11X0_DIO_AS_RF_SWITCH -#define LR11X0_DIO_RF_SWITCH_CONFIG 0x0f, 0x0, 0x09, 0x0B, 0x0A, 0x0, 0x4, 0x0 #define HAS_GPS 0 diff --git a/variants/ME25LS01-4Y10TD_e-ink/platformio.ini b/variants/ME25LS01-4Y10TD_e-ink/platformio.ini index 4e837abd8..f2e3a49e3 100644 --- a/variants/ME25LS01-4Y10TD_e-ink/platformio.ini +++ b/variants/ME25LS01-4Y10TD_e-ink/platformio.ini @@ -3,7 +3,7 @@ extends = nrf52840_base board = me25ls01-4y10td board_level = extra ; platform = https://github.com/maxgerhardt/platform-nordicnrf52#cac6fcf943a41accd2aeb4f3659ae297a73f422e -build_flags = ${nrf52840_base.build_flags} -Ivariants/ME25LS01-4Y10TD_e-ink -Isrc/platform/nrf52/softdevice -Isrc/platform/nrf52/softdevice/nrf52 -DME25LS01_4Y10TD ;-DRADIOLIB_GODMODE +build_flags = ${nrf52840_base.build_flags} -Ivariants/ME25LS01-4Y10TD_e-ink -Isrc/platform/nrf52/softdevice -Isrc/platform/nrf52/softdevice/nrf52 -DME25LS01_4Y10TD -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard" -DGPS_POWER_TOGGLE ; comment this line to disable triple press function on the user button to turn off gps entirely. -DEINK_DISPLAY_MODEL=GxEPD2_420_GDEY042T81 @@ -16,4 +16,4 @@ lib_deps = zinggjm/GxEPD2@^1.5.8 ; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm) upload_protocol = nrfutil -upload_port = /dev/ttyACM1 +upload_port = /dev/ttyACM1 \ No newline at end of file diff --git a/variants/ME25LS01-4Y10TD_e-ink/rfswitch.h b/variants/ME25LS01-4Y10TD_e-ink/rfswitch.h new file mode 100644 index 000000000..cda6364f5 --- /dev/null +++ b/variants/ME25LS01-4Y10TD_e-ink/rfswitch.h @@ -0,0 +1,15 @@ +#include "RadioLib.h" +#include "nrf.h" + +// set RF switch configuration for Wio WM1110 +// Wio WM1110 uses DIO5 and DIO6 for RF switching + +static const uint32_t rfswitch_dio_pins[] = {RADIOLIB_LR11X0_DIO5, RADIOLIB_LR11X0_DIO6, RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC}; + +static const Module::RfSwitchMode_t rfswitch_table[] = { + // mode DIO5 DIO6 + {LR11x0::MODE_STBY, {LOW, LOW}}, {LR11x0::MODE_RX, {HIGH, LOW}}, + {LR11x0::MODE_TX, {HIGH, HIGH}}, {LR11x0::MODE_TX_HP, {LOW, HIGH}}, + {LR11x0::MODE_TX_HF, {LOW, LOW}}, {LR11x0::MODE_GNSS, {LOW, LOW}}, + {LR11x0::MODE_WIFI, {LOW, LOW}}, END_OF_MODE_TABLE, +}; diff --git a/variants/ME25LS01-4Y10TD_e-ink/variant.h b/variants/ME25LS01-4Y10TD_e-ink/variant.h index 105f9b873..797394ce6 100644 --- a/variants/ME25LS01-4Y10TD_e-ink/variant.h +++ b/variants/ME25LS01-4Y10TD_e-ink/variant.h @@ -126,7 +126,6 @@ static const uint8_t SCK = PIN_SPI_SCK; #define LR11X0_DIO3_TCXO_VOLTAGE 1.6 #define LR11X0_DIO_AS_RF_SWITCH -#define LR11X0_DIO_RF_SWITCH_CONFIG 0x0f, 0x0, 0x09, 0x0B, 0x0A, 0x0, 0x4, 0x0 #define HAS_GPS 0 @@ -159,4 +158,4 @@ static const uint8_t SCK = PIN_SPI_SCK; * Arduino objects - C++ only *----------------------------------------------------------------------------*/ -#endif // _VARIANT_ME25LS01_4Y10TD__ +#endif // _VARIANT_ME25LS01_4Y10TD__ \ No newline at end of file diff --git a/variants/MakePython_nRF52840_eink/variant.h b/variants/MakePython_nRF52840_eink/variant.h index 16f803dd2..00c8dc199 100644 --- a/variants/MakePython_nRF52840_eink/variant.h +++ b/variants/MakePython_nRF52840_eink/variant.h @@ -25,8 +25,6 @@ extern "C" { #define NUM_ANALOG_INPUTS (6) #define NUM_ANALOG_OUTPUTS (0) -#define RADIOLIB_GODMODE - // LEDs #define PIN_LED1 (32 + 10) // LED P1.15 #define PIN_LED2 (-1) // diff --git a/variants/MakePython_nRF52840_oled/variant.h b/variants/MakePython_nRF52840_oled/variant.h index a2a5fa80a..28d941171 100644 --- a/variants/MakePython_nRF52840_oled/variant.h +++ b/variants/MakePython_nRF52840_oled/variant.h @@ -25,8 +25,6 @@ extern "C" { #define NUM_ANALOG_INPUTS (6) #define NUM_ANALOG_OUTPUTS (0) -#define RADIOLIB_GODMODE - // LEDs #define PIN_LED1 (32 + 10) // LED P1.15 #define PIN_LED2 (-1) // diff --git a/variants/portduino/variant.h b/variants/portduino/variant.h index 70d7cbd52..b7b39d6e8 100644 --- a/variants/portduino/variant.h +++ b/variants/portduino/variant.h @@ -2,5 +2,4 @@ #define CANNED_MESSAGE_MODULE_ENABLE 1 #define HAS_GPS 1 #define MAX_RX_TOPHONE settingsMap[maxtophone] -#define MAX_NUM_NODES settingsMap[maxnodes] -#define RADIOLIB_GODMODE 1 +#define MAX_NUM_NODES settingsMap[maxnodes] \ No newline at end of file diff --git a/variants/tlora_c6/platformio.ini b/variants/tlora_c6/platformio.ini new file mode 100644 index 000000000..d042cd78b --- /dev/null +++ b/variants/tlora_c6/platformio.ini @@ -0,0 +1,10 @@ +[env:tlora-c6] +extends = esp32c6_base +board = esp32-c6-devkitm-1 +build_flags = + ${esp32c6_base.build_flags} + -D TLORA_C6 + -I variants/tlora_c6 + -DARDUINO_USB_CDC_ON_BOOT=1 + -DARDUINO_USB_MODE=1 + -L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/esp32c3" \ No newline at end of file diff --git a/variants/tlora_c6/variant.h b/variants/tlora_c6/variant.h new file mode 100644 index 000000000..55635fe13 --- /dev/null +++ b/variants/tlora_c6/variant.h @@ -0,0 +1,21 @@ +#define I2C_SDA 8 // I2C pins for this board +#define I2C_SCL 9 + +#define LED_PIN 7 // If defined we will blink this LED +#define LED_STATE_ON 0 // State when LED is lit + +#define USE_SX1262 +#define LORA_SCK 6 +#define LORA_MISO 1 +#define LORA_MOSI 0 +#define LORA_CS 18 +#define LORA_RESET 21 +#define SX126X_CS LORA_CS +#define SX126X_DIO1 23 +#define SX126X_DIO2 20 +#define SX126X_BUSY 22 +#define SX126X_RESET LORA_RESET +#define SX126X_RXEN 15 +#define SX126X_TXEN 14 +#define SX126X_DIO2_AS_RF_SWITCH +#define SX126X_DIO3_TCXO_VOLTAGE 1.8 diff --git a/variants/tracker-t1000-e/rfswitch.h b/variants/tracker-t1000-e/rfswitch.h new file mode 100644 index 000000000..e229d77cf --- /dev/null +++ b/variants/tracker-t1000-e/rfswitch.h @@ -0,0 +1,13 @@ +#include "RadioLib.h" +#include "nrf.h" + +static const uint32_t rfswitch_dio_pins[Module::RFSWITCH_MAX_PINS] = {RADIOLIB_LR11X0_DIO5, RADIOLIB_LR11X0_DIO6, + RADIOLIB_LR11X0_DIO7, RADIOLIB_LR11X0_DIO8, RADIOLIB_NC}; + +static const Module::RfSwitchMode_t rfswitch_table[] = { + // mode DIO5 DIO6 DIO7 DIO8 + {LR11x0::MODE_STBY, {LOW, LOW, LOW, LOW}}, {LR11x0::MODE_RX, {HIGH, LOW, LOW, HIGH}}, + {LR11x0::MODE_TX, {HIGH, HIGH, LOW, HIGH}}, {LR11x0::MODE_TX_HP, {LOW, HIGH, LOW, HIGH}}, + {LR11x0::MODE_TX_HF, {LOW, LOW, LOW, LOW}}, {LR11x0::MODE_GNSS, {LOW, LOW, HIGH, LOW}}, + {LR11x0::MODE_WIFI, {LOW, LOW, LOW, LOW}}, END_OF_MODE_TABLE, +}; \ No newline at end of file diff --git a/variants/wio-sdk-wm1110/rfswitch.h b/variants/wio-sdk-wm1110/rfswitch.h new file mode 100644 index 000000000..cda6364f5 --- /dev/null +++ b/variants/wio-sdk-wm1110/rfswitch.h @@ -0,0 +1,15 @@ +#include "RadioLib.h" +#include "nrf.h" + +// set RF switch configuration for Wio WM1110 +// Wio WM1110 uses DIO5 and DIO6 for RF switching + +static const uint32_t rfswitch_dio_pins[] = {RADIOLIB_LR11X0_DIO5, RADIOLIB_LR11X0_DIO6, RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC}; + +static const Module::RfSwitchMode_t rfswitch_table[] = { + // mode DIO5 DIO6 + {LR11x0::MODE_STBY, {LOW, LOW}}, {LR11x0::MODE_RX, {HIGH, LOW}}, + {LR11x0::MODE_TX, {HIGH, HIGH}}, {LR11x0::MODE_TX_HP, {LOW, HIGH}}, + {LR11x0::MODE_TX_HF, {LOW, LOW}}, {LR11x0::MODE_GNSS, {LOW, LOW}}, + {LR11x0::MODE_WIFI, {LOW, LOW}}, END_OF_MODE_TABLE, +}; diff --git a/variants/wio-t1000-s/rfswitch.h b/variants/wio-t1000-s/rfswitch.h new file mode 100644 index 000000000..e229d77cf --- /dev/null +++ b/variants/wio-t1000-s/rfswitch.h @@ -0,0 +1,13 @@ +#include "RadioLib.h" +#include "nrf.h" + +static const uint32_t rfswitch_dio_pins[Module::RFSWITCH_MAX_PINS] = {RADIOLIB_LR11X0_DIO5, RADIOLIB_LR11X0_DIO6, + RADIOLIB_LR11X0_DIO7, RADIOLIB_LR11X0_DIO8, RADIOLIB_NC}; + +static const Module::RfSwitchMode_t rfswitch_table[] = { + // mode DIO5 DIO6 DIO7 DIO8 + {LR11x0::MODE_STBY, {LOW, LOW, LOW, LOW}}, {LR11x0::MODE_RX, {HIGH, LOW, LOW, HIGH}}, + {LR11x0::MODE_TX, {HIGH, HIGH, LOW, HIGH}}, {LR11x0::MODE_TX_HP, {LOW, HIGH, LOW, HIGH}}, + {LR11x0::MODE_TX_HF, {LOW, LOW, LOW, LOW}}, {LR11x0::MODE_GNSS, {LOW, LOW, HIGH, LOW}}, + {LR11x0::MODE_WIFI, {LOW, LOW, LOW, LOW}}, END_OF_MODE_TABLE, +}; \ No newline at end of file diff --git a/variants/wio-t1000-s/variant.h b/variants/wio-t1000-s/variant.h index 8894a40c5..eb6a34d6c 100644 --- a/variants/wio-t1000-s/variant.h +++ b/variants/wio-t1000-s/variant.h @@ -103,7 +103,6 @@ extern "C" { #define LR11X0_DIO3_TCXO_VOLTAGE 1.6 #define LR11X0_DIO_AS_RF_SWITCH -#define LR11X0_DIO_RF_SWITCH_CONFIG 0x0f, 0x0, 0x09, 0x0B, 0x0A, 0x0, 0x4, 0x0 #define HAS_GPS 1 #define GNSS_AIROHA @@ -158,4 +157,4 @@ extern "C" { * Arduino objects - C++ only *----------------------------------------------------------------------------*/ -#endif // _VARIANT_WIO_SDK_WM1110_ +#endif // _VARIANT_WIO_SDK_WM1110_ \ No newline at end of file diff --git a/variants/wio-tracker-wm1110/rfswitch.h b/variants/wio-tracker-wm1110/rfswitch.h new file mode 100644 index 000000000..cda6364f5 --- /dev/null +++ b/variants/wio-tracker-wm1110/rfswitch.h @@ -0,0 +1,15 @@ +#include "RadioLib.h" +#include "nrf.h" + +// set RF switch configuration for Wio WM1110 +// Wio WM1110 uses DIO5 and DIO6 for RF switching + +static const uint32_t rfswitch_dio_pins[] = {RADIOLIB_LR11X0_DIO5, RADIOLIB_LR11X0_DIO6, RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC}; + +static const Module::RfSwitchMode_t rfswitch_table[] = { + // mode DIO5 DIO6 + {LR11x0::MODE_STBY, {LOW, LOW}}, {LR11x0::MODE_RX, {HIGH, LOW}}, + {LR11x0::MODE_TX, {HIGH, HIGH}}, {LR11x0::MODE_TX_HP, {LOW, HIGH}}, + {LR11x0::MODE_TX_HF, {LOW, LOW}}, {LR11x0::MODE_GNSS, {LOW, LOW}}, + {LR11x0::MODE_WIFI, {LOW, LOW}}, END_OF_MODE_TABLE, +};