From 170e7cb2f218f7d4232d90d70503119e20c764bd Mon Sep 17 00:00:00 2001
From: "Hans P. Reiser"
Date: Sun, 28 Apr 2019 16:49:40 +0200
Subject: [PATCH] v0.5b: fixed memory leak; initial travis ci support
---
.travis.yml | 30 ++++++++++++++++++++++++++++++
RX_FSK/RX_FSK.ino | 5 +++--
RX_FSK/version.h | 2 +-
libraries/SX1278FSK/SX1278FSK.h | 6 +++---
libraries/SondeLib/DFM.cpp | 2 +-
libraries/SondeLib/DFM.h | 2 +-
libraries/SondeLib/RS41.cpp | 7 +++++--
libraries/SondeLib/RS41.h | 1 +
libraries/SondeLib/aprs.cpp | 2 +-
libraries/SondeLib/aprs.h | 2 +-
10 files changed, 47 insertions(+), 12 deletions(-)
create mode 100644 .travis.yml
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..48a35af
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,30 @@
+language: c
+before_install:
+ - "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_1.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :1 -ac -screen 0 1280x1024x16"
+ - sleep 3
+ - export DISPLAY=:1.0
+ - wget https://downloads.arduino.cc/arduino-1.8.9-linux64.tar.xz
+ - tar xf arduino-1.8.9-linux64.tar.xz
+ - sudo mv arduino-1.8.9 /usr/local/share/arduino
+ - sudo ln -s /usr/local/share/arduino/arduino /usr/local/bin/arduino
+ - wget https://github.com/me-no-dev/ESPAsyncWebServer/archive/master.zip
+ - unzip master.zip
+ - sudo mv ESPAsyncWebServer-master /usr/local/share/arduino/libraries/ESPAsyncWebServer
+ - rm master.zip
+ - wget https://github.com/me-no-dev/AsyncTCP/archive/master.zip
+ - unzip master.zip
+ - sudo mv AsyncTCP-master /usr/local/share/arduino/libraries/AsyncTCP
+
+install:
+ - arduino --pref "boardsmanager.additional.urls=https://dl.espressif.com/dl/package_esp32_index.json" --save-prefs
+ - arduino --pref "custom_FlashFreq=ttgo-lora32-v1_80" --save-prefs
+ - arduino --install-boards esp32:esp32 --save-prefs
+ - ln -s $PWD/libraries/SondeLib /usr/local/share/arduino/libraries/SondeLib
+ - ln -s $PWD/libraries/SX1278FSK /usr/local/share/arduino/libraries/SX1278FSK
+ - arduino --install-library "U8g2"
+script:
+ - arduino --board esp32:esp32:ttgo-lora32-v1 --verify $PWD/RX_FSK/RX_FSK.ino
+notifications:
+ email:
+ on_success: change
+ on_failure: change
diff --git a/RX_FSK/RX_FSK.ino b/RX_FSK/RX_FSK.ino
index 741c08d..8d87fcb 100644
--- a/RX_FSK/RX_FSK.ino
+++ b/RX_FSK/RX_FSK.ino
@@ -1002,7 +1002,7 @@ void initialMode() {
// 2: access point mode in background. directly start initial mode (spectrum or scanner)
// 3: traditional sync. WifiScan. Tries to connect to a network, in case of failure activates AP.
// Mode 3 shows more debug information on serial port and display.
-static char* _scan[2] = {"/", "\\"};
+static const char* _scan[2] = {"/", "\\"};
void loopWifiScan() {
if (sonde.config.wifi == 0) { // no Wifi
wifi_state = WIFI_DISABLED;
@@ -1102,7 +1102,8 @@ void loopWifiScan() {
}
void loop() {
- Serial.println("Running main loop");
+ Serial.print("Running main loop. free heap:");
+ Serial.println(ESP.getFreeHeap());
switch (mainState) {
case ST_DECODER: loopDecoder(); break;
case ST_SCANNER: loopScanner(); break;
diff --git a/RX_FSK/version.h b/RX_FSK/version.h
index a2d4c4f..c4ce311 100644
--- a/RX_FSK/version.h
+++ b/RX_FSK/version.h
@@ -1,2 +1,2 @@
const char *version_name = "RDZ_TTGO_SONDE";
-const char *version_id = "master v0.5";
+const char *version_id = "master v0.5b";
diff --git a/libraries/SX1278FSK/SX1278FSK.h b/libraries/SX1278FSK/SX1278FSK.h
index 2f2af07..16d8dcb 100644
--- a/libraries/SX1278FSK/SX1278FSK.h
+++ b/libraries/SX1278FSK/SX1278FSK.h
@@ -108,11 +108,11 @@
#define REG_MODEM_CONFIG3 0x26
#define REG_SYNC_CONFIG 0x27
#define REG_SYNC_VALUE1 0x28
-#define REG_FEI_MSB 0x28
+#define REG_LORA_FEI_MSB 0x28
#define REG_SYNC_VALUE2 0x29
-#define REG_FEI_MID 0x29
+#define REG_LORA_FEI_MID 0x29
#define REG_SYNC_VALUE3 0x2A
-#define REG_FEI_LSB 0x2A
+#define REG_LORA_FEI_LSB 0x2A
#define REG_SYNC_VALUE4 0x2B
#define REG_SYNC_VALUE5 0x2C
#define REG_RSSI_WIDEBAND 0x2C
diff --git a/libraries/SondeLib/DFM.cpp b/libraries/SondeLib/DFM.cpp
index 757cdbf..f1e58e7 100644
--- a/libraries/SondeLib/DFM.cpp
+++ b/libraries/SondeLib/DFM.cpp
@@ -147,7 +147,7 @@ int DFM::hamming(uint8_t *ham, int L, uint8_t *sym) {
DFM::DFM() {
}
-void DFM::printRaw(char *label, int len, int ret, uint8_t *data)
+void DFM::printRaw(const char *label, int len, int ret, const uint8_t *data)
{
Serial.print(label); Serial.print("(");
Serial.print(ret);
diff --git a/libraries/SondeLib/DFM.h b/libraries/SondeLib/DFM.h
index 902555f..1b6c937 100644
--- a/libraries/SondeLib/DFM.h
+++ b/libraries/SondeLib/DFM.h
@@ -27,7 +27,7 @@ private:
uint32_t bits2val(const uint8_t *bits, int len);
int check(uint8_t code[8]);
int hamming(uint8_t *ham, int L, uint8_t *sym);
- void printRaw(char *prefix, int len, int ret, uint8_t* data);
+ void printRaw(const char *prefix, int len, int ret, const uint8_t* data);
int decodeCFG(uint8_t *cfg);
int decodeDAT(uint8_t *dat);
int bitsToBytes(uint8_t *bits, uint8_t *bytes, int len);
diff --git a/libraries/SondeLib/RS41.cpp b/libraries/SondeLib/RS41.cpp
index 29909ff..586698a 100644
--- a/libraries/SondeLib/RS41.cpp
+++ b/libraries/SondeLib/RS41.cpp
@@ -74,8 +74,11 @@ int RS41::setup()
#if RS41_DEBUG
Serial.println("Setup sx1278 for RS41 sonde");
#endif
- Gencrctab();
- initrsc();
+ if(!initialized) {
+ Gencrctab();
+ initrsc();
+ initialized = true;
+ }
if(sx1278.ON()!=0) {
RS41_DBG(Serial.println("Setting SX1278 power on FAILED"));
diff --git a/libraries/SondeLib/RS41.h b/libraries/SondeLib/RS41.h
index b7b1aca..41d9f92 100644
--- a/libraries/SondeLib/RS41.h
+++ b/libraries/SondeLib/RS41.h
@@ -42,6 +42,7 @@ private:
{ 1, 1, 1, 0, 0, 0, 0, 1}};
uint8_t He[8] = { 0x7, 0xB, 0xD, 0xE, 0x8, 0x4, 0x2, 0x1}; // Spalten von H:
// 1-bit-error-Syndrome
+ boolean initialized = false;
public:
RS41();
diff --git a/libraries/SondeLib/aprs.cpp b/libraries/SondeLib/aprs.cpp
index d53e3e6..447a437 100644
--- a/libraries/SondeLib/aprs.cpp
+++ b/libraries/SondeLib/aprs.cpp
@@ -9,7 +9,7 @@
#include
#include
-#include ;
+#include
//#include
//#include
#include
diff --git a/libraries/SondeLib/aprs.h b/libraries/SondeLib/aprs.h
index fe3517e..2c14db7 100644
--- a/libraries/SondeLib/aprs.h
+++ b/libraries/SondeLib/aprs.h
@@ -4,7 +4,7 @@
enum IDTYPE { ID_DFMDXL, ID_DFMGRAW, ID_DFMAUTO };
-typedef struct st_feedinfo {
+struct st_feedinfo {
bool active;
int type; // 0:UDP(axudp), 1:TCP(aprs.fi)
char host[64];