From 10594d79e134255f747e2a420670fdd7c1e0f08b Mon Sep 17 00:00:00 2001 From: "Hansi, dl9rdz" Date: Sun, 15 Nov 2020 16:17:08 +0100 Subject: [PATCH] fix spectrum display for 1.3inch SH1106 LCD --- .travis/push.sh | 7 ++++++- RX_FSK/version.h | 2 +- libraries/SondeLib/Scanner.cpp | 31 ++++++++++++++++++++----------- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/.travis/push.sh b/.travis/push.sh index 8beba8f..39dde89 100755 --- a/.travis/push.sh +++ b/.travis/push.sh @@ -22,7 +22,11 @@ generate_website_index() { for i in `ls devel`; do TS=`git log devel/$i | grep "Date:" | head -1 | awk '{$1="";$2="";$7="";print substr($0,3,length($0)-3)}'` if [ -z "$TS" ]; then TS=`date`; fi - echo "
  • $i ($TS)
  • \n" >> download.html; + VERS=`basename $i -full.bin` + CL=`cat $VERS-changelog.txt 2>/dev/null` + echo "
  • $i ($TS)" >> download.html + if [ -n "${CL}" ]; then echo "
    ${CL}" >> download.html; fi + echo "
  • \n" >> download.html done echo "
    @@ -54,6 +58,7 @@ commit_website_files() { git add ${BRANCH}/${VERSION}-full.bin cp ${MYPATH}/build/RX_FSK.ino.bin ${BRANCH}/update.ino.bin git add ${BRANCH}/update.ino.bin + echo "${TRAVIS_COMMIT_MESSAGE}" > ${BRANCH}/${VERSION}-changelog.txt git commit --message "Travis build: $TRAVIS_BUILD_NUMBER" } upload_files() { diff --git a/RX_FSK/version.h b/RX_FSK/version.h index 5162342..4492835 100644 --- a/RX_FSK/version.h +++ b/RX_FSK/version.h @@ -1,4 +1,4 @@ const char *version_name = "rdzTTGOsonde"; -const char *version_id = "devel20201111b"; +const char *version_id = "devel20201115"; const int SPIFFS_MAJOR=2; const int SPIFFS_MINOR=4; diff --git a/libraries/SondeLib/Scanner.cpp b/libraries/SondeLib/Scanner.cpp index 3489e24..a289608 100644 --- a/libraries/SondeLib/Scanner.cpp +++ b/libraries/SondeLib/Scanner.cpp @@ -18,10 +18,12 @@ struct scancfg { int SMPL_PIX; // Frequency steps per pixel int NCHAN; // number of channels to scan, PLOT_W * SMPL_PIX int SMOOTH; + int ADDWAIT; }; -struct scancfg scanLCD={ 121, 7, 120/6, 120/6/4, 6000.0/120.0/10.0, 10, 120*10, 2 }; -struct scancfg scanTFT={ 210, 16, 210/6, 210/6/5, 6000.0/210.0/10.0, 10, 210*10, 1 }; +//struct scancfg scanLCD={ 121, 7, 120/6, 120/6/4, 6000.0/120.0/20.0, 20, 120*20, 1 }; +struct scancfg scanLCD={ 121, 7, 120/6, 120/6/4, 6000.0/120.0/10.0, 10, 120*10, 2, 40 }; +struct scancfg scanTFT={ 210, 16, 210/6, 210/6/5, 6000.0/210.0/10.0, 10, 210*10, 1, 0 }; struct scancfg &scanconfig = scanTFT; @@ -30,7 +32,8 @@ struct scancfg &scanconfig = scanTFT; //#define STARTF 401000000 // max of 120*5 and 210*3 -#define MAXN 210*10 +//#define MAXN 210*10 +#define MAXN 120*20 // max of 120 and 210 (ceil(210/8)*8)) #define MAXDISP 216 @@ -60,11 +63,14 @@ void Scanner::fillTiles(uint8_t *row, int value) { * Currently we use 210 * (6000/120)kHz channels, i.e. 28.5714kHz */ ///// unused???? uint8_t tiles[16] = { 0x0f,0x0f,0x0f,0x0f,0xf0,0xf0,0xf0,0xf0, 1, 3, 7, 15, 31, 63, 127, 255}; + +// type 0: lcd, 1: tft, 2: lcd(sh1106) +#define ISTFT (sonde.config.disptype==1) void Scanner::plotResult() { int yofs = 0; char buf[30]; - if(sonde.config.disptype != 0) { + if(ISTFT) { yofs = 2; if (sonde.config.marker != 0) { itoa((sonde.config.startfreq), buf, 10); @@ -92,14 +98,14 @@ void Scanner::plotResult() if( ((i+j)%scanconfig.TICK2)==0) { row[j] |= 0x01; } } for(int y=0; y=7*8&&i<10*8) || i>=13*8) continue; } disp.rdis->drawTile(i/8, y+yofs, 1, row+8*y); } } - if(sonde.config.disptype != 0) { // large TFT + if(ISTFT) { // large TFT sprintf(buf, "Peak: %03.3f MHz", peakf*0.000001); disp.rdis->drawString(0, (yofs+scanconfig.PLOT_H8+1)*8, buf); } else { @@ -110,7 +116,7 @@ void Scanner::plotResult() void Scanner::scan() { - if(sonde.config.disptype==0) { // LCD small + if(!ISTFT) { // LCD small scanconfig = scanLCD; } else { scanconfig = scanTFT; @@ -129,8 +135,9 @@ void Scanner::scan() unsigned long start = millis(); uint32_t lastfrf= STARTF * (1<<19) / SX127X_CRYSTAL_FREQ; float freq = STARTF; - int wait = 20 + 1000*(1<<(scanconfig.SMOOTH+1))/4/(0.001*CHANBW); - for(int iter=0; iter<3; iter++) { // two interations, to catch all RS41 transmissions + int wait = scanconfig.ADDWAIT + 20 + 1000*(1<<(scanconfig.SMOOTH+1))/4/(0.001*CHANBW); + Serial.print("wait time (us) is: "); Serial.println(wait); + for(int iter=0; iter<3; iter++) { // three interations, to catch all RS41 transmissions delayMicroseconds(20000); for(int i=0; ipeakres+1) { peakres=r; peakidx=i*scanconfig.SMPL_PIX; } + scandisp[i] = r; for(int j=1; jpeakres+1) { peakres=r; peakidx=i*scanconfig.SMPL_PIX+j; } }