From ba984aebfa1e31843976447674b9a517bd0cd6fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Sat, 2 Apr 2022 12:05:07 +0200 Subject: [PATCH 1/9] Varaible GPS Thread Timing, keep default of 100 msec --- src/configuration.h | 4 ++++ src/gps/GPS.cpp | 7 ++++--- variants/t-echo/variant.h | 2 ++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/configuration.h b/src/configuration.h index 6b9fc67a6..2597e2a72 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -155,6 +155,10 @@ along with this program. If not, see . #define GPS_BAUDRATE 9600 +#ifndef GPS_THREAD_INTERVAL +#define GPS_THREAD_INTERVAL 100 +#endif + #if defined(TBEAM_V10) // This string must exactly match the case used in release file names or the android updater won't work #define HW_VENDOR HardwareModel_TBEAM diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index 3f0c52242..8c0f7571d 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -51,7 +51,7 @@ bool GPS::setup() { // Master power for the GPS #ifdef PIN_GPS_EN - digitalWrite(PIN_GPS_EN, PIN_GPS_EN); + digitalWrite(PIN_GPS_EN, 1); pinMode(PIN_GPS_EN, OUTPUT); #endif @@ -268,7 +268,7 @@ int32_t GPS::runOnce() // 9600bps is approx 1 byte per msec, so considering our buffer size we never need to wake more often than 200ms // if not awake we can run super infrquently (once every 5 secs?) to see if we need to wake. - return isAwake ? 100 : 5000; + return isAwake ? GPS_THREAD_INTERVAL : 5000; } void GPS::forceWake(bool on) @@ -336,6 +336,7 @@ GPS *createGps() delete ublox; ublox = NULL; } else { + DEBUG_MSG("Using UBLOX Mode\n"); return ublox; } #endif @@ -343,7 +344,7 @@ GPS *createGps() if (GPS::_serial_gps) { // Some boards might have only the TX line from the GPS connected, in that case, we can't configure it at all. Just // assume NMEA at 9600 baud. - DEBUG_MSG("Hoping that NMEA might work\n"); + DEBUG_MSG("Using NMEA Mode\n"); GPS *new_gps = new NMEAGPS(); new_gps->setup(); return new_gps; diff --git a/variants/t-echo/variant.h b/variants/t-echo/variant.h index c5b767d05..4f8946e95 100644 --- a/variants/t-echo/variant.h +++ b/variants/t-echo/variant.h @@ -177,6 +177,8 @@ External serial flash WP25R1635FZUIL0 #define PIN_GPS_TX (32 + 9) // This is for bits going TOWARDS the CPU #define PIN_GPS_RX (32 + 8) // This is for bits going TOWARDS the GPS +#define GPS_THREAD_INTERVAL 50 + #define PIN_SERIAL1_RX PIN_GPS_TX #define PIN_SERIAL1_TX PIN_GPS_RX From d246c31548a874575aa419f07c84637cce9a8707 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Sat, 2 Apr 2022 12:16:42 +0200 Subject: [PATCH 2/9] GPS Pin Changes on V 2.0 and V1 too. --- variants/heltec_v1/variant.h | 6 +++--- variants/heltec_v2/variant.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/variants/heltec_v1/variant.h b/variants/heltec_v1/variant.h index 25cb14070..9ea07eb0c 100644 --- a/variants/heltec_v1/variant.h +++ b/variants/heltec_v1/variant.h @@ -3,7 +3,7 @@ #undef GPS_RX_PIN #undef GPS_TX_PIN #define GPS_RX_PIN 36 -#define GPS_TX_PIN 37 +#define GPS_TX_PIN 33 #ifndef USE_JTAG // gpio15 is TDO for JTAG, so no I2C on this board while doing jtag #define I2C_SDA 4 // I2C pins for this board @@ -20,8 +20,8 @@ #ifndef USE_JTAG #define LORA_RESET 14 #endif -#define LORA_DIO1 33 // Not really used -#define LORA_DIO2 32 // Not really used +#define LORA_DIO1 35 // Not really used +#define LORA_DIO2 34 // Not really used // ratio of voltage divider = 3.20 (R1=100k, R2=220k) #define ADC_MULTIPLIER 3.2 diff --git a/variants/heltec_v2/variant.h b/variants/heltec_v2/variant.h index 76b7314b5..e5981fd63 100644 --- a/variants/heltec_v2/variant.h +++ b/variants/heltec_v2/variant.h @@ -3,7 +3,7 @@ #undef GPS_RX_PIN #undef GPS_TX_PIN #define GPS_RX_PIN 36 -#define GPS_TX_PIN 37 +#define GPS_TX_PIN 33 #ifndef USE_JTAG // gpio15 is TDO for JTAG, so no I2C on this board while doing jtag #define I2C_SDA 4 // I2C pins for this board From 4d611ba2f0285efaaadc5ec0f6a6a9ae670f8bc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Wed, 4 May 2022 17:06:06 +0200 Subject: [PATCH 3/9] Forgot the readFromRTC for PCF8563 (T-Echo) --- src/gps/RTC.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gps/RTC.cpp b/src/gps/RTC.cpp index 335dbe37d..04e7043e5 100644 --- a/src/gps/RTC.cpp +++ b/src/gps/RTC.cpp @@ -120,7 +120,7 @@ bool perhapsSetRTC(RTCQuality q, const struct timeval *tv) #endif // nrf52 doesn't have a readable RTC (yet - software not written) -#if defined(PORTDUINO) || !defined(NO_ESP32) || defined(RV3028_RTC) +#if defined(PORTDUINO) || !defined(NO_ESP32) || defined(RV3028_RTC) || defined(PCF8563_RTC) readFromRTC(); #endif From 2b769279ae5388ceba3640b321964b25758ebed3 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Thu, 5 May 2022 13:20:16 -0500 Subject: [PATCH 4/9] Moving platform-native into meshtastic fork (#1437) --- variants/portduino/platformio.ini | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/variants/portduino/platformio.ini b/variants/portduino/platformio.ini index dd37c3bc9..adc018666 100644 --- a/variants/portduino/platformio.ini +++ b/variants/portduino/platformio.ini @@ -1,6 +1,6 @@ ; 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 +platform = https://github.com/meshtastic/platform-native.git src_filter = ${env.src_filter} - @@ -19,7 +19,7 @@ lib_deps = ; 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 +platform = https://github.com/meshtastic/platform-native.git src_filter = ${env.src_filter} - @@ -34,4 +34,4 @@ framework = arduino board = linux_hardware lib_deps = ${arduino_base.lib_deps} - rweather/Crypto \ No newline at end of file + rweather/Crypto From 5e109d96480973565f6f980f223348da4e114b29 Mon Sep 17 00:00:00 2001 From: Rockwell Schrock Date: Thu, 5 May 2022 14:46:39 -0400 Subject: [PATCH 5/9] Fix typo in calculation of NUM_ONLINE_SECS constant (#1436) Co-authored-by: Ben Meadors --- src/mesh/NodeDB.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index a90c271a6..3a05bbd93 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -439,7 +439,7 @@ uint32_t sinceLastSeen(const NodeInfo *n) return delta; } -#define NUM_ONLINE_SECS (60 & 60 * 2) // 2 hrs to consider someone offline +#define NUM_ONLINE_SECS (60 * 60 * 2) // 2 hrs to consider someone offline size_t NodeDB::getNumOnlineNodes() { From 223c706e91da12fb6e3acc4008f910b6a065a2aa Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Thu, 5 May 2022 13:54:21 -0500 Subject: [PATCH 6/9] Use meshtastic fork of arduino thread lib --- platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index 5671ab513..fbdf1e021 100644 --- a/platformio.ini +++ b/platformio.ini @@ -49,7 +49,7 @@ lib_deps = https://github.com/meshtastic/AXP202X_Library.git#8404abb6d4b486748636bc6ad72d2a47baaf5460 Wire ; explicitly needed here because the AXP202 library forgets to add it SPI - https://github.com/geeksville/ArduinoThread.git#72921ac222eed6f526ba1682023cee290d9aa1b3 + https://github.com/meshtastic/ArduinoThread.git#72921ac222eed6f526ba1682023cee290d9aa1b3 PubSubClient nanopb/Nanopb@^0.4.6 meshtastic/json11@^1.0.2 From 628740d6d13ef639ac42e802fbed713a02d9c5db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Fri, 6 May 2022 14:20:46 +0200 Subject: [PATCH 7/9] Support Buzzer in Slot C --- src/buzz/buzz.cpp | 4 ---- variants/rak4631/variant.h | 3 +++ 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/buzz/buzz.cpp b/src/buzz/buzz.cpp index a667df004..279c64842 100644 --- a/src/buzz/buzz.cpp +++ b/src/buzz/buzz.cpp @@ -1,10 +1,6 @@ #include "buzz.h" #include "configuration.h" -#ifdef NRF52_SERIES -#include "variant.h" -#endif - #ifndef PIN_BUZZER // Noop methods for boards w/o buzzer diff --git a/variants/rak4631/variant.h b/variants/rak4631/variant.h index bae5d957a..f1e144324 100644 --- a/variants/rak4631/variant.h +++ b/variants/rak4631/variant.h @@ -201,6 +201,9 @@ static const uint8_t SCK = PIN_SPI_SCK; // RAK12002 RTC Module #define RV3028_RTC (uint8_t) 0b1010010 +// RAK18001 Buzzer in Slot C +#define PIN_BUZZER 21 // IO3 is PWM2 + // Battery // The battery sense is hooked to pin A0 (5) #define BATTERY_PIN PIN_A0 From b5cc3043367028e327a2dfa637e43f8f326606b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Fri, 6 May 2022 15:41:37 +0200 Subject: [PATCH 8/9] Make #define NO_SCREEN work again --- src/graphics/Screen.cpp | 2 ++ src/graphics/Screen.h | 3 +++ src/mesh/http/ContentHandler.cpp | 2 ++ src/mesh/http/WebServer.cpp | 3 ++- src/modules/CannedMessageModule.cpp | 2 ++ src/modules/CannedMessageModule.h | 3 +++ src/modules/Modules.cpp | 2 ++ src/modules/Telemetry/EnvironmentTelemetry.h | 4 ++++ 8 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index 136964006..643c1c74e 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -20,6 +20,7 @@ along with this program. If not, see . */ #include "configuration.h" +#ifndef NO_SCREEN #include #include "GPS.h" @@ -1652,3 +1653,4 @@ int Screen::handleUIFrameEvent(const UIFrameEvent *event) } } // namespace graphics +#endif // NO_SCREEN \ No newline at end of file diff --git a/src/graphics/Screen.h b/src/graphics/Screen.h index 259598b80..6d9147e79 100644 --- a/src/graphics/Screen.h +++ b/src/graphics/Screen.h @@ -1,6 +1,7 @@ #pragma once #ifdef NO_SCREEN +#include "power.h" namespace graphics { // Noop class for boards without screen. @@ -15,6 +16,8 @@ class Screen void adjustBrightness(){} void doDeepSleep() {} void forceDisplay() {} + void startBluetoothPinScreen(uint32_t pin) {} + void stopBluetoothPinScreen() {} }; } diff --git a/src/mesh/http/ContentHandler.cpp b/src/mesh/http/ContentHandler.cpp index ba78b4ea5..1ce2c293d 100644 --- a/src/mesh/http/ContentHandler.cpp +++ b/src/mesh/http/ContentHandler.cpp @@ -798,7 +798,9 @@ void handleBlinkLED(HTTPRequest *req, HTTPResponse *res) count = count - 1; } } else { +#ifndef NO_SCREEN screen->blink(); +#endif } Json jsonObjOuter = Json::object{{"status", "ok"}}; diff --git a/src/mesh/http/WebServer.cpp b/src/mesh/http/WebServer.cpp index 1f376390b..271adc6c2 100644 --- a/src/mesh/http/WebServer.cpp +++ b/src/mesh/http/WebServer.cpp @@ -152,10 +152,11 @@ void createSSLCert() yield(); esp_task_wdt_reset(); - +#ifndef NO_SCREEN if (millis() / 1000 >= 3) { screen->setSSLFrames(); } +#endif } runLoop = false; } else { diff --git a/src/modules/CannedMessageModule.cpp b/src/modules/CannedMessageModule.cpp index aa52cf6cd..d526f5712 100644 --- a/src/modules/CannedMessageModule.cpp +++ b/src/modules/CannedMessageModule.cpp @@ -1,4 +1,5 @@ #include "configuration.h" +#ifndef NO_SCREEN #include "CannedMessageModule.h" #include "PowerFSM.h" // neede for button bypass #include "MeshService.h" @@ -548,3 +549,4 @@ void CannedMessageModule::handleSetCannedMessageModulePart4(const char *from_msg this->saveProtoForModule(); } } +#endif \ No newline at end of file diff --git a/src/modules/CannedMessageModule.h b/src/modules/CannedMessageModule.h index 9a755c54e..f393882d5 100644 --- a/src/modules/CannedMessageModule.h +++ b/src/modules/CannedMessageModule.h @@ -1,4 +1,6 @@ #pragma once +#ifdef NO_SCREEN +#else #include "ProtobufModule.h" #include "input/InputBroker.h" @@ -84,3 +86,4 @@ class CannedMessageModule : }; extern CannedMessageModule *cannedMessageModule; +#endif \ No newline at end of file diff --git a/src/modules/Modules.cpp b/src/modules/Modules.cpp index 0221418e6..2d308ca43 100644 --- a/src/modules/Modules.cpp +++ b/src/modules/Modules.cpp @@ -47,7 +47,9 @@ void setupModules() cardKbI2cImpl->init(); facesKbI2cImpl = new FacesKbI2cImpl(); facesKbI2cImpl->init(); +#ifndef NO_SCREEN cannedMessageModule = new CannedMessageModule(); +#endif #ifndef PORTDUINO new DeviceTelemetryModule(); new EnvironmentTelemetryModule(); diff --git a/src/modules/Telemetry/EnvironmentTelemetry.h b/src/modules/Telemetry/EnvironmentTelemetry.h index 48360312f..9f1551d92 100644 --- a/src/modules/Telemetry/EnvironmentTelemetry.h +++ b/src/modules/Telemetry/EnvironmentTelemetry.h @@ -15,7 +15,11 @@ class EnvironmentTelemetryModule : private concurrency::OSThread, public Protobu lastMeasurementPacket = nullptr; } virtual bool wantUIFrame() override; +#ifdef NO_SCREEN + void drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y); +#else virtual void drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) override; +#endif protected: /** Called to handle a particular incoming message From 4fb0cfa9099295994192cfdee538304d7cb2e029 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Fri, 6 May 2022 22:16:51 +0200 Subject: [PATCH 9/9] Enable Malloc Support in nanopb --- platformio.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/platformio.ini b/platformio.ini index fbdf1e021..84c0b56b4 100644 --- a/platformio.ini +++ b/platformio.ini @@ -35,6 +35,7 @@ build_flags = -Wno-missing-field-initializers -Isrc -Isrc/mesh -Isrc/gps -Isrc/buzz -Wl,-Map,.pio/build/output.map -DUSE_THREAD_NAMES -DTINYGPS_OPTION_NO_CUSTOM_FIELDS + -DPB_ENABLE_MALLOC=1 monitor_speed = 921600