From f9b2556cd446e8aac9b28a7e97d6eb444388fc9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Mon, 15 May 2023 15:40:22 +0200 Subject: [PATCH 1/5] add optional GPS fields to JSON --- src/mqtt/MQTT.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/mqtt/MQTT.cpp b/src/mqtt/MQTT.cpp index 490543bf6..532a2d125 100644 --- a/src/mqtt/MQTT.cpp +++ b/src/mqtt/MQTT.cpp @@ -505,6 +505,15 @@ std::string MQTT::downstreamPacketToJson(meshtastic_MeshPacket *mp) if ((int)decoded->altitude) { msgPayload["altitude"] = new JSONValue((int)decoded->altitude); } + if ((int)decoded->ground_speed) { + msgPayload["ground_speed"] = new JSONValue((int)decoded->ground_speed); + } + if (int(decoded->ground_track)) { + msgPayload["ground_track"] = new JSONValue((int)decoded->ground_track); + } + if (int(decoded->sats_in_view)) { + msgPayload["sats_in_view"] = new JSONValue((int)decoded->sats_in_view); + } jsonObj["payload"] = new JSONValue(msgPayload); } else { LOG_ERROR("Error decoding protobuf for position message!\n"); From e02720b29bcc01c53915d12aad3413c6d4a2f626 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Mon, 15 May 2023 15:47:10 +0200 Subject: [PATCH 2/5] fixes #2490 - hard coded 8 hour limit --- src/modules/esp32/RangeTestModule.cpp | 11 +++++++++-- src/modules/esp32/RangeTestModule.h | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/modules/esp32/RangeTestModule.cpp b/src/modules/esp32/RangeTestModule.cpp index e8821f9a0..a1d6cb5f2 100644 --- a/src/modules/esp32/RangeTestModule.cpp +++ b/src/modules/esp32/RangeTestModule.cpp @@ -53,7 +53,8 @@ int32_t RangeTestModule::runOnce() if (moduleConfig.range_test.sender) { LOG_INFO("Initializing Range Test Module -- Sender\n"); - return (5000); // Sending first message 5 seconds after initilization. + return (5000); // Sending first message 5 seconds after initilization. + started = millis(); // make a note of when we started } else { LOG_INFO("Initializing Range Test Module -- Receiver\n"); return disable(); @@ -77,7 +78,13 @@ int32_t RangeTestModule::runOnce() rangeTestModuleRadio->sendPayload(); } - return (senderHeartbeat); + // If we have been running for more than 8 hours, turn module back off + if (millis() - started > 28800000) { + LOG_INFO("Range Test Module - Disabling after 8 hours\n"); + return disable(); + } else { + return (senderHeartbeat); + } } else { return disable(); // This thread does not need to run as a receiver diff --git a/src/modules/esp32/RangeTestModule.h b/src/modules/esp32/RangeTestModule.h index 533621d47..ae2a8f182 100644 --- a/src/modules/esp32/RangeTestModule.h +++ b/src/modules/esp32/RangeTestModule.h @@ -9,6 +9,7 @@ class RangeTestModule : private concurrency::OSThread { bool firstTime = 1; + unsigned long started = 0; public: RangeTestModule(); From 77dace10438f0abbb8f10778bb583c5c200241e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Mon, 15 May 2023 16:05:25 +0200 Subject: [PATCH 3/5] derp --- src/modules/esp32/RangeTestModule.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/esp32/RangeTestModule.cpp b/src/modules/esp32/RangeTestModule.cpp index a1d6cb5f2..b3f03c04b 100644 --- a/src/modules/esp32/RangeTestModule.cpp +++ b/src/modules/esp32/RangeTestModule.cpp @@ -53,8 +53,8 @@ int32_t RangeTestModule::runOnce() if (moduleConfig.range_test.sender) { LOG_INFO("Initializing Range Test Module -- Sender\n"); - return (5000); // Sending first message 5 seconds after initilization. started = millis(); // make a note of when we started + return (5000); // Sending first message 5 seconds after initilization. } else { LOG_INFO("Initializing Range Test Module -- Receiver\n"); return disable(); From 62259583e6ac6ed1f5c902eee62385e33f4a568a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Mon, 15 May 2023 17:17:14 +0200 Subject: [PATCH 4/5] Add variant an plumbing for #2468 --- src/graphics/Screen.cpp | 10 ++++---- src/graphics/Screen.h | 2 +- src/graphics/TFTDisplay.cpp | 2 +- src/graphics/images.h | 2 +- variants/picomputer-s3/pins_arduino.h | 37 +++++++++++++++++++++++++++ variants/picomputer-s3/platformio.ini | 27 +++++++++++++++++++ variants/picomputer-s3/variant.h | 24 +++++++++++++++++ 7 files changed, 96 insertions(+), 8 deletions(-) create mode 100644 variants/picomputer-s3/pins_arduino.h create mode 100644 variants/picomputer-s3/platformio.ini create mode 100644 variants/picomputer-s3/variant.h diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index 072a9d14d..9d666d986 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -101,7 +101,7 @@ static uint16_t displayWidth, displayHeight; #define SCREEN_WIDTH displayWidth #define SCREEN_HEIGHT displayHeight -#if defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7735_CS) +#if defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7735_CS) || defined(USE_ST7789) // The screen is bigger so use bigger fonts #define FONT_SMALL ArialMT_Plain_16 // Height: 19 #define FONT_MEDIUM ArialMT_Plain_24 // Height: 28 @@ -491,7 +491,7 @@ static void drawNodes(OLEDDisplay *display, int16_t x, int16_t y, NodeStatus *no { char usersString[20]; snprintf(usersString, sizeof(usersString), "%d/%d", nodeStatus->getNumOnline(), nodeStatus->getNumTotal()); -#if defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7735_CS) +#if defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7735_CS) || defined(USE_ST7789) display->drawFastImage(x, y + 3, 8, 8, imgUser); #else display->drawFastImage(x, y, 8, 8, imgUser); @@ -1487,7 +1487,7 @@ void DebugInfo::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16 #ifdef ARCH_ESP32 if (millis() - storeForwardModule->lastHeartbeat > (storeForwardModule->heartbeatInterval * 1200)) { // no heartbeat, overlap a bit -#if defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7735_CS) +#if defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7735_CS) || defined(USE_ST7789) display->drawFastImage(x + SCREEN_WIDTH - 14 - display->getStringWidth(ourId), y + 3 + FONT_HEIGHT_SMALL, 12, 8, imgQuestionL1); display->drawFastImage(x + SCREEN_WIDTH - 14 - display->getStringWidth(ourId), y + 11 + FONT_HEIGHT_SMALL, 12, 8, @@ -1497,7 +1497,7 @@ void DebugInfo::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16 imgQuestion); #endif } else { -#if defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7735_CS) +#if defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7735_CS) || defined(USE_ST7789) display->drawFastImage(x + SCREEN_WIDTH - 18 - display->getStringWidth(ourId), y + 3 + FONT_HEIGHT_SMALL, 16, 8, imgSFL1); display->drawFastImage(x + SCREEN_WIDTH - 18 - display->getStringWidth(ourId), y + 11 + FONT_HEIGHT_SMALL, 16, 8, @@ -1509,7 +1509,7 @@ void DebugInfo::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16 } #endif } else { -#if defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7735_CS) +#if defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7735_CS) || defined(USE_ST7789) display->drawFastImage(x + SCREEN_WIDTH - 14 - display->getStringWidth(ourId), y + 3 + FONT_HEIGHT_SMALL, 12, 8, imgInfoL1); display->drawFastImage(x + SCREEN_WIDTH - 14 - display->getStringWidth(ourId), y + 11 + FONT_HEIGHT_SMALL, 12, 8, diff --git a/src/graphics/Screen.h b/src/graphics/Screen.h index 992a73285..a9ddc3316 100644 --- a/src/graphics/Screen.h +++ b/src/graphics/Screen.h @@ -380,7 +380,7 @@ class Screen : public concurrency::OSThread SH1106Wire dispdev; #elif defined(USE_SSD1306) SSD1306Wire dispdev; -#elif defined(ST7735_CS) || defined(ILI9341_DRIVER) +#elif defined(ST7735_CS) || defined(ILI9341_DRIVER) || defined(USE_ST7789) TFTDisplay dispdev; #elif defined(USE_EINK) EInkDisplay dispdev; diff --git a/src/graphics/TFTDisplay.cpp b/src/graphics/TFTDisplay.cpp index 8c07a4204..ed4367d42 100644 --- a/src/graphics/TFTDisplay.cpp +++ b/src/graphics/TFTDisplay.cpp @@ -1,6 +1,6 @@ #include "configuration.h" -#if defined(ST7735_CS) || defined(ILI9341_DRIVER) +#if defined(ST7735_CS) || defined(ILI9341_DRIVER) || defined(USE_ST7789) #include "SPILock.h" #include "TFTDisplay.h" #include diff --git a/src/graphics/images.h b/src/graphics/images.h index b1818e32c..6b7c91862 100644 --- a/src/graphics/images.h +++ b/src/graphics/images.h @@ -14,7 +14,7 @@ const uint8_t imgUser[] PROGMEM = {0x3C, 0x42, 0x99, 0xA5, 0xA5, 0x99, 0x42, 0x3 const uint8_t imgPositionEmpty[] PROGMEM = {0x20, 0x30, 0x28, 0x24, 0x42, 0xFF}; const uint8_t imgPositionSolid[] PROGMEM = {0x20, 0x30, 0x38, 0x3C, 0x7E, 0xFF}; -#if defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7735_CS) +#if defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ST7735_CS) || defined(USE_ST7789) const uint8_t imgQuestionL1[] PROGMEM = {0xff, 0x01, 0x01, 0x32, 0x7b, 0x49, 0x49, 0x6f, 0x26, 0x01, 0x01, 0xff}; const uint8_t imgQuestionL2[] PROGMEM = {0x0f, 0x08, 0x08, 0x08, 0x06, 0x0f, 0x0f, 0x06, 0x08, 0x08, 0x08, 0x0f}; const uint8_t imgInfoL1[] PROGMEM = {0xff, 0x01, 0x01, 0x01, 0x1e, 0x7f, 0x1e, 0x01, 0x01, 0x01, 0x01, 0xff}; diff --git a/variants/picomputer-s3/pins_arduino.h b/variants/picomputer-s3/pins_arduino.h new file mode 100644 index 000000000..ee0e34ebf --- /dev/null +++ b/variants/picomputer-s3/pins_arduino.h @@ -0,0 +1,37 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include + +#define USB_VID 0x303a +#define USB_PID 0x1001 + +#define EXTERNAL_NUM_INTERRUPTS 46 +#define NUM_DIGITAL_PINS 48 +#define NUM_ANALOG_INPUTS 20 + +#define analogInputToDigitalPin(p) (((p) < 20) ? (analogChannelToDigitalPin(p)) : -1) +#define digitalPinToInterrupt(p) (((p) < 48) ? (p) : -1) +#define digitalPinHasPWM(p) (p < 46) + +static const uint8_t TX = 43; +static const uint8_t RX = 44; + +// The default Wire will be mapped to PMU and RTC +static const uint8_t SDA = 12; +static const uint8_t SCL = 14; + +// Default SPI will be mapped to Radio +static const uint8_t MISO = 39; +static const uint8_t SCK = 21; +static const uint8_t MOSI = 38; +static const uint8_t SS = 17; + +//#define SPI_MOSI (11) +//#define SPI_SCK (14) +//#define SPI_MISO (2) +//#define SPI_CS (13) + +//#define SDCARD_CS SPI_CS + +#endif /* Pins_Arduino_h */ \ No newline at end of file diff --git a/variants/picomputer-s3/platformio.ini b/variants/picomputer-s3/platformio.ini new file mode 100644 index 000000000..0cb58f23c --- /dev/null +++ b/variants/picomputer-s3/platformio.ini @@ -0,0 +1,27 @@ +[env:picomputer_s3] +extends = esp32s3_base +board = bpi_picow_esp32_s3 +board_level = extra +;OpenOCD flash method +;upload_protocol = esp-builtin +;Normal method +upload_protocol = esptool + +build_flags = + ${esp32_base.build_flags} + -D PRIVATE_HW + -I variants/picomputer-s3 + -DST7789_DRIVER + -DUSER_SETUP_LOADED + -DTFT_SDA_READ + -DTFT_MOSI=19 + -DTFT_MISO=-1 + -DTFT_SCLK=18 + -DTFT_CS=21 + -DTFT_DC=16 + -DTFT_BL=20 + -DDISABLE_ALL_LIBRARY_WARNINGS + +lib_deps = + ${esp32_base.lib_deps} + bodmer/TFT_eSPI@^2.4.76 \ No newline at end of file diff --git a/variants/picomputer-s3/variant.h b/variants/picomputer-s3/variant.h new file mode 100644 index 000000000..cbb8fe65e --- /dev/null +++ b/variants/picomputer-s3/variant.h @@ -0,0 +1,24 @@ +#define HAS_GPS 0 +#undef GPS_RX_PIN +#undef GPS_TX_PIN + +#define USE_ST7789 + +#define LED_PIN 48 // 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 + +#define USE_RF95 // RFM95/SX127x + +#define RF95_SCK 10 +#define RF95_MISO 12 +#define RF95_MOSI 11 +#define RF95_NSS 13 +#define LORA_RESET RADIOLIB_NC + +// per SX1276_Receive_Interrupt/utilities.h +#define LORA_DIO0 28 +#define LORA_DIO1 RADIOLIB_NC +#define LORA_DIO2 RADIOLIB_NC \ No newline at end of file From 508cdf6060282e214b1489b541764ec90dd36f77 Mon Sep 17 00:00:00 2001 From: IhorNehrutsa <70886343+IhorNehrutsa@users.noreply.github.com> Date: Tue, 16 May 2023 15:01:42 +0300 Subject: [PATCH 5/5] Up OneButton library version to 2.1.0 (#2480) * Up OneButton library version to 2.1.0 * Update ButtonThread.h --------- Co-authored-by: Ben Meadors --- arch/stm32/stm32wl5e.ini | 8 ++++---- platformio.ini | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/arch/stm32/stm32wl5e.ini b/arch/stm32/stm32wl5e.ini index 4d5cee56d..b610bf40b 100644 --- a/arch/stm32/stm32wl5e.ini +++ b/arch/stm32/stm32wl5e.ini @@ -4,11 +4,11 @@ board = generic_wl5e framework = arduino build_type = debug -build_flags = +build_flags = ${arduino_base.build_flags} -Isrc/platform/stm32wl -g -build_src_filter = +build_src_filter = ${arduino_base.build_src_filter} - - - - - - - - - - - - - - lib_deps = @@ -16,5 +16,5 @@ lib_deps = jgromes/RadioLib@^6.0.0 https://github.com/kokke/tiny-AES-c.git#f06ac37fc31dfdaca2e0d9bec83f90d5663c319b -lib_ignore = - mathertel/OneButton@^2.0.3 +lib_ignore = + https://github.com/mathertel/OneButton#2.1.0 diff --git a/platformio.ini b/platformio.ini index 2040b75ce..f7af9631c 100644 --- a/platformio.ini +++ b/platformio.ini @@ -31,7 +31,7 @@ extra_configs = variants/*/platformio.ini [env] -extra_scripts = bin/platformio-custom.py +extra_scripts = bin/platformio-custom.py ; note: we add src to our include search path so that lmic_project_config can override ; note: TINYGPS_OPTION_NO_CUSTOM_FIELDS is VERY important. We don't use custom fields and somewhere in that pile @@ -39,8 +39,8 @@ extra_scripts = bin/platformio-custom.py ; 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/mesh/generated -Isrc/gps -Isrc/buzz -Wl,-Map,.pio/build/output.map + -Wno-format + -Isrc -Isrc/mesh -Isrc/mesh/generated -Isrc/gps -Isrc/buzz -Wl,-Map,.pio/build/output.map -DUSE_THREAD_NAMES -DTINYGPS_OPTION_NO_CUSTOM_FIELDS -DPB_ENABLE_MALLOC=1 @@ -59,8 +59,8 @@ build_flags = -Wno-missing-field-initializers monitor_speed = 115200 lib_deps = - https://github.com/meshtastic/esp8266-oled-ssd1306.git#b38094e03dfa964fbc0e799bc374e91a605c1223 ; ESP8266_SSD1306 - mathertel/OneButton@^2.0.3 ; OneButton library for non-blocking button debounce + https://github.com/meshtastic/esp8266-oled-ssd1306.git#b38094e03dfa964fbc0e799bc374e91a605c1223 ; ESP8266_SSD1306 + https://github.com/mathertel/OneButton#2.1.0 ; OneButton library for non-blocking button debounce https://github.com/meshtastic/arduino-fsm.git#7db3702bf0cfe97b783d6c72595e3f38e0b19159 https://github.com/meshtastic/TinyGPSPlus.git#127ad674ef85f0201cb68a065879653ed94792c4 https://github.com/meshtastic/ArduinoThread.git#72921ac222eed6f526ba1682023cee290d9aa1b3 @@ -87,14 +87,14 @@ lib_deps = build_flags = ${env.build_flags} -Os -DRADIOLIB_SPI_PARANOID=0 build_src_filter = ${env.build_src_filter} - -; Common libs for communicating over TCP/IP networks such as MQTT +; Common libs for communicating over TCP/IP networks such as MQTT [networking_base] lib_deps = knolleary/PubSubClient@^2.8 arduino-libraries/NTPClient@^3.1.0 arcao/Syslog@^2.0.0 -; Common libs for environmental measurements in telemetry module +; Common libs for environmental measurements in telemetry module ; (not included in native / portduino) [environmental_base] lib_deps =