From 0cc3f1af6ee1b721d1f4ce2353daaa242d8b9da3 Mon Sep 17 00:00:00 2001 From: dl9rdz Date: Wed, 16 Oct 2019 23:19:06 +0200 Subject: [PATCH 1/4] Update Setup.md --- Setup.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Setup.md b/Setup.md index 84d234a..58fd357 100644 --- a/Setup.md +++ b/Setup.md @@ -34,7 +34,8 @@ Select Tools -> Library Manager Install "U8g2" Install "MicroNMEA" -Install "TFT_22_ILI9225" + +(Install "TFT_22_ILI9225" -- currently not needed, due to some issues with the official library, there is a modified version in the rdz_ttgo_sonde source tree) ## Additional libraries, part 2 @@ -45,6 +46,9 @@ folder of your Arduino IDE (~/Documents/Arduino/libraries on MacOS), rename main From https://github.com/me-no-dev/AsyncTCP select "Download ZIP", extract to the libraries folder of your Arduino IDE, and rename main folder to AsyncTCP +From https://github.com/lewisxhe/AXP202X_Library select "Download ZIP", extract to the libraries +folder of your Arduino IDE, and rename main folder to AXP202X_Library-1.0 + ## Additional libraries, part 3 Copy the libraries/SX1278FSK and libraries/SondeLib folder of this project to your Arduino IDE's libraries @@ -64,7 +68,8 @@ each update) ## Final steps In the IDE Tools -> Board: -> -Select "TTGO LoRa32-OLED v1" +Select "TTGO LoRa32-OLED v1" (or something that fits your board. +The binary images are currently built with the "T-Beam" board selection) Compile and Upload code From 0ba9d2cd6b7647781ff92ee282f58fedbcfac224 Mon Sep 17 00:00:00 2001 From: Mat Burnham Date: Tue, 2 Jun 2020 07:39:16 +0100 Subject: [PATCH 2/4] Pedantic fix to naming of Manage Libraries menu --- Setup.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Setup.md b/Setup.md index 58fd357..58dac70 100644 --- a/Setup.md +++ b/Setup.md @@ -29,7 +29,7 @@ similar on other OS) and restart IDE ## Additional libraries -Select Tools -> Library Manager +Select Tools -> Manage Libraries... Install "U8g2" From 12c0e1b4aed5013992c45f008bbbd51073dfe2eb Mon Sep 17 00:00:00 2001 From: Mat Burnham Date: Tue, 2 Jun 2020 07:57:57 +0100 Subject: [PATCH 3/4] Add need to copy/link fonts libraries --- Setup.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Setup.md b/Setup.md index 58dac70..f2b6595 100644 --- a/Setup.md +++ b/Setup.md @@ -51,13 +51,14 @@ folder of your Arduino IDE, and rename main folder to AXP202X_Library-1.0 ## Additional libraries, part 3 -Copy the libraries/SX1278FSK and libraries/SondeLib folder of this project to your Arduino IDE's libraries +Copy the SX1278FSK, SondeLib and fonts folders from libraries of this project to your Arduino IDE's libraries folders, or, alternatively, create symbolic links (MacOS/Linux): ``` cd ~/Documents/Arduino/libraries ln -s /rdz_ttgo_sonde/libraries/SondeLib/ . ln -s /rdz_ttgo_sonde/libraries/SX1278FSK/ . +ln -s /rdz_ttgo_sonde/libraries/fonts/ . ``` Restart the Arduino IDE From 7e817f303bfe2d6f6ef3638d60b80e3990e1cd36 Mon Sep 17 00:00:00 2001 From: "Hansi, dl9rdz" Date: Wed, 11 Nov 2020 08:43:10 +0100 Subject: [PATCH 4/4] Finally, a new master version v0.8 with a lots of changes in the devel version over several months, including (probably incomplete list) - spectrum from large TFT - bug fixes by cixio - use PWR button as button2 on T-Beam 1.0 - additional display variants - possibility to show kill timer values - battery information display - simple gpx export - internal button pullup; touch calibration mode - flip oled support - circle diagram (on tft) - better support for Heltec v2 board and T-Beam 1.0 --- .travis.yml | 3 +- .travis/push.sh | 15 +- Licenses/Exceptions | 5 + RX_FSK/RX_FSK.ino | 731 ++++++++++++----- RX_FSK/data/config.txt | 20 +- RX_FSK/data/index.html | 10 +- RX_FSK/data/screens.txt | 356 +++++++- RX_FSK/data/style.css | 6 + RX_FSK/version.h | 4 +- libraries/SX1278FSK/SX1278FSK.cpp | 5 +- libraries/SondeLib/DFM.cpp | 26 +- libraries/SondeLib/Display.cpp | 1134 ++++++++++++++++++++------ libraries/SondeLib/Display.h | 105 ++- libraries/SondeLib/M10.cpp | 529 ++++++++++++ libraries/SondeLib/M10.h | 96 +++ libraries/SondeLib/RS41.cpp | 61 +- libraries/SondeLib/RS92.cpp | 7 + libraries/SondeLib/Scanner.cpp | 159 +++- libraries/SondeLib/Sonde.cpp | 210 ++++- libraries/SondeLib/Sonde.h | 132 ++- libraries/SondeLib/TFT22_ILI9225.cpp | 35 +- libraries/SondeLib/TFT22_ILI9225.h | 4 +- libraries/SondeLib/aprs.cpp | 50 +- libraries/SondeLib/aprs.h | 24 +- libraries/SondeLib/autodetect-infos | 26 +- libraries/SondeLib/nav_gps_vel.cpp | 7 +- libraries/SondeLib/rs92gps.cpp | 6 +- libraries/SondeLib/rs92gps.h | 1 + libraries/fonts/FreeMono12pt7b.h | 227 ++++++ libraries/fonts/FreeMono9pt7b.h | 176 ++++ libraries/fonts/Picopixel.h | 123 +++ scripts/makeimage.py | 46 +- 32 files changed, 3639 insertions(+), 700 deletions(-) create mode 100644 libraries/SondeLib/M10.cpp create mode 100644 libraries/SondeLib/M10.h create mode 100644 libraries/fonts/FreeMono12pt7b.h create mode 100644 libraries/fonts/FreeMono9pt7b.h create mode 100644 libraries/fonts/Picopixel.h diff --git a/.travis.yml b/.travis.yml index d7ce010..b9fe29b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -47,8 +47,7 @@ script: - arduino --board esp32:esp32:t-beam --verify $PWD/RX_FSK/RX_FSK.ino - find build - find /home/travis/.arduino15/packages/esp32/hardware/esp32/ - - $MKSPIFFS -c $PWD/RX_FSK/data -b 4096 -p 256 -s 1503232 $PWD/spiffs.bin - - $PWD/scripts/makeimage.py $ESP32TOOLS $PWD/build/RX_FSK.ino.bin $PWD/spiffs.bin $PWD/out.bin + - $PWD/scripts/makeimage.py $ESP32TOOLS $PWD/build/RX_FSK.ino.bin $PWD/RX_FSK/data $PWD/out.bin after_success: - .travis/push.sh notifications: diff --git a/.travis/push.sh b/.travis/push.sh index 754ab2c..8beba8f 100755 --- a/.travis/push.sh +++ b/.travis/push.sh @@ -24,13 +24,24 @@ generate_website_index() { if [ -z "$TS" ]; then TS=`date`; fi echo "
  • $i ($TS)
  • \n" >> download.html; done - echo "" >> download.html + echo " +
    +

    Last latter/number of version number indicate SPIFFS file system version. If the first (upper-case) + letter has changed, then this version is incompabible with prevision versions and you have to flash + the full image. If the second part (number) has changed, then this version has some changes + (e.g. internal web page layout, LCD/TFT display layout) in the file system which you will not get with + a code-only (OTA or flashing update.bin) update, but it should not break anything.

    + " >> download.html git add download.html git commit --amend --message "Travis build: $TRAVIS_BUILD_NUMBER" } commit_website_files() { BRANCH=$TRAVIS_BRANCH - VERSION=`cat RX_FSK/version.h | tail -1 | egrep -o '".*"' | sed 's/"//g' | sed 's/ /_/g'` + VERSION=`cat RX_FSK/version.h | grep version_id | egrep -o '".*"' | sed 's/"//g' | sed 's/ /_/g'` + FSMAJOR=`cat RX_FSK/version.h | grep SPIFFS_MAJOR | perl -e '$_=<>;print /=(.*);/?chr($1+64):""'` + FSMINOR=`cat RX_FSK/version.h | grep SPIFFS_MINOR | perl -e '$_=<>;print /=(.*);/?$1:""'` + VERSION=$VERSION-$FSMAJOR$FSMINOR + MYPATH=$PWD echo "On branch $BRANCH" echo "Version $VERSION" diff --git a/Licenses/Exceptions b/Licenses/Exceptions index 6f8843e..f35cddb 100644 --- a/Licenses/Exceptions +++ b/Licenses/Exceptions @@ -4,3 +4,8 @@ GPL License Exceptions: https://github.com/pdelmo/lora_shield_arduino.git and licensed under GNU Lesser General Public License, version 2.1 (SPDX short identifier: LGPL-2.1) + +- Leaflet sidebar v2 plugin is (c) 2013 Tobias Bieniek based on + https://github.com/Turbo87/sidebar-v2/ + and licensed under + MIT License diff --git a/RX_FSK/RX_FSK.ino b/RX_FSK/RX_FSK.ino index 7570b4a..492ec50 100644 --- a/RX_FSK/RX_FSK.ino +++ b/RX_FSK/RX_FSK.ino @@ -3,6 +3,7 @@ #include #include #include + #include //#include //#include @@ -21,16 +22,18 @@ #include "geteph.h" #include "rs92gps.h" -int LORA_LED = 9; // default POUT for LORA LED used as serial monitor int e; -enum MainState { ST_DECODER, ST_SPECTRUM, ST_WIFISCAN, ST_UPDATE }; +enum MainState { ST_DECODER, ST_SPECTRUM, ST_WIFISCAN, ST_UPDATE, ST_TOUCHCALIB }; static MainState mainState = ST_WIFISCAN; // ST_WIFISCAN; AsyncWebServer server(80); +AsyncWebSocket ws("/ws"); + AXP20X_Class axp; #define PMU_IRQ 35 - +SemaphoreHandle_t axpSemaphore; +bool pmu_irq = false; String updateHost = "rdzsonde.mooo.com"; int updatePort = 80; @@ -48,6 +51,8 @@ WiFiClient client; WiFiServer tncserver(14580); WiFiClient tncclient; +boolean forceReloadScreenConfig = false; + enum KeyPress { KP_NONE = 0, KP_SHORT, KP_DOUBLE, KP_MID, KP_LONG }; // "doublepress" is now also used to eliminate key glitch on TTGO T-Beam startup (SENSOR_VN/GPIO39) @@ -66,39 +71,56 @@ Button button2 = {0, 0, KP_NONE, 0, -1, false}; static int lastDisplay = 1; static int currentDisplay = 1; -// Set LED GPIO -int ledPin = 1; -// Stores LED state -String ledState; - // timestamp when spectrum display was activated static unsigned long specTimer; +// Read line from file, independent of line termination (LF or CR LF) +String readLine(Stream &stream) { + String s = stream.readStringUntil('\n'); + int len = s.length(); + if (len == 0) return s; + if (s.charAt(len - 1) == '\r') s.remove(len - 1); + return s; +} + +// Read line from file, without using dynamic memory allocation (String class) +// returns length line. +int readLine(Stream &stream, char *buffer, int maxlen) { + int n = stream.readBytesUntil('\n', buffer, maxlen); + buffer[n] = 0; + if(n <= 0) return 0; + if(buffer[n-1]=='\r') { buffer[n-1]=0; n--; } + return n; +} + // Replaces placeholder with LED state value String processor(const String& var) { Serial.println(var); - if (var == "STATE") { - if (digitalRead(ledPin)) { - ledState = "ON"; - } - else { - ledState = "OFF"; - } - Serial.print(ledState); - return ledState; - } if (var == "VERSION_NAME") { return String(version_name); } if (var == "VERSION_ID") { return String(version_id); } + if (var == "AUTODETECT_INFO") { + char tmpstr[128]; + const char *fpstr; + int i = 0; + while (fingerprintValue[i] != sonde.fingerprint && fingerprintValue[i] != -1) i++; + if (fingerprintValue[i] == -1) { + fpstr = "Unknown board"; + } else { + fpstr = fingerprintText[i]; + } + snprintf(tmpstr, 128, "Fingerprint %d (%s)", sonde.fingerprint, fpstr); + return String(tmpstr); + } return String(); } const String sondeTypeSelect(int activeType) { String sts = ""; - for (int i = 0; i < 4; i++) { + for (int i = 0; i < NSondeTypes; i++) { sts += "