diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7ec9037b6..9b1424419 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -59,14 +59,14 @@ jobs: pio upgrade # We now run integration test before other build steps (to quickly see runtime failures) - #- name: Build for native - # run: platformio run -e native - #- name: Integration test - # run: | - # .pio/build/native/program & - # sleep 20 # 5 seconds was not enough - # echo "Simulator started, launching python test..." - # python3 -c 'from meshtastic.test import testSimulator; testSimulator()' + - name: Build for native + run: platformio run -e native + - name: Integration test + run: | + .pio/build/native/program & + sleep 20 # 5 seconds was not enough + echo "Simulator started, launching python test..." + python3 -c 'from meshtastic.test import testSimulator; testSimulator()' # - name: Build for tbeam # run: platformio run -e tbeam diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3b94d1c56..470614817 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -49,7 +49,7 @@ jobs: # Will be available in steps.version.outputs.version - name: Get version string - run: echo "::set-output name=version::$(./bin/buildinfo.py)" + run: echo "::set-output name=version::$(./bin/buildinfo.py long)" id: version - name: Build everything diff --git a/bin/promote-release.sh b/bin/promote-release.sh index 98e3d6748..b4828dd68 100755 --- a/bin/promote-release.sh +++ b/bin/promote-release.sh @@ -1,6 +1,8 @@ +set -e + echo "This script is only for developers who are publishing new builds on github. Most users don't need it" -VERSION=`bin/buildinfo.py` +VERSION=`bin/buildinfo.py long` # Must have a V prefix to trigger github git tag "v${VERSION}" diff --git a/bin/test-simulator.sh b/bin/test-simulator.sh new file mode 100755 index 000000000..46158dc56 --- /dev/null +++ b/bin/test-simulator.sh @@ -0,0 +1,9 @@ +set -e + +echo "Starting simulator" +.pio/build/native/program & +sleep 20 # 5 seconds was not enough + +echo "Simulator started, launching python test..." +python3 -c 'from meshtastic.test import testSimulator; testSimulator()' + diff --git a/geeksville-private/TODO.md b/geeksville-private/TODO.md index 4955ace87..2e0a1399a 100644 --- a/geeksville-private/TODO.md +++ b/geeksville-private/TODO.md @@ -2,25 +2,21 @@ You probably don't care about this section - skip to the next one. -## before next release - -* fix python tool problem with windows and the heartbeat +* admin remote nodes reboot sometimes https://github.com/meshtastic/Meshtastic-device/issues/811 +* router mode dropping messages? https://meshtastic.discourse.group/t/router-mode-missing-messages/3329/3 * fix ttgo eink screen -* fix this sleep problem: https://meshtastic.discourse.group/t/new-device-release-1-2-30-ready-for-alpha-testing/3272/13?u=geeksville -* make native sim not touch hardware -* reenable sim in CI builds +* list portduino on platformio * figure our wss for mqtt.meshtastic - use cloudflare? 2052 ws, 2053 crypt -* release android APK - fix recent 1.2.28 crash report -* turn on setTx(timeout) and state = setDioIrqParams(SX126X_IRQ_TX_DONE | SX126X_IRQ_TIMEOUT, SX126X_IRQ_TX_DONE | SX126X_IRQ_TIMEOUT); in sx1262 code * pine64 lora module * @havealoha fixedposition not working -* @luxonn reports that after a while the android app stops showing new messages * ask for vercel access * finish plan for riot.im - +* turn on setTx(timeout) and state = setDioIrqParams(SX126X_IRQ_TX_DONE | SX126X_IRQ_TIMEOUT, SX126X_IRQ_TX_DONE | SX126X_IRQ_TIMEOUT); in sx1262 code * add rak4600 support (with rf95 radio and limited ram) * Switch to use https://github.com/adafruit/Adafruit_nRF52_Arduino.git when available (see arduino code for examples) +* DONE @luxonn reports that after a while the android app stops showing new messages +* DONE release android APK - fix recent 1.2.28 crash report * DONE remote admin busted? * DONE check android code - @havealoha comments about odd sleep behavior * ABANDONED test github actions locally on linux diff --git a/platformio.ini b/platformio.ini index 833645b84..48437c9a0 100644 --- a/platformio.ini +++ b/platformio.ini @@ -425,13 +425,24 @@ lib_deps = SparkFun BQ27441 LiPo Fuel Gauge Arduino Library TFT_eSPI -; The Portduino based sim environment on top of linux +; The Portduino based sim environment on top of any host OS, all hardware will be simulated [env:native] platform = https://github.com/geeksville/platform-native.git src_filter = ${env.src_filter} - - - - - -build_flags = ${arduino_base.build_flags} -O0 -lgpiod +build_flags = ${arduino_base.build_flags} -O0 framework = arduino -board = native +board = cross_platform +lib_deps = + ${arduino_base.lib_deps} + rweather/Crypto + +; The Portduino based sim environment on top of a linux OS and touching linux hardware devices +[env:linux] +platform = https://github.com/geeksville/platform-native.git +src_filter = ${env.src_filter} - - - - - +build_flags = ${arduino_base.build_flags} -O0 -lgpiod +framework = arduino +board = linux_hardware lib_deps = ${arduino_base.lib_deps} rweather/Crypto diff --git a/src/mesh/StreamAPI.cpp b/src/mesh/StreamAPI.cpp index 3785e5028..3e52506c7 100644 --- a/src/mesh/StreamAPI.cpp +++ b/src/mesh/StreamAPI.cpp @@ -45,7 +45,7 @@ int32_t StreamAPI::readStream() } else if (ptr >= HEADER_LEN - 1) { // we have at least read our 4 byte framing uint32_t len = (rxBuf[2] << 8) + rxBuf[3]; // big endian 16 bit length follows framing - console->printf("len %d\n", len); + // console->printf("len %d\n", len); if (ptr == HEADER_LEN - 1) { // we _just_ finished our 4 byte header, validate length now (note: a length of zero is a valid diff --git a/src/mesh/http/WiFiAPClient.cpp b/src/mesh/http/WiFiAPClient.cpp index bf8ee9624..6cccd6acc 100644 --- a/src/mesh/http/WiFiAPClient.cpp +++ b/src/mesh/http/WiFiAPClient.cpp @@ -32,11 +32,10 @@ bool isWifiAvailable() { // If wifi status is connected, return true regardless of the radio configuration. if (isSoftAPForced()) { - return 1; + return true; } const char *wifiName = radioConfig.preferences.wifi_ssid; - const char *wifiPsw = radioConfig.preferences.wifi_password; // strcpy(radioConfig.preferences.wifi_ssid, "meshtastic"); // strcpy(radioConfig.preferences.wifi_password, "meshtastic!"); @@ -47,10 +46,10 @@ bool isWifiAvailable() // radioConfig.preferences.wifi_ap_mode = true; // radioConfig.preferences.wifi_ap_mode = false; - if (*wifiName && *wifiPsw) { - return 1; + if (*wifiName) { + return true; } else { - return 0; + return false; } } @@ -96,7 +95,10 @@ void initWifi(bool forceSoftAP) const char *wifiName = radioConfig.preferences.wifi_ssid; const char *wifiPsw = radioConfig.preferences.wifi_password; - if ((*wifiName && *wifiPsw) || forceSoftAP) { + if (!*wifiPsw) // Treat empty password as no password + wifiPsw = NULL; + + if (*wifiName || forceSoftAP) { if (forceSoftAP) { DEBUG_MSG("Forcing SoftAP\n"); @@ -178,8 +180,6 @@ void initWifi(bool forceSoftAP) DEBUG_MSG("Not using WIFI\n"); } - - // Called by the Espressif SDK to static void WiFiEvent(WiFiEvent_t event) { @@ -304,12 +304,15 @@ void handleDNSResponse() void reconnectWiFi() { - const char *wifiName = radioConfig.preferences.wifi_ssid; - const char *wifiPsw = radioConfig.preferences.wifi_password; - if (radioConfig.has_preferences) { - if (*wifiName && *wifiPsw) { + const char *wifiName = radioConfig.preferences.wifi_ssid; + const char *wifiPsw = radioConfig.preferences.wifi_password; + + if (!*wifiPsw) // Treat empty password as no password + wifiPsw = NULL; + + if (*wifiName) { DEBUG_MSG("... Reconnecting to WiFi access point"); diff --git a/src/mesh/wifi/WiFiServerAPI.h b/src/mesh/wifi/WiFiServerAPI.h index 96ff62999..c1f9b1be3 100644 --- a/src/mesh/wifi/WiFiServerAPI.h +++ b/src/mesh/wifi/WiFiServerAPI.h @@ -22,6 +22,9 @@ class WiFiServerAPI : public StreamAPI protected: + /// We override this method to prevent publishing EVENT_SERIAL_CONNECTED/DISCONNECTED for wifi links (we want the board to stay in the POWERED state to prevent disabling wifi) + virtual void onConnectionChanged(bool connected) {} + virtual int32_t runOnce(); // Check for dropped client connections /// Check the current underlying physical link to see if the client is currently connected diff --git a/src/portduino/PortduinoGlue.cpp b/src/portduino/PortduinoGlue.cpp index 294dc87a4..d2caf695c 100644 --- a/src/portduino/PortduinoGlue.cpp +++ b/src/portduino/PortduinoGlue.cpp @@ -1,5 +1,6 @@ #include "CryptoEngine.h" #include "PortduinoGPIO.h" +#include "SPIChip.h" #include "mesh/RF95Interface.h" #include "sleep.h" #include "target_specific.h" @@ -48,7 +49,7 @@ class PolledIrqPin : public GPIOPin } }; -GPIOPin *loraIrq; +static GPIOPin *loraIrq; /** apps run under portduino can optionally define a portduinoSetup() to * use portduino specific init code (such as gpioBind) to setup portduino on their host machine, @@ -58,26 +59,45 @@ void portduinoSetup() { printf("Setting up Meshtastic on Porduino...\n"); - // FIXME: remove this hack once interrupts are confirmed to work on new pine64 board - // loraIrq = new PolledIrqPin(); - loraIrq = new LinuxGPIOPin(LORA_DIO1, "ch341", "int", "loraIrq"); // or "err"? - loraIrq->setSilent(); - gpioBind(loraIrq); +#ifdef PORTDUINO_LINUX_HARDWARE + SPI.begin(); // We need to create SPI + bool usePineLora = !spiChip->isSimulated(); + if(usePineLora) { + printf("Connecting to PineLora board...\n"); - // BUSY hw was busted on current board - just use the simulated pin (which will read low) - auto busy = new LinuxGPIOPin(SX1262_BUSY, "ch341", "slct", "loraBusy"); - busy->setSilent(); - gpioBind(busy); - //auto fakeBusy = new SimGPIOPin(SX1262_BUSY, "fakeBusy"); - //fakeBusy->writePin(LOW); - //fakeBusy->setSilent(true); - //gpioBind(fakeBusy); + // FIXME: remove this hack once interrupts are confirmed to work on new pine64 board + // loraIrq = new PolledIrqPin(); + loraIrq = new LinuxGPIOPin(LORA_DIO1, "ch341", "int", "loraIrq"); // or "err"? + loraIrq->setSilent(); + gpioBind(loraIrq); - gpioBind(new LinuxGPIOPin(SX1262_RESET, "ch341", "ini", "loraReset")); + // BUSY hw was busted on current board - just use the simulated pin (which will read low) + auto busy = new LinuxGPIOPin(SX1262_BUSY, "ch341", "slct", "loraBusy"); + busy->setSilent(); + gpioBind(busy); - auto loraCs = new LinuxGPIOPin(SX1262_CS, "ch341", "cs0", "loraCs"); - loraCs->setSilent(); - gpioBind(loraCs); + gpioBind(new LinuxGPIOPin(SX1262_RESET, "ch341", "ini", "loraReset")); + + auto loraCs = new LinuxGPIOPin(SX1262_CS, "ch341", "cs0", "loraCs"); + loraCs->setSilent(); + gpioBind(loraCs); + } + else +#endif + + { + auto fakeBusy = new SimGPIOPin(SX1262_BUSY, "fakeBusy"); + fakeBusy->writePin(LOW); + fakeBusy->setSilent(true); + gpioBind(fakeBusy); + + auto cs = new SimGPIOPin(SX1262_CS, "fakeLoraCS"); + cs->setSilent(true); + gpioBind(cs); + + gpioBind(new SimGPIOPin(SX1262_RESET, "fakeLoraReset")); + gpioBind(new SimGPIOPin(LORA_DIO1, "fakeLoraIrq")); + } // gpioBind((new SimGPIOPin(LORA_RESET, "LORA_RESET"))); // gpioBind((new SimGPIOPin(RF95_NSS, "RF95_NSS"))->setSilent()); diff --git a/version.properties b/version.properties index e7da90cfe..d3e7a2622 100644 --- a/version.properties +++ b/version.properties @@ -1,4 +1,4 @@ [VERSION] major = 1 minor = 2 -build = 30 +build = 38