From 25ea6876cf7b7fafb68946fd1de87896a2fd3444 Mon Sep 17 00:00:00 2001 From: "Hansi, dl9rdz" Date: Sun, 9 Feb 2020 21:29:41 +0100 Subject: [PATCH] enable/disable norx_timeout via config.txt --- RX_FSK/RX_FSK.ino | 4 +--- RX_FSK/data/config.txt | 6 ++++-- RX_FSK/data/screens.txt | 26 +++++++++++++------------- RX_FSK/version.h | 4 ++-- libraries/SondeLib/Display.cpp | 7 ++++++- libraries/SondeLib/Sonde.cpp | 5 ++++- 6 files changed, 30 insertions(+), 22 deletions(-) diff --git a/RX_FSK/RX_FSK.ino b/RX_FSK/RX_FSK.ino index 60be6de..6773195 100644 --- a/RX_FSK/RX_FSK.ino +++ b/RX_FSK/RX_FSK.ino @@ -22,9 +22,6 @@ #include "geteph.h" #include "rs92gps.h" -#define DISABLE_SX1278 -#define DISABLE_MAINRX - int e; enum MainState { ST_DECODER, ST_SPECTRUM, ST_WIFISCAN, ST_UPDATE, ST_TOUCHCALIB }; @@ -455,6 +452,7 @@ struct st_configitems config_list[] = { /* Hardware dependeing settings */ {"", "Hardware configuration (requires reboot)", -5, NULL}, {"disptype", "Display type (0=OLED/SSD1306, 1=TFT/ILI9225, 2=OLED/SH1106)", 0, &sonde.config.disptype}, + {"norx_timeout", "No-RX-Timeout (-1=disabled)", 0, &sonde.config.norx_timeout}, {"oled_sda", "OLED SDA/TFT SDA", 0, &sonde.config.oled_sda}, {"oled_scl", "OLED SCL/TFT CLK", 0, &sonde.config.oled_scl}, {"oled_rst", "OLED RST/TFT RST (needs reboot)", 0, &sonde.config.oled_rst}, diff --git a/RX_FSK/data/config.txt b/RX_FSK/data/config.txt index 850aa8d..f2976b0 100644 --- a/RX_FSK/data/config.txt +++ b/RX_FSK/data/config.txt @@ -9,7 +9,7 @@ #button2_pin=255 #button2_axp=0 # LED port -led_pout=9 +#led_pout=-1 # OLED Setup is depending on hardware of LoRa board # TTGO v1: SDA=4 SCL=15, RST=16 # TTGO v2: SDA=21 SCL=22, RST=16 @@ -46,12 +46,14 @@ kisstnc.active = 1 # second entry: default "Receiver" display # additional entries: alternative receiver display, activated by button display=0,1,2,3,4 +# set to -1 to disable (used for "N" values in timers in screens.txt) +norx_timeout=20 #-------------------------------# # Spectrum display settings #-------------------------------# startfreq=400 channelbw=10 -spectrum=10 +spectrum=-1 #10 noisefloor=-125 marker=1 #-------------------------------# diff --git a/RX_FSK/data/screens.txt b/RX_FSK/data/screens.txt index 3c2d527..dd74b29 100644 --- a/RX_FSK/data/screens.txt +++ b/RX_FSK/data/screens.txt @@ -127,7 +127,7 @@ timeaction=#,D,+ # (norx timer: if no signal for >20 seconds: go back to scanner mode) # @Legacy -timer=-1,-1,20000 +timer=-1,-1,N key1action=+,0,F,W key2action=>,#,#,# timeaction=#,#,0 @@ -147,7 +147,7 @@ timeaction=#,#,0 # Configuratoon for "Field" display (display 2) # similar to @Legacy, but no norx timer, and Key2 goes to display 4 @Field -timer=-1,-1,-1 +timer=-1,-1,N key1action=+,0,F,W key2action=>,#,#,# timeaction=#,#,# @@ -163,7 +163,7 @@ timeaction=#,#,# # Configuration for "Field2" display (display 3) # similar to @Field @Field2 -timer=-1,-1,-1 +timer=-1,-1,N key1action=+,0,F,W key2action=>,#,#,# timeaction=#,#,# @@ -218,7 +218,7 @@ fonts=5,6 ############ @MainTFT -timer=-1,-1,20000 +timer=-1,-1,N key1action=+,0,F,W key2action=>,#,#,# timeaction=#,#,0 @@ -244,7 +244,7 @@ color=FFFFFF ############ @PeilungTFT -timer=-1,-1,20000 +timer=-1,-1,N key1action=+,0,F,W key2action=>,#,#,# timeaction=#,#,# @@ -266,7 +266,7 @@ color=ffffff,000000 ############ @GPSdataTFT -timer=-1,-1,20000 +timer=-1,-1,N key1action=+,0,F,W key2action=>,#,#,# timeaction=#,#,# @@ -282,7 +282,7 @@ timeaction=#,#,# ############ @BatteryTFT -timer=-1,-1,20000 +timer=-1,-1,-1 key1action=+,0,F,W key2action=>,#,#,# timeaction=#,#,# @@ -300,7 +300,7 @@ timeaction=#,#,# ############ @BatteryOLED -timer=-1,-1,20000 +timer=-1,-1,-1 key1action=+,0,F,W key2action=>,#,#,# timeaction=#,#,# @@ -350,10 +350,10 @@ color=6C757D ############ @Decode/General.TFT.Bazjo -timer=-1,-1,20000 +timer=-1,-1,N key1action=+,0,F,W key2action=>,#,#,# -timeaction=#,#,# +timeaction=#,#,0 scale=11,10 fonts=0,2 #Row 1 @@ -387,9 +387,9 @@ color=639AFF 7,11=Vm/s #Row 4 color=99004A -9,0=xDistance +9,0=xAltitude color=FF007B -10,0=GD +10,0=A color=99004A 9,11=xBearing color=FF007B @@ -411,7 +411,7 @@ color=6C757D ############ @Decode/Battery.TFT.Bazjo -timer=-1,-1,20000 +timer=-1,-1,N key1action=+,0,F,W key2action=>,#,#,# timeaction=#,#,# diff --git a/RX_FSK/version.h b/RX_FSK/version.h index 500a41b..ad62da7 100644 --- a/RX_FSK/version.h +++ b/RX_FSK/version.h @@ -1,4 +1,4 @@ const char *version_name = "rdzTTGOsonde"; -const char *version_id = "devel20200131"; +const char *version_id = "devel20200209"; const int SPIFFS_MAJOR=2; -const int SPIFFS_MINOR=3; +const int SPIFFS_MINOR=4; diff --git a/libraries/SondeLib/Display.cpp b/libraries/SondeLib/Display.cpp index 1a6b14f..44937ae 100644 --- a/libraries/SondeLib/Display.cpp +++ b/libraries/SondeLib/Display.cpp @@ -832,7 +832,12 @@ void Display::initFromFile() { break; default: // parse content... (additional data or line `what`) if(strncmp(s,"timer=",6)==0) { // timer values - sscanf(s+6, "%hd,%hd,%hd", newlayouts[idx].timeouts, newlayouts[idx].timeouts+1, newlayouts[idx].timeouts+2); + char t1[10],t2[10],t3[10]; + sscanf(s+6, "%5[0-9a-zA-Z-] , %5[0-9a-zA-Z-] , %5[0-9a-zA-Z-]", t1, t2, t3); + newlayouts[idx].timeouts[0] = (*t1=='n'||*t1=='N')?sonde.config.norx_timeout:atoi(t1); + newlayouts[idx].timeouts[1] = (*t2=='n'||*t1=='N')?sonde.config.norx_timeout:atoi(t2); + newlayouts[idx].timeouts[2] = (*t3=='n'||*t1=='N')?sonde.config.norx_timeout:atoi(t3); + //sscanf(s+6, "%hd,%hd,%hd", newlayouts[idx].timeouts, newlayouts[idx].timeouts+1, newlayouts[idx].timeouts+2); Serial.printf("timer values: %d, %d, %d\n", newlayouts[idx].timeouts[0], newlayouts[idx].timeouts[1], newlayouts[idx].timeouts[2]); } else if(strncmp(s, "key1action=",11)==0) { // key 1 actions char c1,c2,c3,c4; diff --git a/libraries/SondeLib/Sonde.cpp b/libraries/SondeLib/Sonde.cpp index 5a5ab0f..55bca2f 100644 --- a/libraries/SondeLib/Sonde.cpp +++ b/libraries/SondeLib/Sonde.cpp @@ -68,7 +68,7 @@ void Sonde::defaultConfig() { sondeList = (SondeInfo *)malloc((MAXSONDE+1)*sizeof(SondeInfo)); memset(sondeList, 0, (MAXSONDE+1)*sizeof(SondeInfo)); config.touch_thresh = 70; - config.led_pout = 9; + config.led_pout = -1; config.power_pout = -1; config.spectrum=10; // Try autodetecting board type @@ -79,6 +79,7 @@ void Sonde::defaultConfig() { config.disptype = 0; config.tft_orient = 1; config.button2_axp = 0; + config.norx_timeout = 20; if(initlevels[16]==0) { config.oled_sda = 4; config.oled_scl = 15; @@ -256,6 +257,8 @@ void Sonde::setConfig(const char *cfg) { Serial.printf("appending value %d next is %s\n", config.display[i-1], val?val:""); } config.display[i] = -1; + } else if (strcmp(cfg, "norx_timeout")==0) { + config.norx_timeout = atoi(val); } else if(strcmp(cfg,"startfreq")==0) { config.startfreq = atoi(val); } else if(strcmp(cfg,"channelbw")==0) {