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/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..58fbb04cb 100644 --- a/geeksville-private/TODO.md +++ b/geeksville-private/TODO.md @@ -2,25 +2,23 @@ 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 +* 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 +* DONE make native sim not touch hardware +* DONE reenable sim in CI builds * 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 +* DONE fix this sleep problem: https://meshtastic.discourse.group/t/new-device-release-1-2-30-ready-for-alpha-testing/3272/13?u=geeksville * 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..28edc6626 100644 --- a/platformio.ini +++ b/platformio.ini @@ -9,7 +9,7 @@ ; https://docs.platformio.org/page/projectconf.html [platformio] -default_envs = tbeam +;default_envs = tbeam ;default_envs = tbeam0.7 ;default_envs = heltec-v2.0 ;default_envs = tlora-v1 @@ -18,7 +18,7 @@ default_envs = tbeam ;default_envs = lora-relay-v1 # nrf board ;default_envs = t-echo ;default_envs = nrf52840dk-geeksville -;default_envs = native # lora-relay-v1 # nrf52840dk-geeksville # linux # or if you'd like to change the default to something like lora-relay-v1 put that here +default_envs = native # lora-relay-v1 # nrf52840dk-geeksville # linux # or if you'd like to change the default to something like lora-relay-v1 put that here ;default_envs = rak4631 ;default_envs = rak4630 @@ -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/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());