diff --git a/arch/esp32/esp32.ini b/arch/esp32/esp32.ini index ba98a6b1f..730b78942 100644 --- a/arch/esp32/esp32.ini +++ b/arch/esp32/esp32.ini @@ -31,7 +31,7 @@ lib_deps = ${arduino_base.lib_deps} ${networking_base.lib_deps} ${environmental_base.lib_deps} - https://github.com/meshtastic/esp32_https_server.git#657509856ce97e9dddeffb89a559f544faefd5cd + https://github.com/meshtastic/esp32_https_server.git#23665b3adc080a311dcbb586ed5941b5f94d6ea2 h2zero/NimBLE-Arduino@^1.4.0 https://github.com/lewisxhe/XPowersLib.git#84b7373faea3118b6c37954d52f98b8a337148d6 diff --git a/arch/esp32/esp32s3.ini b/arch/esp32/esp32s3.ini index f5338d9a9..0c2d7d8f1 100644 --- a/arch/esp32/esp32s3.ini +++ b/arch/esp32/esp32s3.ini @@ -31,7 +31,7 @@ lib_deps = ${arduino_base.lib_deps} ${networking_base.lib_deps} ${environmental_base.lib_deps} - https://github.com/meshtastic/esp32_https_server.git#657509856ce97e9dddeffb89a559f544faefd5cd + https://github.com/meshtastic/esp32_https_server.git#23665b3adc080a311dcbb586ed5941b5f94d6ea2 h2zero/NimBLE-Arduino@^1.4.0 https://github.com/lewisxhe/XPowersLib.git#84b7373faea3118b6c37954d52f98b8a337148d6 diff --git a/arch/portduino/portduino.ini b/arch/portduino/portduino.ini index b61071007..fb1e45af7 100644 --- a/arch/portduino/portduino.ini +++ b/arch/portduino/portduino.ini @@ -1,5 +1,7 @@ ; The Portduino based sim environment on top of any host OS, all hardware will be simulated [portduino_base] +platform = https://github.com/meshtastic/platform-native.git#develop +framework = arduino build_src_filter = ${env.build_src_filter} - @@ -16,5 +18,6 @@ lib_deps = ${env.lib_deps} ${networking_base.lib_deps} rweather/Crypto@^0.4.0 - https://github.com/meshtastic/RadioLib.git#5582ac30578ff3f53f20630a00b2a8a4b8f92c74 + ; jgromes/RadioLib@5.4.1 + https://github.com/jgromes/RadioLib.git#63208f1e89d4dac6eedaafbe234bf90f1fd5402b ; 5.4.1 with some fixes, remove when 5.4.2 is released build_flags = ${arduino_base.build_flags} -Isrc/platform/portduino diff --git a/platformio.ini b/platformio.ini index 618c7cddb..94e3e9f5b 100644 --- a/platformio.ini +++ b/platformio.ini @@ -37,12 +37,24 @@ extra_scripts = bin/platformio-custom.py ; note: TINYGPS_OPTION_NO_CUSTOM_FIELDS is VERY important. We don't use custom fields and somewhere in that pile ; of code is a heap corruption bug! ; FIXME: fix lib/BluetoothOTA dependency back on src/ so we can remove -Isrc +; The Radiolib stuff will speed up building considerably. Exclud all the stuff we dont need. build_flags = -Wno-missing-field-initializers -Wno-format -Isrc -Isrc/mesh -Isrc/gps -Isrc/buzz -Wl,-Map,.pio/build/output.map -DUSE_THREAD_NAMES - -DTINYGPS_OPTION_NO_CUSTOM_FIELDS +; -DTINYGPS_OPTION_NO_CUSTOM_FIELDS // this should work now... -DPB_ENABLE_MALLOC=1 + -DRADIOLIB_EXCLUDE_CC1101 + -DRADIOLIB_EXCLUDE_NRF24 + -DRADIOLIB_EXCLUDE_RF69 + -DRADIOLIB_EXCLUDE_SX1231 + -DRADIOLIB_EXCLUDE_SI443X + -DRADIOLIB_EXCLUDE_RFM2X + -DRADIOLIB_EXCLUDE_AFSK + -DRADIOLIB_EXCLUDE_HELLSCHREIBER + -DRADIOLIB_EXCLUDE_MORSE + -DRADIOLIB_EXCLUDE_RTTY + -DRADIOLIB_EXCLUDE_SSTV monitor_speed = 115200 diff --git a/src/GPSStatus.h b/src/GPSStatus.h index cde351818..35a0b11f2 100644 --- a/src/GPSStatus.h +++ b/src/GPSStatus.h @@ -25,22 +25,6 @@ class GPSStatus : public Status public: GPSStatus() { statusType = STATUS_TYPE_GPS; } - // // proposed for deprecation - // GPSStatus(bool hasLock, bool isConnected, int32_t latitude, int32_t longitude, int32_t altitude, uint32_t dop, - // uint32_t heading, uint32_t numSatellites) - // : Status() - // { - // this->hasLock = hasLock; - // this->isConnected = isConnected; - - // this->p.latitude_i = latitude; - // this->p.longitude_i = longitude; - // this->p.altitude = altitude; - // this->p.PDOP = dop; - // this->p.ground_track = heading; - // this->p.sats_in_view = numSatellites; - // } - // preferred method GPSStatus(bool hasLock, bool isConnected, const Position &pos) : Status() { diff --git a/src/gps/NMEAGPS.cpp b/src/gps/NMEAGPS.cpp index 1b103f534..0ff302bab 100644 --- a/src/gps/NMEAGPS.cpp +++ b/src/gps/NMEAGPS.cpp @@ -109,7 +109,7 @@ bool NMEAGPS::lookForLocation() #ifndef TINYGPS_OPTION_NO_CUSTOM_FIELDS fixType = atoi(gsafixtype.value()); // will set to zero if no data - DEBUG_MSG("FIX QUAL=%d, TYPE=%d\n", fixQual, fixType); + // DEBUG_MSG("FIX QUAL=%d, TYPE=%d\n", fixQual, fixType); #endif // check if GPS has an acceptable lock @@ -168,7 +168,7 @@ bool NMEAGPS::lookForLocation() #ifndef TINYGPS_OPTION_NO_CUSTOM_FIELDS p.HDOP = reader.hdop.value(); p.PDOP = TinyGPSPlus::parseDecimal(gsapdop.value()); - DEBUG_MSG("PDOP=%d, HDOP=%d\n", dop, reader.hdop.value()); + // DEBUG_MSG("PDOP=%d, HDOP=%d\n", p.PDOP, p.HDOP); #else // FIXME! naive PDOP emulation (assumes VDOP==HDOP) // correct formula is PDOP = SQRT(HDOP^2 + VDOP^2) diff --git a/src/mesh/InterfacesTemplates.cpp b/src/mesh/InterfacesTemplates.cpp index ccef2df23..9602525b5 100644 --- a/src/mesh/InterfacesTemplates.cpp +++ b/src/mesh/InterfacesTemplates.cpp @@ -8,6 +8,6 @@ template class SX126xInterface; template class SX126xInterface; template class SX126xInterface; -#if !defined(ARCH_PORTDUINO) +#if defined(RADIOLIB_GODMODE) template class SX128xInterface; #endif \ No newline at end of file diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 8a7ee6086..c548b0acc 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -204,6 +204,7 @@ void NodeDB::installDefaultModuleConfig() { DEBUG_MSG("Installing default ModuleConfig\n"); memset(&moduleConfig, 0, sizeof(ModuleConfig)); + moduleConfig.version = DEVICESTATE_CUR_VER; moduleConfig.has_mqtt = true; moduleConfig.has_range_test = true; @@ -213,6 +214,10 @@ void NodeDB::installDefaultModuleConfig() moduleConfig.has_external_notification = true; moduleConfig.has_canned_message = true; + strncpy(moduleConfig.mqtt.address, default_mqtt_address, sizeof(default_mqtt_address)); + strncpy(moduleConfig.mqtt.username, default_mqtt_username, sizeof(default_mqtt_username)); + strncpy(moduleConfig.mqtt.password, default_mqtt_password, sizeof(default_mqtt_password)); + initModuleConfigIntervals(); } @@ -741,9 +746,9 @@ void recordCriticalError(CriticalErrorCode code, uint32_t address, const char *f String lcd = String("Critical error ") + code + "!\n"; screen->print(lcd.c_str()); if (filename) - DEBUG_MSG("NOTE! Recording critical error %d at %s:%lx\n", code, filename, address); + DEBUG_MSG("NOTE! Recording critical error %d at %s:%lu\n", code, filename, address); else - DEBUG_MSG("NOTE! Recording critical error %d, address=%lx\n", code, address); + DEBUG_MSG("NOTE! Recording critical error %d, address=0x%lx\n", code, address); // Record error to DB myNodeInfo.error_code = code; diff --git a/src/mesh/NodeDB.h b/src/mesh/NodeDB.h index 6e79ea9e4..1622a57ff 100644 --- a/src/mesh/NodeDB.h +++ b/src/mesh/NodeDB.h @@ -194,6 +194,10 @@ extern NodeDB nodeDB; #define default_min_wake_secs 10 #define default_screen_on_secs 60 * 10 +#define default_mqtt_address "mqtt.meshtastic.org" +#define default_mqtt_username "meshdev" +#define default_mqtt_password "large4cats" + inline uint32_t getConfiguredOrDefaultMs(uint32_t configuredInterval) { if (configuredInterval > 0) return configuredInterval * 1000; diff --git a/src/mesh/RF95Interface.cpp b/src/mesh/RF95Interface.cpp index d56681412..5b88d45ed 100644 --- a/src/mesh/RF95Interface.cpp +++ b/src/mesh/RF95Interface.cpp @@ -129,6 +129,7 @@ bool RF95Interface::reconfigure() if (power > MAX_POWER) // This chip has lower power limits than some power = MAX_POWER; + err = lora->setOutputPower(power); if (err != RADIOLIB_ERR_NONE) RECORD_CRITICALERROR(CriticalErrorCode_INVALID_RADIO_SETTING); diff --git a/src/mesh/RadioLibInterface.cpp b/src/mesh/RadioLibInterface.cpp index c08220555..567215600 100644 --- a/src/mesh/RadioLibInterface.cpp +++ b/src/mesh/RadioLibInterface.cpp @@ -11,17 +11,6 @@ // FIXME, we default to 4MHz SPI, SPI mode 0, check if the datasheet says it can really do that static SPISettings spiSettings(4000000, MSBFIRST, SPI_MODE0); -#ifdef ARCH_PORTDUINO - -void LockingModule::SPItransfer(uint8_t cmd, uint8_t reg, uint8_t *dataOut, uint8_t *dataIn, uint8_t numBytes) -{ - concurrency::LockGuard g(spiLock); - - Module::SPItransfer(cmd, reg, dataOut, dataIn, numBytes); -} - -#else - void LockingModule::SPIbeginTransaction() { spiLock->lock(); @@ -36,8 +25,6 @@ void LockingModule::SPIendTransaction() Module::SPIendTransaction(); } -#endif - RadioLibInterface::RadioLibInterface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, SPIClass &spi, PhysicalLayer *_iface) : NotifiedWorkerThread("RadioIf"), module(cs, irq, rst, busy, spi, spiSettings), iface(_iface) diff --git a/src/mesh/RadioLibInterface.h b/src/mesh/RadioLibInterface.h index fbad830cd..f368cf83e 100644 --- a/src/mesh/RadioLibInterface.h +++ b/src/mesh/RadioLibInterface.h @@ -41,12 +41,8 @@ class LockingModule : public Module { } -#ifdef ARCH_PORTDUINO - void SPItransfer(uint8_t cmd, uint8_t reg, uint8_t *dataOut, uint8_t *dataIn, uint8_t numBytes) override; -#else void SPIbeginTransaction() override; void SPIendTransaction() override; -#endif }; class RadioLibInterface : public RadioInterface, protected concurrency::NotifiedWorkerThread diff --git a/src/mesh/SX126xInterface.cpp b/src/mesh/SX126xInterface.cpp index cfb97e673..20c8056e2 100644 --- a/src/mesh/SX126xInterface.cpp +++ b/src/mesh/SX126xInterface.cpp @@ -144,8 +144,9 @@ bool SX126xInterface::reconfigure() if (err != RADIOLIB_ERR_NONE) RECORD_CRITICALERROR(CriticalErrorCode_INVALID_RADIO_SETTING); - if (power > 22) // This chip has lower power limits than some - power = 22; + if (power > SX126X_MAX_POWER) // This chip has lower power limits than some + power = SX126X_MAX_POWER; + err = lora.setOutputPower(power); assert(err == RADIOLIB_ERR_NONE); diff --git a/src/mesh/SX1280Interface.cpp b/src/mesh/SX1280Interface.cpp index 37aad1d40..97a3febe3 100644 --- a/src/mesh/SX1280Interface.cpp +++ b/src/mesh/SX1280Interface.cpp @@ -2,7 +2,7 @@ #include "SX1280Interface.h" #include "error.h" -#if !defined(ARCH_PORTDUINO) +#if defined(RADIOLIB_GODMODE) SX1280Interface::SX1280Interface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy, SPIClass &spi) diff --git a/src/mesh/SX1280Interface.h b/src/mesh/SX1280Interface.h index 1c2e24900..a9661501a 100644 --- a/src/mesh/SX1280Interface.h +++ b/src/mesh/SX1280Interface.h @@ -6,7 +6,7 @@ * Our adapter for SX1280 radios */ -#if !defined(ARCH_PORTDUINO) +#if defined(RADIOLIB_GODMODE) class SX1280Interface : public SX128xInterface { diff --git a/src/mesh/SX128xInterface.cpp b/src/mesh/SX128xInterface.cpp index 0044ae7e5..36eb0bb94 100644 --- a/src/mesh/SX128xInterface.cpp +++ b/src/mesh/SX128xInterface.cpp @@ -2,7 +2,7 @@ #include "SX128xInterface.h" #include "error.h" -#if !defined(ARCH_PORTDUINO) +#if defined(RADIOLIB_GODMODE) // Particular boards might define a different max power based on what their hardware can do #ifndef SX128X_MAX_POWER @@ -105,8 +105,9 @@ bool SX128xInterface::reconfigure() if (err != RADIOLIB_ERR_NONE) RECORD_CRITICALERROR(CriticalErrorCode_INVALID_RADIO_SETTING); - if (power > 22) // This chip has lower power limits than some - power = 22; + if (power > SX128X_MAX_POWER) // This chip has lower power limits than some + power = SX128X_MAX_POWER; + err = lora.setOutputPower(power); assert(err == RADIOLIB_ERR_NONE); @@ -218,7 +219,11 @@ bool SX128xInterface::isChannelActive() template bool SX128xInterface::isActivelyReceiving() { - return isChannelActive(); + // return isChannelActive(); + + uint16_t irq = lora.getIrqStatus(); + bool hasPreamble = (irq & RADIOLIB_SX128X_IRQ_HEADER_VALID); + return hasPreamble; } template diff --git a/src/mesh/SX128xInterface.h b/src/mesh/SX128xInterface.h index f712b8bc4..9994ce850 100644 --- a/src/mesh/SX128xInterface.h +++ b/src/mesh/SX128xInterface.h @@ -1,6 +1,6 @@ #pragma once -#if !defined(ARCH_PORTDUINO) +#if defined(RADIOLIB_GODMODE) #include "RadioLibInterface.h" diff --git a/src/mesh/http/WiFiAPClient.cpp b/src/mesh/http/WiFiAPClient.cpp index 09f5acf48..c00738d1a 100644 --- a/src/mesh/http/WiFiAPClient.cpp +++ b/src/mesh/http/WiFiAPClient.cpp @@ -35,32 +35,34 @@ char ourHost[16]; bool APStartupComplete = 0; +unsigned long lastrun_ntp = 0; + static bool needReconnect = true; // If we create our reconnector, run it once at the beginning +static Periodic *wifiReconnect; + static int32_t reconnectWiFi() { const char *wifiName = config.network.wifi_ssid; const char *wifiPsw = config.network.wifi_psk; - if (config.network.wifi_enabled && needReconnect && !WiFi.isConnected()) { + if (config.network.wifi_enabled && needReconnect) { if (!*wifiPsw) // Treat empty password as no password wifiPsw = NULL; - if (*wifiName) { - needReconnect = false; + needReconnect = false; - // Make sure we clear old connection credentials - WiFi.disconnect(false, true); + // Make sure we clear old connection credentials + WiFi.disconnect(false, true); - DEBUG_MSG("... Reconnecting to WiFi access point\n"); - WiFi.mode(WIFI_MODE_STA); - WiFi.begin(wifiName, wifiPsw); - } + DEBUG_MSG("... Reconnecting to WiFi access point\n"); + WiFi.mode(WIFI_MODE_STA); + WiFi.begin(wifiName, wifiPsw); } #ifndef DISABLE_NTP - if (WiFi.isConnected()) { + if (WiFi.isConnected() && ((millis() - lastrun_ntp) > 43200000)) { // every 12 hours DEBUG_MSG("Updating NTP time\n"); if (timeClient.update()) { DEBUG_MSG("NTP Request Success - Setting RTCQualityNTP if needed\n"); @@ -70,6 +72,7 @@ static int32_t reconnectWiFi() tv.tv_usec = 0; perhapsSetRTC(RTCQualityNTP, &tv); + lastrun_ntp = millis(); } else { DEBUG_MSG("NTP Update failed\n"); @@ -77,11 +80,13 @@ static int32_t reconnectWiFi() } #endif - return 43200 * 1000; // every 12 hours + if (config.network.wifi_enabled && !WiFi.isConnected()) { + return 1000; // check once per second + } else { + return 300000; // every 5 minutes + } } -static Periodic *wifiReconnect; - bool isWifiAvailable() { @@ -95,20 +100,10 @@ bool isWifiAvailable() // Disable WiFi void deinitWifi() { - /* - Note from Jm (jm@casler.org - Sept 16, 2020): - - A bug in the ESP32 SDK was introduced in Oct 2019 that keeps the WiFi radio from - turning back on after it's shut off. See: - https://github.com/espressif/arduino-esp32/issues/3522 - - Until then, WiFi should only be allowed when there's no power - saving on the 2.4g transceiver. - */ - DEBUG_MSG("WiFi deinit\n"); if (isWifiAvailable()) { + WiFi.disconnect(true); WiFi.mode(WIFI_MODE_NULL); DEBUG_MSG("WiFi Turned Off\n"); // WiFi.printDiag(Serial); @@ -169,7 +164,7 @@ bool initWifi() WiFi.mode(WIFI_MODE_STA); WiFi.setHostname(ourHost); WiFi.onEvent(WiFiEvent); - WiFi.setAutoReconnect(true); + WiFi.setAutoReconnect(false); WiFi.setSleep(false); if (config.network.eth_mode == Config_NetworkConfig_EthMode_STATIC && config.network.ipv4_config.ip != 0) { WiFi.config(config.network.ipv4_config.ip, @@ -231,7 +226,9 @@ static void WiFiEvent(WiFiEvent_t event) break; case SYSTEM_EVENT_STA_DISCONNECTED: DEBUG_MSG("Disconnected from WiFi access point\n"); + WiFi.disconnect(false, true); needReconnect = true; + wifiReconnect->setIntervalFromNow(1000); break; case SYSTEM_EVENT_STA_AUTHMODE_CHANGE: DEBUG_MSG("Authentication mode of access point has changed\n"); @@ -243,7 +240,9 @@ static void WiFiEvent(WiFiEvent_t event) break; case SYSTEM_EVENT_STA_LOST_IP: DEBUG_MSG("Lost IP address and IP address is reset to 0\n"); + WiFi.disconnect(false, true); needReconnect = true; + wifiReconnect->setIntervalFromNow(1000); break; case SYSTEM_EVENT_STA_WPS_ER_SUCCESS: DEBUG_MSG("WiFi Protected Setup (WPS): succeeded in enrollee mode\n"); @@ -259,7 +258,6 @@ static void WiFiEvent(WiFiEvent_t event) break; case SYSTEM_EVENT_AP_START: DEBUG_MSG("WiFi access point started\n"); - onNetworkConnected(); break; case SYSTEM_EVENT_AP_STOP: DEBUG_MSG("WiFi access point stopped\n"); diff --git a/src/modules/CannedMessageModule.cpp b/src/modules/CannedMessageModule.cpp index b00dfb796..e7b34b9a7 100644 --- a/src/modules/CannedMessageModule.cpp +++ b/src/modules/CannedMessageModule.cpp @@ -176,7 +176,7 @@ int CannedMessageModule::handleInputEvent(const InputEvent *event) DEBUG_MSG("Canned message event Matrix key pressed\n"); // this will send the text immediately on matrix press this->runState = CANNED_MESSAGE_RUN_STATE_ACTION_SELECT; - this->payload = event->kbchar; + this->payload = MATRIXKEY; this->currentMessageIndex = event->kbchar -1; this->lastTouchMillis = millis(); validEvent = true; @@ -246,7 +246,12 @@ int32_t CannedMessageModule::runOnce() } } else { if ((this->messagesCount > this->currentMessageIndex) && (strlen(this->messages[this->currentMessageIndex]) > 0)) { - sendText(NODENUM_BROADCAST, this->messages[this->currentMessageIndex], true); + if(strcmp (this->messages[this->currentMessageIndex], "~") == 0) { + powerFSM.trigger(EVENT_PRESS); + return INT32_MAX; + } else { + sendText(NODENUM_BROADCAST, this->messages[this->currentMessageIndex], true); + } this->runState = CANNED_MESSAGE_RUN_STATE_SENDING_ACTIVE; } else { DEBUG_MSG("Reset message is empty.\n"); diff --git a/src/mqtt/MQTT.cpp b/src/mqtt/MQTT.cpp index 194683939..fa1a66593 100644 --- a/src/mqtt/MQTT.cpp +++ b/src/mqtt/MQTT.cpp @@ -118,24 +118,16 @@ bool MQTT::connected() void MQTT::reconnect() { if (wantsLink()) { - const char *serverAddr = "mqtt.meshtastic.org"; // default hostname - int serverPort = 1883; // default server port - const char *mqttUsername = "meshdev"; - const char *mqttPassword = "large4cats"; + // Defaults + int serverPort = 1883; + const char *serverAddr = default_mqtt_address; + const char *mqttUsername = default_mqtt_username; + const char *mqttPassword = default_mqtt_password; if (*moduleConfig.mqtt.address) { - serverAddr = moduleConfig.mqtt.address; // Override the default - mqttUsername = - moduleConfig.mqtt.username; // do not use the hardcoded credentials for a custom mqtt server + serverAddr = moduleConfig.mqtt.address; + mqttUsername = moduleConfig.mqtt.username; mqttPassword = moduleConfig.mqtt.password; - } else { - // we are using the default server. Use the hardcoded credentials by default, but allow overriding - if (*moduleConfig.mqtt.username && moduleConfig.mqtt.username[0] != '\0') { - mqttUsername = moduleConfig.mqtt.username; - } - if (*moduleConfig.mqtt.password && moduleConfig.mqtt.password[0] != '\0') { - mqttPassword = moduleConfig.mqtt.password; - } } String server = String(serverAddr); @@ -148,8 +140,7 @@ void MQTT::reconnect() } pubSub.setServer(serverAddr, serverPort); - DEBUG_MSG("Connecting to MQTT server %s, port: %d, username: %s, password: %s\n", serverAddr, serverPort, mqttUsername, - mqttPassword); + DEBUG_MSG("Connecting to MQTT server %s, port: %d, username: %s, password: %s\n", serverAddr, serverPort, mqttUsername, mqttPassword); auto myStatus = (statusTopic + owner.id); bool connected = pubSub.connect(owner.id, mqttUsername, mqttPassword, myStatus.c_str(), 1, true, "offline"); if (connected) { @@ -176,9 +167,11 @@ void MQTT::sendSubscriptions() String topic = cryptTopic + channels.getGlobalId(i) + "/#"; DEBUG_MSG("Subscribing to %s\n", topic.c_str()); pubSub.subscribe(topic.c_str(), 1); // FIXME, is QOS 1 right? - String topicDecoded = jsonTopic + channels.getGlobalId(i) + "/#"; - DEBUG_MSG("Subscribing to %s\n", topicDecoded.c_str()); - pubSub.subscribe(topicDecoded.c_str(), 1); // FIXME, is QOS 1 right? + if (moduleConfig.mqtt.json_enabled == true) { + String topicDecoded = jsonTopic + channels.getGlobalId(i) + "/#"; + DEBUG_MSG("Subscribing to %s\n", topicDecoded.c_str()); + pubSub.subscribe(topicDecoded.c_str(), 1); // FIXME, is QOS 1 right? + } } } } diff --git a/variants/portduino/platformio.ini b/variants/portduino/platformio.ini index c95ae37fe..5bbde2adf 100644 --- a/variants/portduino/platformio.ini +++ b/variants/portduino/platformio.ini @@ -1,16 +1,22 @@ [env:native] -platform = https://github.com/meshtastic/platform-native.git +extends = portduino_base build_flags = ${portduino_base.build_flags} -O0 -I variants/portduino -framework = arduino board = cross_platform lib_deps = ${portduino_base.lib_deps} build_src_filter = ${portduino_base.build_src_filter} ; The Portduino based sim environment on top of a linux OS and touching linux hardware devices [env:linux] -platform = https://github.com/meshtastic/platform-native.git +extends = portduino_base build_flags = ${portduino_base.build_flags} -O0 -lgpiod -I variants/portduino -framework = arduino board = linux_hardware lib_deps = ${portduino_base.lib_deps} build_src_filter = ${portduino_base.build_src_filter} + +; The Portduino based sim environment on top of a linux OS and touching linux hardware devices +[env:linux-arm] +extends = portduino_base +build_flags = ${portduino_base.build_flags} -O0 -lgpiod -I variants/portduino +board = linux_arm +lib_deps = ${portduino_base.lib_deps} +build_src_filter = ${portduino_base.build_src_filter} diff --git a/variants/portduino/variant.h b/variants/portduino/variant.h index 328afaf19..76696b7af 100644 --- a/variants/portduino/variant.h +++ b/variants/portduino/variant.h @@ -23,16 +23,3 @@ // HOPE RFM90 does not have a TCXO therefore not SX126X_E22 #endif -// Temporary shim for radio lib macros until we upgrade to upstream for portduino -#define RADIOLIB_PREAMBLE_DETECTED PREAMBLE_DETECTED - -#define RADIOLIB_ERR_NONE ERR_NONE -#define RADIOLIB_ERR_WRONG_MODEM ERR_WRONG_MODEM - -#define RADIOLIB_SX126X_IRQ_HEADER_VALID SX126X_IRQ_HEADER_VALID -#define RADIOLIB_SX126X_LORA_CRC_ON SX126X_LORA_CRC_ON - -#define RADIOLIB_SX127X_REG_TCXO SX127X_REG_TCXO -#define RADIOLIB_SX127X_REG_MODEM_STAT SX127X_REG_MODEM_STAT -#define RADIOLIB_SX127X_SYNC_WORD SX127X_SYNC_WORD -#define RADIOLIB_SX127X_MASK_IRQ_FLAG_VALID_HEADER SX127X_MASK_IRQ_FLAG_VALID_HEADER diff --git a/variants/tlora_v1/variant.h b/variants/tlora_v1/variant.h index 3a1d61db5..6ab8bad4c 100644 --- a/variants/tlora_v1/variant.h +++ b/variants/tlora_v1/variant.h @@ -6,7 +6,7 @@ #define RESET_OLED 16 // If defined, this pin will be used to reset the display controller -// #define VEXT_ENABLE 21 // active low, powers the oled display and the lora antenna boost +#define VEXT_ENABLE 21 // active low, powers the oled display and the lora antenna boost #define LED_PIN 2 // If defined we will blink this LED #define BUTTON_PIN 0 // If defined, this will be used for user button presses #define BUTTON_NEED_PULLUP diff --git a/variants/tlora_v2_1_18/platformio.ini b/variants/tlora_v2_1_18/platformio.ini index 4160be5de..f5af98904 100644 --- a/variants/tlora_v2_1_18/platformio.ini +++ b/variants/tlora_v2_1_18/platformio.ini @@ -5,4 +5,4 @@ lib_deps = ${esp32_base.lib_deps} caveman99/ESP32 Codec2@^1.0.1 build_flags = - ${esp32_base.build_flags} -D TLORA_V2_1_18 -I variants/tlora_v2_1_18 \ No newline at end of file + ${esp32_base.build_flags} -D TLORA_V2_1_18 -I variants/tlora_v2_1_18 -D RADIOLIB_GODMODE \ No newline at end of file