diff --git a/.travis.yml b/.travis.yml index 43b04bf..573c0d4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,9 +7,9 @@ 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.13-linux64.tar.xz - - tar xf arduino-1.8.13-linux64.tar.xz - - sudo mv arduino-1.8.13 /usr/local/share/arduino + - wget https://downloads.arduino.cc/arduino-1.8.16-linux64.tar.xz + - tar xf arduino-1.8.16-linux64.tar.xz + - sudo mv arduino-1.8.16 /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 @@ -40,7 +40,7 @@ before_install: - sudo iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT install: - - arduino --pref "boardsmanager.additional.urls=https://dl.espressif.com/dl/package_esp32_index.json" --save-prefs + - arduino --pref "boardsmanager.additional.urls=https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json" --save-prefs - arduino --pref "build.verbose=true" --save-prefs - arduino --pref "custom_FlashFreq=ttgo-lora32-v1_80" --save-prefs - mkdir -p $PWD/build diff --git a/RX_FSK/RX_FSK.ino b/RX_FSK/RX_FSK.ino index a1f8dc1..6d5435b 100644 --- a/RX_FSK/RX_FSK.ino +++ b/RX_FSK/RX_FSK.ino @@ -1,32 +1,32 @@ -#include #include "features.h" +#include "version.h" +#include "axp20x.h" #include #include #include #include -//#include -//#include #include #include #include #include #include -#include -#include -#include -#include -#include -#include "version.h" -#include "geteph.h" -#include "rs92gps.h" -#if FEATURE_MQTT -#include "mqtt.h" -#endif #include "esp_heap_caps.h" + +#include "src/SX1278FSK.h" +#include "src/Sonde.h" +#include "src/Display.h" +#include "src/Scanner.h" +#include "src/geteph.h" +#include "src/rs92gps.h" +#include "src/aprs.h" +#if FEATURE_MQTT +#include "src/mqtt.h" +#endif + //#define ESP_MEM_DEBUG 1 -int e; +//int e; enum MainState { ST_DECODER, ST_SPECTRUM, ST_WIFISCAN, ST_UPDATE, ST_TOUCHCALIB }; static MainState mainState = ST_WIFISCAN; // ST_WIFISCAN; @@ -467,7 +467,7 @@ void addSondeStatus(char *ptr, int i) sprintf(ptr + strlen(ptr), "QTH: %.6f,%.6f h=%.0fm\n", s->lat, s->lon, s->alt); const time_t t = s->time; ts = *gmtime(&t); - sprintf(ptr + strlen(ptr), "Frame# %d, Sats=%d, %04d-%02d-%02d %02d:%02d:%02d", + sprintf(ptr + strlen(ptr), "Frame# %u, Sats=%d, %04d-%02d-%02d %02d:%02d:%02d", s->frame, s->sats, ts.tm_year + 1900, ts.tm_mon + 1, ts.tm_mday, ts.tm_hour, ts.tm_min, ts.tm_sec); if (s->type == STYPE_RS41) { sprintf(ptr + strlen(ptr), "Burst-KT=%d Launch-KT=%d Countdown=%d (vor %ds)\n", @@ -547,13 +547,6 @@ void setupConfigData() { } -struct st_configitems { - const char *name; - const char *label; - int type; // 0: numeric; i>0 string of length i; -1: separator; -2: type selector - void *data; -}; - struct st_configitems config_list[] = { /* General config settings */ {"", "Software configuration", -5, NULL}, @@ -585,7 +578,7 @@ struct st_configitems config_list[] = { {"", "Data feed configuration", -5, NULL}, /* APRS settings */ {"call", "Call", 8, sonde.config.call}, - {"passcode", "Passcode", 8, sonde.config.passcode}, + {"passcode", "Passcode", 0, &sonde.config.passcode}, /* KISS tnc settings */ {"kisstnc.active", "KISS TNC (port 14590) (needs reboot)", 0, &sonde.config.kisstnc.active}, {"kisstnc.idformat", "KISS TNC ID Format", -2, &sonde.config.kisstnc.idformat}, @@ -655,7 +648,7 @@ struct st_configitems config_list[] = { {"sondehub.email", "SondeHub email (optional, only used to contact in case of upload errors)", 63, &sonde.config.sondehub.email}, #endif }; -const static int N_CONFIG = (sizeof(config_list) / sizeof(struct st_configitems)); +const int N_CONFIG = (sizeof(config_list) / sizeof(struct st_configitems)); void addConfigStringEntry(char *ptr, int idx, const char *label, int len, char *field) { sprintf(ptr + strlen(ptr), "%s\n", @@ -729,7 +722,7 @@ const char *createConfigForm() { case -6: // List of int8 values addConfigInt8List(ptr, i, config_list[i].label, (int8_t *)config_list[i].data); break; - case -3: // in/offt + case -3: // on/off addConfigOnOffEntry(ptr, i, config_list[i].label, (int *)config_list[i].data); break; case -2: // DFM format @@ -2299,7 +2292,7 @@ void loopDecoder() { #endif #if FEATURE_MQTT - // send to MQTT if enabled + // send to MQTT if enabledson if (connected && mqttEnabled) { Serial.println("Sending sonde info via MQTT"); mqttclient.publishPacket(s); diff --git a/RX_FSK/data/rdz.js b/RX_FSK/data/rdz.js index 396bd53..5667d4c 100644 --- a/RX_FSK/data/rdz.js +++ b/RX_FSK/data/rdz.js @@ -1,8 +1,6 @@ let stypes=new Map(); stypes.set('4', 'RS41'); stypes.set('R', 'RS92'); -stypes.set('9', 'DFM9 (old)'); -stypes.set('6', 'DFM6 (old)'); stypes.set('D', 'DFM'); stypes.set('M', 'M10'); stypes.set('2', 'M20'); diff --git a/libraries/SondeLib/DFM.cpp b/RX_FSK/src/DFM.cpp similarity index 100% rename from libraries/SondeLib/DFM.cpp rename to RX_FSK/src/DFM.cpp diff --git a/libraries/SondeLib/DFM.h b/RX_FSK/src/DFM.h similarity index 100% rename from libraries/SondeLib/DFM.h rename to RX_FSK/src/DFM.h diff --git a/libraries/SondeLib/DefaultFonts.c b/RX_FSK/src/DefaultFonts.c similarity index 100% rename from libraries/SondeLib/DefaultFonts.c rename to RX_FSK/src/DefaultFonts.c diff --git a/libraries/SondeLib/Display.cpp b/RX_FSK/src/Display.cpp similarity index 99% rename from libraries/SondeLib/Display.cpp rename to RX_FSK/src/Display.cpp index e86ec1e..278866b 100644 --- a/libraries/SondeLib/Display.cpp +++ b/RX_FSK/src/Display.cpp @@ -1,4 +1,4 @@ -#include "../../RX_FSK/features.h" +#include "../features.h" #include #include #include @@ -12,13 +12,13 @@ int readLine(Stream &stream, char *buffer, int maxlen); extern const char *version_name; extern const char *version_id; -#include -#include -#include -#include -#include -#include -#include +#include "fonts/FreeMono9pt7b.h" +#include "fonts/FreeMono12pt7b.h" +#include "fonts/FreeSans9pt7b.h" +#include "fonts/FreeSans12pt7b.h" +#include "fonts/FreeSans18pt7b.h" +#include "fonts/Picopixel.h" +#include "fonts/Terminal11x16.h" extern Sonde sonde; @@ -826,8 +826,9 @@ void Display::parseDispElement(char *text, DispEntry *de) // IP address / small always uses tiny font on TFT for backward compatibility // Large font can be used arbitrarily if(de->fmt==fontsma) de->fmt=0; - de->func = disp.drawIP; break; + de->func = disp.drawIP; de->extra = strdup(text+1); + break; case 's': de->func = disp.drawSite; de->extra = strdup(text+1); diff --git a/libraries/SondeLib/Display.h b/RX_FSK/src/Display.h similarity index 99% rename from libraries/SondeLib/Display.h rename to RX_FSK/src/Display.h index d6b2fc3..9f8baf9 100644 --- a/libraries/SondeLib/Display.h +++ b/RX_FSK/src/Display.h @@ -137,8 +137,8 @@ private: static const char *trim(char *s) { char *ret = s; while(*ret && isspace(*ret)) { ret++; } - int lastidx; while(1) { + int lastidx; lastidx = strlen(ret)-1; if(lastidx>=0 && isspace(ret[lastidx])) ret[lastidx] = 0; diff --git a/libraries/SondeLib/M10M20.cpp b/RX_FSK/src/M10M20.cpp similarity index 89% rename from libraries/SondeLib/M10M20.cpp rename to RX_FSK/src/M10M20.cpp index 2d775a2..09e5ef3 100644 --- a/libraries/SondeLib/M10M20.cpp +++ b/RX_FSK/src/M10M20.cpp @@ -464,20 +464,6 @@ int M10M20::waitRXcomplete() { } -#if 0 -static bool checkM20crc(uint8_t *msg, int crcpos) { - int i, cs, cs1; - cs = 0; - for (i = 0; i < crcpos; i++) { - cs = update_checkM10(cs, msg[i]); // same for M10 and M20 - } - cs = cs & 0xFFFF; - cs1 = (msg[crcpos] << 8) | msg[crcpos+1]; - return (cs1 == cs); -} -#endif - - // ret: 1=frame ok; 2=frame with errors; 0=ignored frame (m20dop-alternativ) int M10M20::decodeframeM20(uint8_t *data) { @@ -590,63 +576,5 @@ int M10M20::decodeframeM20(uint8_t *data) { return crcok?1:2; } -#if 0 -//// same as for M10 -// search for -// //101001100110011010011010011001100110100110101010100110101001 -// //1010011001100110100110100110 0110.0110 1001.1010 1010.1001 1010.1001 => 0x669AA9A9 -void M10M20::processM20data(uint8_t dt) -{ - for(int i=0; i<8; i++) { - uint8_t d = (dt&0x80)?1:0; - dt <<= 1; - rxdata = (rxdata<<1) | d; - //uint8_t value = ((rxdata>>1)^rxdata)&0x01; - //if((rxbitc&1)==1) { rxbyte = (rxbyte>>1) + ((value)<<8); } // mancester decoded data - //rxbyte = (rxbyte>>1) | (d<<8); - if( (rxbitc&1)==0 ) { - // "bit1" - rxbyte = (rxbyte<<1) | d; - } else { - // "bit2" ==> 01 or 10 => 1, otherweise => 0 - rxbyte = rxbyte ^ d; - } - // - if(rxsearching) { - if( rxdata == 0xcccca64c || rxdata == 0x333359b3 ) { - rxsearching = false; - rxbitc = 0; - rxp = 0; -#if 1 - int rssi=sx1278.getRSSI(); - int fei=sx1278.getFEI(); - int afc=sx1278.getAFC(); - Serial.print("Test: RSSI="); Serial.print(rssi); - Serial.print(" FEI="); Serial.print(fei); - Serial.print(" AFC="); Serial.println(afc); - sonde.si()->rssi = rssi; - sonde.si()->afc = afc; -#endif - } - } else { - rxbitc = (rxbitc+1)%16; // 16; - if(rxbitc == 0) { // got 8 data bit - //Serial.printf("%03x ",rxbyte); - dataptr[rxp++] = rxbyte&0xff; // (rxbyte>>1)&0xff; -#if 0 - if(rxp==7 && dataptr[6] != 0x65) { - Serial.printf("wrong start: %02x\n",dataptr[6]); - rxsearching = true; - } -#endif - if(rxp>=M20_FRAMELEN) { - rxsearching = true; - haveNewFrame = decodeframeM20(dataptr); - } - } - } - } -} -#endif M10M20 m10m20 = M10M20(); diff --git a/libraries/SondeLib/M10M20.h b/RX_FSK/src/M10M20.h similarity index 100% rename from libraries/SondeLib/M10M20.h rename to RX_FSK/src/M10M20.h diff --git a/libraries/SondeLib/MP3H.cpp b/RX_FSK/src/MP3H.cpp similarity index 99% rename from libraries/SondeLib/MP3H.cpp rename to RX_FSK/src/MP3H.cpp index e2c09b3..4ffb858 100644 --- a/libraries/SondeLib/MP3H.cpp +++ b/RX_FSK/src/MP3H.cpp @@ -359,7 +359,7 @@ int MP3H::decodeframeMP3H(uint8_t *data) { si->id[7] = hex(n/0x10); si->id[8] = hex(n); si->id[9] = 0; - snprintf(si->ser, 12, "%d-%d", mp3hstate.id1, mp3hstate.id2); + snprintf(si->ser, 12, "%u-%u", mp3hstate.id1, mp3hstate.id2); si->validID = true; } diff --git a/libraries/SondeLib/MP3H.h b/RX_FSK/src/MP3H.h similarity index 100% rename from libraries/SondeLib/MP3H.h rename to RX_FSK/src/MP3H.h diff --git a/libraries/SondeLib/RS41.cpp b/RX_FSK/src/RS41.cpp similarity index 100% rename from libraries/SondeLib/RS41.cpp rename to RX_FSK/src/RS41.cpp diff --git a/libraries/SondeLib/RS41.h b/RX_FSK/src/RS41.h similarity index 99% rename from libraries/SondeLib/RS41.h rename to RX_FSK/src/RS41.h index 99639ba..8284573 100644 --- a/libraries/SondeLib/RS41.h +++ b/RX_FSK/src/RS41.h @@ -25,6 +25,7 @@ private: void bitsToBytes(uint8_t *bits, uint8_t *bytes, int len); int decode41(byte *data, int maxlen); +#if 0 #define B 8 #define S 4 uint8_t hamming_conf[ 7*B]; // 7*8=56 @@ -41,6 +42,7 @@ private: { 1, 1, 0, 1, 0, 0, 1, 0}, { 1, 1, 1, 0, 0, 0, 0, 1}}; uint8_t He[8] = { 0x7, 0xB, 0xD, 0xE, 0x8, 0x4, 0x2, 0x1}; // Spalten von H: +#endif // 1-bit-error-Syndrome boolean initialized = false; diff --git a/libraries/SondeLib/RS92.cpp b/RX_FSK/src/RS92.cpp similarity index 100% rename from libraries/SondeLib/RS92.cpp rename to RX_FSK/src/RS92.cpp diff --git a/libraries/SondeLib/RS92.h b/RX_FSK/src/RS92.h similarity index 100% rename from libraries/SondeLib/RS92.h rename to RX_FSK/src/RS92.h diff --git a/libraries/SondeLib/SX1278FSK.cpp b/RX_FSK/src/SX1278FSK.cpp similarity index 99% rename from libraries/SondeLib/SX1278FSK.cpp rename to RX_FSK/src/SX1278FSK.cpp index ba56638..f61e0ce 100644 --- a/libraries/SondeLib/SX1278FSK.cpp +++ b/RX_FSK/src/SX1278FSK.cpp @@ -11,8 +11,8 @@ #include "SX1278FSK.h" #include "SPI.h" -#include -#include +#include "Sonde.h" +#include "Display.h" #define SPI_MUTEX_LOCK() \ @@ -667,7 +667,7 @@ int8_t SX1278FSK::setMaxCurrent(uint8_t rate) // Enable Over Current Protection rate |= B00100000; - state = 1; + //state = 1; st0 = readRegister(REG_OP_MODE); // Save the previous status writeRegister(REG_OP_MODE, FSK_STANDBY_MODE); // Set FSK Standby mode to write in registers writeRegister(REG_OCP, rate); // Modifying maximum current supply diff --git a/libraries/SondeLib/SX1278FSK.h b/RX_FSK/src/SX1278FSK.h similarity index 100% rename from libraries/SondeLib/SX1278FSK.h rename to RX_FSK/src/SX1278FSK.h diff --git a/libraries/SondeLib/Scanner.cpp b/RX_FSK/src/Scanner.cpp similarity index 99% rename from libraries/SondeLib/Scanner.cpp rename to RX_FSK/src/Scanner.cpp index 31a5d7e..4f548df 100644 --- a/libraries/SondeLib/Scanner.cpp +++ b/RX_FSK/src/Scanner.cpp @@ -1,7 +1,8 @@ #include "Scanner.h" -#include + #include +#include "SX1278FSK.h" #include "Sonde.h" #include "Display.h" diff --git a/libraries/SondeLib/Scanner.h b/RX_FSK/src/Scanner.h similarity index 100% rename from libraries/SondeLib/Scanner.h rename to RX_FSK/src/Scanner.h diff --git a/libraries/SondeLib/Sonde.cpp b/RX_FSK/src/Sonde.cpp similarity index 75% rename from libraries/SondeLib/Sonde.cpp rename to RX_FSK/src/Sonde.cpp index eefed49..9070745 100644 --- a/libraries/SondeLib/Sonde.cpp +++ b/RX_FSK/src/Sonde.cpp @@ -213,12 +213,11 @@ void Sonde::defaultConfig() { // config.noisefloor = -125; strcpy(config.call,"NOCALL"); - strcpy(config.passcode, "---"); + config.passcode = -1; strcpy(config.mdnsname, "rdzsonde"); config.maxsonde=15; config.debug=0; config.wifi=1; - config.wifiap=1; config.display[0]=0; config.display[1]=1; config.display[2]=-1; @@ -261,6 +260,9 @@ void Sonde::defaultConfig() { strcpy(config.mqtt.prefix, "rdz_sonde_server/"); } +extern struct st_configitems config_list[]; +extern const int N_CONFIG; + void Sonde::setConfig(const char *cfg) { while(*cfg==' '||*cfg=='\t') cfg++; if(*cfg=='#') return; @@ -270,180 +272,59 @@ void Sonde::setConfig(const char *cfg) { *s=0; s--; while(s>cfg && (*s==' '||*s=='\t')) { *s=0; s--; } Serial.printf("configuration option '%s'=%s \n", cfg, val); - if(strcmp(cfg,"noisefloor")==0) { - config.noisefloor = atoi(val); - if(config.noisefloor==0) config.noisefloor=-130; - } else if(strcmp(cfg,"call")==0) { - strncpy(config.call, val, 9); - config.call[9]=0; - } else if(strcmp(cfg,"passcode")==0) { - strncpy(config.passcode, val, 9); - } else if(strcmp(cfg,"button_pin")==0) { - config.button_pin = atoi(val); - } else if(strcmp(cfg,"button2_pin")==0) { - config.button2_pin = atoi(val); - } else if(strcmp(cfg,"button2_axp")==0) { - config.button2_axp = atoi(val); - } else if(strcmp(cfg,"touch_thresh")==0) { - config.touch_thresh = atoi(val); - } else if(strcmp(cfg,"led_pout")==0) { - config.led_pout = atoi(val); - } else if(strcmp(cfg,"power_pout")==0) { - config.power_pout = atoi(val); - } else if(strcmp(cfg,"disptype")==0) { - config.disptype = atoi(val); - } else if(strcmp(cfg,"oled_sda")==0) { - config.oled_sda = atoi(val); - } else if(strcmp(cfg,"oled_scl")==0) { - config.oled_scl = atoi(val); - } else if(strcmp(cfg,"oled_rst")==0) { - config.oled_rst = atoi(val); - } else if(strcmp(cfg,"tft_rs")==0) { - config.tft_rs = atoi(val); - } else if(strcmp(cfg,"tft_cs")==0) { - config.tft_cs = atoi(val); - } else if(strcmp(cfg,"tft_orient")==0) { - config.tft_orient = atoi(val); - } else if(strcmp(cfg,"tft_spifreq")==0) { - config.tft_spifreq = atoi(val); - } else if(strcmp(cfg,"gps_rxd")==0) { - config.gps_rxd = atoi(val); - } else if(strcmp(cfg,"gps_txd")==0) { - config.gps_txd = atoi(val); - } else if(strcmp(cfg,"batt_adc")==0) { - config.batt_adc = atoi(val); - } else if(strcmp(cfg,"sx1278_ss")==0) { - config.sx1278_ss = atoi(val); - } else if(strcmp(cfg,"sx1278_miso")==0) { - config.sx1278_miso = atoi(val); - } else if(strcmp(cfg,"sx1278_mosi")==0) { - config.sx1278_mosi = atoi(val); - } else if(strcmp(cfg,"sx1278_sck")==0) { - config.sx1278_sck = atoi(val); - } else if(strcmp(cfg,"maxsonde")==0) { - config.maxsonde = atoi(val); - if(config.maxsonde>MAXSONDE) config.maxsonde=MAXSONDE; - } else if(strcmp(cfg,"debug")==0) { - config.debug = atoi(val); - } else if(strcmp(cfg,"wifi")==0) { - config.wifi = atoi(val); - } else if(strcmp(cfg,"wifiap")==0) { - config.wifiap = atoi(val); - } else if(strcmp(cfg,"mdnsname")==0) { - strncpy(config.mdnsname, val, 14); - } else if(strcmp(cfg,"screenfile")==0) { - config.screenfile = atoi(val); - } else if(strcmp(cfg,"display")==0) { - int i = 0; - char *ptr; - while(val) { - ptr = strchr(val,','); - if(ptr) *ptr = 0; - config.display[i++] = atoi(val); - val = ptr?ptr+1:NULL; - Serial.printf("appending value %d next is %s\n", config.display[i-1], val?val:""); + + // new code: use config_list to find config entry... + int i; + for(i=0; i0) { // string with that length + strlcpy((char *)config_list[i].data, val, config_list[i].type+1); + break; + } + switch(config_list[i].type) { + case 0: // integer + case -4: // integer (with "touch button" checkbox in web form) + case -3: // integer (boolean on/off swith in web form) + case -2: // integer (ID type) + *(int *)config_list[i].data = atoi(val); + if(config.maxsonde > MAXSONDE) config.maxsonde = MAXSONDE; + break; + case -7: // double + *(double *)config_list[i].data = *val==0 ? NAN : atof(val); + break; + case -6: // display list + { + int idx = 0; + char *ptr; + while(val) { + ptr = strchr(val,','); + if(ptr) *ptr = 0; + config.display[idx++] = atoi(val); + val = ptr?ptr+1:NULL; + Serial.printf("appending value %d next is %s\n", config.display[idx-1], val?val:""); + } + config.display[idx] = -1; + break; } - 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) { - config.channelbw = atoi(val); - } else if(strcmp(cfg,"spectrum")==0) { - config.spectrum = atoi(val); - } else if(strcmp(cfg,"marker")==0) { - config.marker = atoi(val); - } else if(strcmp(cfg,"freqofs")==0) { - config.freqofs = atoi(val); - } else if(strcmp(cfg,"rs41.agcbw")==0) { - config.rs41.agcbw = atoi(val); - } else if(strcmp(cfg,"rs41.rxbw")==0) { - config.rs41.rxbw = atoi(val); - } else if(strcmp(cfg,"m10m20.agcbw")==0) { - config.m10m20.agcbw = atoi(val); - } else if(strcmp(cfg,"m10m20.rxbw")==0) { - config.m10m20.rxbw = atoi(val); - } else if(strcmp(cfg,"mp3h.agcbw")==0) { - config.mp3h.agcbw = atoi(val); - } else if(strcmp(cfg,"mp3h.rxbw")==0) { - config.mp3h.rxbw = atoi(val); - } else if(strcmp(cfg,"dfm.agcbw")==0) { - config.dfm.agcbw = atoi(val); - } else if(strcmp(cfg,"dfm.rxbw")==0) { - config.dfm.rxbw = atoi(val); - } else if(strcmp(cfg,"rs92.alt2d")==0) { - config.rs92.alt2d= atoi(val); - } else if(strcmp(cfg,"ephftp")==0) { - strncpy(config.ephftp, val, 40); - } else if(strcmp(cfg,"kisstnc.active")==0) { - config.kisstnc.active = atoi(val); - } else if(strcmp(cfg,"kisstnc.idformat")==0) { - config.kisstnc.idformat = atoi(val); - } else if(strcmp(cfg,"rs92.rxbw")==0) { - config.rs92.rxbw = atoi(val); - } else if(strcmp(cfg,"axudp.active")==0) { - config.udpfeed.active = atoi(val)>0; - } else if(strcmp(cfg,"axudp.host")==0) { - strncpy(config.udpfeed.host, val, 63); - } else if(strcmp(cfg,"axudp.port")==0) { - config.udpfeed.port = atoi(val); - } else if(strcmp(cfg,"axudp.symbol")==0) { - strncpy(config.udpfeed.symbol, val, 3); - } else if(strcmp(cfg,"axudp.highrate")==0) { - config.udpfeed.highrate = atoi(val); - } else if(strcmp(cfg,"axudp.idformat")==0) { - config.udpfeed.idformat = atoi(val); - } else if(strcmp(cfg,"tcp.active")==0) { - config.tcpfeed.active = atoi(val)>0; - } else if(strcmp(cfg,"tcp.host")==0) { - strncpy(config.tcpfeed.host, val, 63); - } else if(strcmp(cfg,"tcp.port")==0) { - config.tcpfeed.port = atoi(val); - } else if(strcmp(cfg,"tcp.symbol")==0) { - strncpy(config.tcpfeed.symbol, val, 3); - } else if(strcmp(cfg,"tcp.highrate")==0) { - config.tcpfeed.highrate = atoi(val); - } else if(strcmp(cfg,"tcp.idformat")==0) { - config.tcpfeed.idformat = atoi(val); - - } else if(strcmp(cfg,"mqtt.active")==0) { - config.mqtt.active = atoi(val)>0; - } else if(strcmp(cfg,"mqtt.id")==0) { - strncpy(config.mqtt.id, val, 63); - } else if(strcmp(cfg,"mqtt.host")==0) { - strncpy(config.mqtt.host, val, 63); - } else if(strcmp(cfg,"mqtt.port")==0) { - config.mqtt.port = atoi(val); - } else if(strcmp(cfg,"mqtt.username")==0) { - strncpy(config.mqtt.username, val, 63); - } else if(strcmp(cfg,"mqtt.password")==0) { - strncpy(config.mqtt.password, val, 63); - } else if(strcmp(cfg,"mqtt.prefix")==0) { - strncpy(config.mqtt.prefix, val, 63); - } else if(strcmp(cfg, "sondehub.active")==0) { - config.sondehub.active = atoi(val); - } else if(strcmp(cfg,"sondehub.chase")==0) { - config.sondehub.chase = atoi(val); - } else if(strcmp(cfg, "sondehub.host")==0) { - strncpy(config.sondehub.host, val, 63); - } else if(strcmp(cfg, "sondehub.callsign")==0) { - strncpy(config.sondehub.callsign, val, 63); - } else if(strcmp(cfg, "sondehub.lat")==0) { - config.sondehub.lat = *val==0 ? NAN : atof(val); - Serial.printf("lat is %f\n", config.sondehub.lat); - } else if(strcmp(cfg, "sondehub.lon")==0) { - config.sondehub.lon = *val==0 ? NAN : atof(val); - Serial.printf("lon is %f\n", config.sondehub.lon); - } else if(strcmp(cfg, "sondehub.alt")==0) { - strncpy(config.sondehub.alt, val, 19); - } else if(strcmp(cfg, "sondehub.antenna")==0) { - strncpy(config.sondehub.antenna, val, 63); - } else if(strcmp(cfg, "sondehub.email")==0) { - strncpy(config.sondehub.email, val, 63); - } else { + default: + // skipping non-supported types + break; + } + + break; + } + if(i==N_CONFIG) { Serial.printf("Invalid config option '%s'=%s \n", cfg, val); } +#if 0 + // currently not in config_list. Maybe add later. + } else if(strcmp(cfg,"axudp.symbol")==0) { + strncpy(config.udpfeed.symbol, val, 3); + } else if(strcmp(cfg,"tcp.symbol")==0) { + strncpy(config.tcpfeed.symbol, val, 3); + } +#endif } void Sonde::setIP(String ip, bool AP) { diff --git a/libraries/SondeLib/Sonde.h b/RX_FSK/src/Sonde.h similarity index 97% rename from libraries/SondeLib/Sonde.h rename to RX_FSK/src/Sonde.h index 097a5cb..524b725 100644 --- a/libraries/SondeLib/Sonde.h +++ b/RX_FSK/src/Sonde.h @@ -224,7 +224,6 @@ typedef struct st_rdzconfig { // software configuration int debug; // show port and config options after reboot int wifi; // connect to known WLAN 0=skip - int wifiap; // enable/disable WiFi AccessPoint mode 0=disable int screenfile; int8_t display[30]; // list of display mode (0:scanner, 1:default, 2,... additional modes) int startfreq; // spectrum display start freq (400, 401, ...) @@ -246,7 +245,7 @@ typedef struct st_rdzconfig { // data feed configuration // for now, one feed for each type is enough, but might get extended to more? char call[10]; // APRS callsign - char passcode[9]; // APRS passcode + int passcode; // APRS passcode struct st_feedinfo udpfeed; // target for AXUDP messages struct st_feedinfo tcpfeed; // target for APRS-IS TCP connections struct st_kisstnc kisstnc; // target for KISS TNC (via TCP, mainly for APRSdroid) @@ -255,6 +254,18 @@ typedef struct st_rdzconfig { } RDZConfig; +struct st_configitems { + const char *name; + const char *label; + int type; // 0: numeric; i>0 string of length i; -1: separator; -2: type selector + void *data; +}; + +// defined in RX_FSK.ino +extern struct st_configitems config_list[]; +extern const int N_CONFIG; + + #define MAXSONDE 99 extern int fingerprintValue[]; @@ -288,11 +299,6 @@ public: void setup(); void receive(); uint16_t waitRXcomplete(); - /* old and temp interface */ -#if 0 - void processRXbyte(uint8_t data); - int receiveFrame(); -#endif SondeInfo *si(); diff --git a/libraries/SondeLib/TFT22_ILI9225.cpp b/RX_FSK/src/TFT22_ILI9225.cpp similarity index 100% rename from libraries/SondeLib/TFT22_ILI9225.cpp rename to RX_FSK/src/TFT22_ILI9225.cpp diff --git a/libraries/SondeLib/TFT22_ILI9225.h b/RX_FSK/src/TFT22_ILI9225.h similarity index 100% rename from libraries/SondeLib/TFT22_ILI9225.h rename to RX_FSK/src/TFT22_ILI9225.h diff --git a/libraries/SondeLib/aprs.cpp b/RX_FSK/src/aprs.cpp similarity index 93% rename from libraries/SondeLib/aprs.cpp rename to RX_FSK/src/aprs.cpp index 0f710b6..207047c 100644 --- a/libraries/SondeLib/aprs.cpp +++ b/RX_FSK/src/aprs.cpp @@ -235,28 +235,11 @@ extern int aprsstr_mon2kiss(const char *mon, char raw[], int raw_len) #define FEET (1.0/0.3048) #define KNOTS (1.851984) -#define X2C_max_longcard 0xFFFFFFFFUL -static uint32_t X2C_TRUNCC(double x, uint32_t min0, uint32_t max0) -{ - uint32_t i; - - if (x < (double)min0) - i = (uint32_t)min0; - if (x > (double)max0) - i = (uint32_t)max0; - - i = (uint32_t)x; - if ((double)i > x) - --i; - return i; -} - - static uint32_t truncc(double r) { if (r<=0.0) return 0UL; else if (r>=2.E+9) return 2000000000UL; - else return (uint32_t)X2C_TRUNCC(r,0UL,X2C_max_longcard); + else return (uint32_t)r; return 0; } /* end truncc() */ @@ -273,7 +256,7 @@ static uint32_t dao91(double x) char b[201]; -char raw[201]; +//char raw[201]; char *aprs_senddata(SondeInfo *s, const char *usercall, const char *sym) { // float lat, float lon, float alt, float speed, float dir, float climb, const char *type, const char *objname, const char *usercall, const char *sym, const char *comm) @@ -310,11 +293,10 @@ char *aprs_senddata(SondeInfo *s, const char *usercall, const char *sym) { i=strlen(b); snprintf(b+i, APRS_MAXLEN-i, "/A=%06d", realcard(s->alt*FEET+0.5)); } - int dao=1; - if(dao) { - i=strlen(b); - snprintf(b+i, APRS_MAXLEN-i, "!w%c%c!", 33+dao91(s->lat), 33+dao91(s->lon)); - } + // always use DAO + i=strlen(b); + snprintf(b+i, APRS_MAXLEN-i, "!w%c%c!", 33+dao91(s->lat), 33+dao91(s->lon)); + strcat(b, "&"); char comm[100]; snprintf(comm, 100, "Clb=%.1fm/s %.3fMHz Type=%s", s->vs, s->freq, sondeTypeStr[s->type]); diff --git a/libraries/SondeLib/aprs.h b/RX_FSK/src/aprs.h similarity index 100% rename from libraries/SondeLib/aprs.h rename to RX_FSK/src/aprs.h diff --git a/libraries/SondeLib/autodetect-infos b/RX_FSK/src/autodetect-infos similarity index 100% rename from libraries/SondeLib/autodetect-infos rename to RX_FSK/src/autodetect-infos diff --git a/libraries/SondeLib/fonts/FreeMono12pt7b.h b/RX_FSK/src/fonts/FreeMono12pt7b.h similarity index 100% rename from libraries/SondeLib/fonts/FreeMono12pt7b.h rename to RX_FSK/src/fonts/FreeMono12pt7b.h diff --git a/libraries/SondeLib/fonts/FreeMono9pt7b.h b/RX_FSK/src/fonts/FreeMono9pt7b.h similarity index 100% rename from libraries/SondeLib/fonts/FreeMono9pt7b.h rename to RX_FSK/src/fonts/FreeMono9pt7b.h diff --git a/libraries/SondeLib/fonts/FreeSans12pt7b.h b/RX_FSK/src/fonts/FreeSans12pt7b.h similarity index 100% rename from libraries/SondeLib/fonts/FreeSans12pt7b.h rename to RX_FSK/src/fonts/FreeSans12pt7b.h diff --git a/libraries/SondeLib/fonts/FreeSans18pt7b.h b/RX_FSK/src/fonts/FreeSans18pt7b.h similarity index 100% rename from libraries/SondeLib/fonts/FreeSans18pt7b.h rename to RX_FSK/src/fonts/FreeSans18pt7b.h diff --git a/libraries/SondeLib/fonts/FreeSans9pt7b.h b/RX_FSK/src/fonts/FreeSans9pt7b.h similarity index 100% rename from libraries/SondeLib/fonts/FreeSans9pt7b.h rename to RX_FSK/src/fonts/FreeSans9pt7b.h diff --git a/libraries/SondeLib/fonts/Picopixel.h b/RX_FSK/src/fonts/Picopixel.h similarity index 100% rename from libraries/SondeLib/fonts/Picopixel.h rename to RX_FSK/src/fonts/Picopixel.h diff --git a/libraries/SondeLib/fonts/Terminal11x16.h b/RX_FSK/src/fonts/Terminal11x16.h similarity index 100% rename from libraries/SondeLib/fonts/Terminal11x16.h rename to RX_FSK/src/fonts/Terminal11x16.h diff --git a/libraries/SondeLib/geteph.cpp b/RX_FSK/src/geteph.cpp similarity index 100% rename from libraries/SondeLib/geteph.cpp rename to RX_FSK/src/geteph.cpp diff --git a/libraries/SondeLib/geteph.h b/RX_FSK/src/geteph.h similarity index 100% rename from libraries/SondeLib/geteph.h rename to RX_FSK/src/geteph.h diff --git a/libraries/SondeLib/gfxfont.h b/RX_FSK/src/gfxfont.h similarity index 100% rename from libraries/SondeLib/gfxfont.h rename to RX_FSK/src/gfxfont.h diff --git a/libraries/SondeLib/library.json b/RX_FSK/src/library.json similarity index 100% rename from libraries/SondeLib/library.json rename to RX_FSK/src/library.json diff --git a/libraries/SondeLib/mqtt.cpp b/RX_FSK/src/mqtt.cpp similarity index 93% rename from libraries/SondeLib/mqtt.cpp rename to RX_FSK/src/mqtt.cpp index 1926de7..f43119c 100644 --- a/libraries/SondeLib/mqtt.cpp +++ b/RX_FSK/src/mqtt.cpp @@ -24,13 +24,11 @@ void MQTT::init(const char* host, uint16_t port, const char* id, const char *use this->password = password; this->prefix = prefix; - char buffer[20]; - snprintf(buffer, 20, "%s%6ld", id, random(0, 1000)); - this->id = buffer; - Serial.println("[MQTT] pubsub client"); mqttClient.setServer(ip, port); - mqttClient.setClientId(id); + char buffer[20]; + snprintf(buffer, 20, "%s%6ld", id, random(0, 1000)); + mqttClient.setClientId(buffer); if (strlen(password) > 0) { mqttClient.setCredentials(username, password); } @@ -73,15 +71,15 @@ void MQTT::publishPacket(SondeInfo *s) "\"dir\": %.1f," "\"sats\": %d," "\"validPos\": %d," - "\"time\": %d," - "\"frame\": %d," + "\"time\": %u," + "\"frame\": %u," "\"validTime\": %d," "\"rssi\": %d," "\"afc\": %d," "\"rxStat\": \"%s\"," - "\"rxStart\": %d," - "\"norxStart\": %d," - "\"viewStart\": %d," + "\"rxStart\": %u," + "\"norxStart\": %u," + "\"viewStart\": %u," "\"lastState\": %d," "\"launchKT\": %d," "\"burstKT\": %d," diff --git a/libraries/SondeLib/mqtt.h b/RX_FSK/src/mqtt.h similarity index 96% rename from libraries/SondeLib/mqtt.h rename to RX_FSK/src/mqtt.h index 731fccf..0ccd377 100644 --- a/libraries/SondeLib/mqtt.h +++ b/RX_FSK/src/mqtt.h @@ -13,7 +13,6 @@ public: TimerHandle_t mqttReconnectTimer; IPAddress ip; uint16_t port; - const char *id; const char *username; const char *password; const char *prefix; diff --git a/libraries/SondeLib/nav_gps_vel.cpp b/RX_FSK/src/nav_gps_vel.cpp similarity index 85% rename from libraries/SondeLib/nav_gps_vel.cpp rename to RX_FSK/src/nav_gps_vel.cpp index afd1ccc..6d4f547 100644 --- a/libraries/SondeLib/nav_gps_vel.cpp +++ b/RX_FSK/src/nav_gps_vel.cpp @@ -78,174 +78,6 @@ void rotZ(double x1, double y1, double z1, double angle, double *x2, double *y2, /* ---------------------------------------------------------------------------------------------------- */ -#if 0 -int read_SEMalmanac(FILE *fp, EPHEM_t *alm) { - int l, j; - char buf[64]; - unsigned n, week, toa, ui; - double dbl; - - l = fscanf(fp, "%u", &n); if (l != 1) return -1; - l = fscanf(fp, "%s", buf); if (l != 1) return -1; - l = fscanf(fp, "%u", &week); if (l != 1) return -1; - l = fscanf(fp, "%u", &toa); if (l != 1) return -1; - - for (j = 1; j <= n; j++) { - //memset(&ephem, 0, sizeof(ephem)); - - alm[j].week = (uint16_t)week; - alm[j].toa = (uint32_t)toa; - alm[j].toe = (double)toa; - alm[j].toc = alm[j].toe; - - l = fscanf(fp, "%u", &ui); if (l != 1) return -1; alm[j].prn = (uint16_t)ui; - l = fscanf(fp, "%u", &ui); if (l != 1) return -2; alm[j].svn = (uint16_t)ui; - l = fscanf(fp, "%u", &ui); if (l != 1) return -3; alm[j].ura = (uint8_t)ui; - l = fscanf(fp, "%lf", &dbl); if (l != 1) return -4; alm[j].e = dbl; - l = fscanf(fp, "%lf", &dbl); if (l != 1) return -5; alm[j].delta_i = dbl; - alm[j].i0 = (0.30 + alm[j].delta_i) * PI; - l = fscanf(fp, "%lf", &dbl); if (l != 1) return -6; alm[j].OmegaDot = dbl * PI; - l = fscanf(fp, "%lf", &dbl); if (l != 1) return -7; alm[j].sqrta = dbl; - l = fscanf(fp, "%lf", &dbl); if (l != 1) return -6; alm[j].Omega0 = dbl * PI; - l = fscanf(fp, "%lf", &dbl); if (l != 1) return -8; alm[j].w = dbl * PI; - l = fscanf(fp, "%lf", &dbl); if (l != 1) return -9; alm[j].M0 = dbl * PI; - l = fscanf(fp, "%lf", &dbl); if (l != 1) return -10; alm[j].af0 = dbl; - l = fscanf(fp, "%lf", &dbl); if (l != 1) return -11; alm[j].af1 = dbl; - alm[j].af2 = 0; - alm[j].crc = 0; - alm[j].crs = 0; - alm[j].cuc = 0; - alm[j].cus = 0; - alm[j].cic = 0; - alm[j].cis = 0; - alm[j].tgd = 0; - alm[j].idot = 0; - alm[j].delta_n = 0; - l = fscanf(fp, "%u", &ui); if (l != 1) return -12; alm[j].health = (uint8_t)ui; - l = fscanf(fp, "%u", &ui); if (l != 1) return -13; alm[j].conf = (uint8_t)ui; - } - - return 0; -} - -int read_RNXephemeris(FILE *fp, EPHEM_t eph[][24]) { - int l, i; - char buf[64], str[20]; - char buf_header[83]; - //buf_data[80]; // 3 + 4*19 = 79 - char *pbuf; - unsigned ui; - double dbl; - int c; - EPHEM_t ephem = {}; - int hr = 0; - - do { - //l = fread(buf_header, 81, 1, fp); // Zeilen in Header sind nicht immer mit Leerzeichen aufgefuellt - pbuf = fgets(buf_header, 82, fp); // max 82-1 Zeichen + '\0' - buf_header[82] = '\0'; // doppelt haelt besser - //l = strlen(buf_header); - } while ( pbuf && !strstr(buf_header, "END OF HEADER") ); - - //l = fread(buf_data, 80, 1, fp); - //buf_data[79] = '\0'; - - - while (hr < 24) { // brdc/hour-rinex sollte nur Daten von einem Tag enthalten - - //memset(&ephem, 0, sizeof(ephem)); - - l = fread(buf, 3, 1, fp); if (l != 1) break; buf[ 3] = 0; sscanf(buf, "%d", &ui); - ephem.prn = ui; - - - for (i = 0; i < 16; i++) ephem.epoch[i] = '0'; - ephem.epoch[16] = '\0'; - - l = fread(buf, 19, 1, fp); if (l != 1) break; buf[19] = 0; - - for (i = 0; i < 6; i++) { - c = buf[3*i ]; if (c == ' ') c = '0'; str[2*i ] = c; - c = buf[3*i+1]; if (c == ' ') c = '0'; str[2*i+1] = c; - } - str[12] = buf[17]; - str[13] = buf[18]; - str[14] = '\0'; - - strncpy(ephem.epoch , "20", 2); // vorausgesetzt 21.Jhd; Datum steht auch im Header - strncpy(ephem.epoch+2, str, 15); - ephem.epoch[16] = '\0'; - - strncpy(str, buf+9, 2); str[2] = '\0'; - hr = atoi(str); - - l = fread(buf, 19, 1, fp); if (l != 1) break; if (buf[15] == 'D') buf[15] = 'E'; buf[19] = 0; sscanf(buf, "%lf", &dbl); ephem.af0 = dbl; - l = fread(buf, 19, 1, fp); if (l != 1) break; if (buf[15] == 'D') buf[15] = 'E'; buf[19] = 0; sscanf(buf, "%lf", &dbl); ephem.af1 = dbl; - l = fread(buf, 19, 1, fp); if (l != 1) break; if (buf[15] == 'D') buf[15] = 'E'; buf[19] = 0; sscanf(buf, "%lf", &dbl); ephem.af2 = dbl; - if ((c=fgetc(fp)) == EOF) break; - - l = fread(buf, 3, 1, fp); if (l != 1) break; buf[ 3] = 0; - l = fread(buf, 19, 1, fp); if (l != 1) break; if (buf[15] == 'D') buf[15] = 'E'; buf[19] = 0; sscanf(buf, "%lf", &dbl); //ephem.iode = dbl; - l = fread(buf, 19, 1, fp); if (l != 1) break; if (buf[15] == 'D') buf[15] = 'E'; buf[19] = 0; sscanf(buf, "%lf", &dbl); ephem.crs = dbl; - l = fread(buf, 19, 1, fp); if (l != 1) break; if (buf[15] == 'D') buf[15] = 'E'; buf[19] = 0; sscanf(buf, "%lf", &dbl); ephem.delta_n = dbl; - l = fread(buf, 19, 1, fp); if (l != 1) break; if (buf[15] == 'D') buf[15] = 'E'; buf[19] = 0; sscanf(buf, "%lf", &dbl); ephem.M0 = dbl; - if ((c=fgetc(fp)) == EOF) break; - - l = fread(buf, 3, 1, fp); if (l != 1) break; buf[ 3] = 0; - l = fread(buf, 19, 1, fp); if (l != 1) break; if (buf[15] == 'D') buf[15] = 'E'; buf[19] = 0; sscanf(buf, "%lf", &dbl); ephem.cuc = dbl; - l = fread(buf, 19, 1, fp); if (l != 1) break; if (buf[15] == 'D') buf[15] = 'E'; buf[19] = 0; sscanf(buf, "%lf", &dbl); ephem.e = dbl; - l = fread(buf, 19, 1, fp); if (l != 1) break; if (buf[15] == 'D') buf[15] = 'E'; buf[19] = 0; sscanf(buf, "%lf", &dbl); ephem.cus = dbl; - l = fread(buf, 19, 1, fp); if (l != 1) break; if (buf[15] == 'D') buf[15] = 'E'; buf[19] = 0; sscanf(buf, "%lf", &dbl); ephem.sqrta = dbl; - if ((c=fgetc(fp)) == EOF) break; - - l = fread(buf, 3, 1, fp); if (l != 1) break; buf[ 3] = 0; - l = fread(buf, 19, 1, fp); if (l != 1) break; if (buf[15] == 'D') buf[15] = 'E'; buf[19] = 0; sscanf(buf, "%lf", &dbl); ephem.toe = dbl; - ephem.toc = ephem.toe; - l = fread(buf, 19, 1, fp); if (l != 1) break; if (buf[15] == 'D') buf[15] = 'E'; buf[19] = 0; sscanf(buf, "%lf", &dbl); ephem.cic = dbl; - l = fread(buf, 19, 1, fp); if (l != 1) break; if (buf[15] == 'D') buf[15] = 'E'; buf[19] = 0; sscanf(buf, "%lf", &dbl); ephem.Omega0 = dbl; - l = fread(buf, 19, 1, fp); if (l != 1) break; if (buf[15] == 'D') buf[15] = 'E'; buf[19] = 0; sscanf(buf, "%lf", &dbl); ephem.cis = dbl; - if ((c=fgetc(fp)) == EOF) break; - - l = fread(buf, 3, 1, fp); if (l != 1) break; buf[ 3] = 0; - l = fread(buf, 19, 1, fp); if (l != 1) break; if (buf[15] == 'D') buf[15] = 'E'; buf[19] = 0; sscanf(buf, "%lf", &dbl); ephem.i0 = dbl; - l = fread(buf, 19, 1, fp); if (l != 1) break; if (buf[15] == 'D') buf[15] = 'E'; buf[19] = 0; sscanf(buf, "%lf", &dbl); ephem.crc = dbl; - l = fread(buf, 19, 1, fp); if (l != 1) break; if (buf[15] == 'D') buf[15] = 'E'; buf[19] = 0; sscanf(buf, "%lf", &dbl); ephem.w = dbl; - l = fread(buf, 19, 1, fp); if (l != 1) break; if (buf[15] == 'D') buf[15] = 'E'; buf[19] = 0; sscanf(buf, "%lf", &dbl); ephem.OmegaDot = dbl; - if ((c=fgetc(fp)) == EOF) break; - - l = fread(buf, 3, 1, fp); if (l != 1) break; buf[ 3] = 0; - l = fread(buf, 19, 1, fp); if (l != 1) break; if (buf[15] == 'D') buf[15] = 'E'; buf[19] = 0; sscanf(buf, "%lf", &dbl); ephem.idot = dbl; - l = fread(buf, 19, 1, fp); if (l != 1) break; if (buf[15] == 'D') buf[15] = 'E'; buf[19] = 0; sscanf(buf, "%lf", &dbl); //ephem.codeL2 = dbl; - l = fread(buf, 19, 1, fp); if (l != 1) break; if (buf[15] == 'D') buf[15] = 'E'; buf[19] = 0; sscanf(buf, "%lf", &dbl); ephem.gpsweek = (int)dbl; - l = fread(buf, 19, 1, fp); if (l != 1) break; if (buf[15] == 'D') buf[15] = 'E'; buf[19] = 0; sscanf(buf, "%lf", &dbl); //ephem.iodc = dbl; - if ((c=fgetc(fp)) == EOF) break; - - l = fread(buf, 3, 1, fp); if (l != 1) break; buf[ 3] = 0; - l = fread(buf, 19, 1, fp); if (l != 1) break; if (buf[15] == 'D') buf[15] = 'E'; buf[19] = 0; sscanf(buf, "%lf", &dbl); //ephem.sva = dbl; - l = fread(buf, 19, 1, fp); if (l != 1) break; if (buf[15] == 'D') buf[15] = 'E'; buf[19] = 0; sscanf(buf, "%lf", &dbl); ephem.health = (uint8_t)(dbl+0.1); - l = fread(buf, 19, 1, fp); if (l != 1) break; if (buf[15] == 'D') buf[15] = 'E'; buf[19] = 0; sscanf(buf, "%lf", &dbl); ephem.tgd = dbl; - l = fread(buf, 19, 1, fp); if (l != 1) break; if (buf[15] == 'D') buf[15] = 'E'; buf[19] = 0; sscanf(buf, "%lf", &dbl); //ephem.iodc = dbl; - if ((c=fgetc(fp)) == EOF) break; - - l = fread(buf, 3, 1, fp); if (l != 1) break; buf[ 3] = 0; - l = fread(buf, 19, 1, fp); if (l != 1) break; if (buf[15] == 'D') buf[15] = 'E'; buf[19] = 0; sscanf(buf, "%lf", &dbl); //ephem.ttom = dbl; - pbuf = fgets(buf_header, 82, fp); - /* // die letzten beiden Felder (spare) sind manchmal leer (statt 0.00); manchmal fehlt sogar das drittletzte Feld - l = fread(buf, 19, 1, fp); if (l != 1) break; if (buf[15] == 'D') buf[15] = 'E'; buf[19] = 0; sscanf(buf, "%lf", &dbl); //ephem.fit = dbl; - l = fread(buf, 19, 1, fp); if (l != 1) break; if (buf[15] == 'D') buf[15] = 'E'; buf[19] = 0; sscanf(buf, "%lf", &dbl); //ephem.spare1 = dbl; - l = fread(buf, 19, 1, fp); if (l != 1) break; if (buf[15] == 'D') buf[15] = 'E'; buf[19] = 0; sscanf(buf, "%lf", &dbl); //ephem.spare2 = dbl; - if ((c=fgetc(fp)) == EOF) break; */ - - - ephem.week = 1; // ephem.gpsweek - eph[ephem.prn][hr] = ephem; - - if (pbuf == NULL) break; - } - - return 0; -} -#endif static EPHEM_t *te; @@ -254,17 +86,13 @@ static EPHEM_t *te; #define fgetc(file) (char)file.read() -//EPHEM_t *read_RNXpephs(FILE *fp) { EPHEM_t *read_RNXpephs(const char *file) { int l, i; - //char buffer[86]; char buf[64], str[20]; unsigned ui; double dbl; int c; EPHEM_t ephem = {}; - // int count = 0; - //long fpos; File fp = SPIFFS.open(file, "r"); if(!fp) { Serial.printf("Error opening %s\n", file); } @@ -277,23 +105,7 @@ EPHEM_t *read_RNXpephs(const char *file) { Serial.printf("Skipping header: %s\n", line.c_str()); } while ( fp.available() && !strstr((const char *)line.c_str(), "END OF HEADER") ); if (!fp.available()) return NULL; -/* - fpos = ftell(fp); - count = 0; - while (count >= 0) { // data-Zeilen: 79 Zeichen - pbuf = fgets(buffer, 84, fp); if (pbuf == 0) break; - strncpy(str, buffer, 3); - str[3] = '\0'; - sscanf(str, "%d", &ui); - if (ui < 33) count++; - for (i = 1; i < 8; i++) { - pbuf = fgets(buffer, 84, fp); if (pbuf == 0) break; - } - } - printf("Ephemerides: %d total=%d\n", count, count*sizeof(ephem)); - fseek(fp, fpos, SEEK_SET); -*/ if(te) free(te); te = (EPHEM_t *)calloc( 34, sizeof(ephem) ); // calloc( 1, sizeof(ephem) ); if (te == NULL) return NULL; diff --git a/libraries/SondeLib/nav_gps_vel.h b/RX_FSK/src/nav_gps_vel.h similarity index 100% rename from libraries/SondeLib/nav_gps_vel.h rename to RX_FSK/src/nav_gps_vel.h diff --git a/libraries/SondeLib/rs92gps.cpp b/RX_FSK/src/rs92gps.cpp similarity index 70% rename from libraries/SondeLib/rs92gps.cpp rename to RX_FSK/src/rs92gps.cpp index f011172..2c36797 100644 --- a/libraries/SondeLib/rs92gps.cpp +++ b/RX_FSK/src/rs92gps.cpp @@ -41,13 +41,11 @@ */ -#if 1 #include #include #include #include #include -#endif #include #include "nav_gps_vel.h" @@ -83,25 +81,6 @@ int almanac = 0, int exSat = -1; -#if 0 -/* --- RS92-SGP: 8N1 manchester --- */ -#define BITS (2*(1+8+1)) // 20 -#define HEADOFS 40 // HEADOFS+HEADLEN = 120 (bis 0x10) -#define HEADLEN 80 // (HEADOFS+HEADLEN) mod BITS = 0 -/* -#define HEADOFS 0 // HEADOFS muss 0 wegen Wiederholung -#define HEADLEN 60 // HEADLEN < 100, (HEADOFS+HEADLEN) mod BITS = 0 -*/ -#define FRAMESTART ((HEADOFS+HEADLEN)/BITS) - -/* 2A 10*/ -char header[] = "10100110011001101001" - "10100110011001101001" - "10100110011001101001" - "10100110011001101001" - "1010011001100110100110101010100110101001"; -char buf[HEADLEN+1] = "x"; -#endif int bufpos = -1; @@ -143,225 +122,7 @@ int findstr(char *buff, char *str, int pos) { return i; } -#if 0 -int read_wav_header(FILE *fp) { - char txt[4+1] = "\0\0\0\0"; - unsigned char dat[4]; - int byte, p=0; - if (fread(txt, 1, 4, fp) < 4) return -1; - if (strncmp(txt, "RIFF", 4)) return -1; - if (fread(txt, 1, 4, fp) < 4) return -1; - // pos_WAVE = 8L - if (fread(txt, 1, 4, fp) < 4) return -1; - if (strncmp(txt, "WAVE", 4)) return -1; - // pos_fmt = 12L - for ( ; ; ) { - if ( (byte=fgetc(fp)) == EOF ) return -1; - txt[p % 4] = byte; - p++; if (p==4) p=0; - if (findstr(txt, "fmt ", p) == 4) break; - } - if (fread(dat, 1, 4, fp) < 4) return -1; - if (fread(dat, 1, 2, fp) < 2) return -1; - - if (fread(dat, 1, 2, fp) < 2) return -1; - channels = dat[0] + (dat[1] << 8); - - if (fread(dat, 1, 4, fp) < 4) return -1; - memcpy(&sample_rate, dat, 4); //sample_rate = dat[0]|(dat[1]<<8)|(dat[2]<<16)|(dat[3]<<24); - - if (fread(dat, 1, 4, fp) < 4) return -1; - if (fread(dat, 1, 2, fp) < 2) return -1; - //byte = dat[0] + (dat[1] << 8); - - if (fread(dat, 1, 2, fp) < 2) return -1; - bits_sample = dat[0] + (dat[1] << 8); - - // pos_dat = 36L + info - for ( ; ; ) { - if ( (byte=fgetc(fp)) == EOF ) return -1; - txt[p % 4] = byte; - p++; if (p==4) p=0; - if (findstr(txt, "data", p) == 4) break; - } - if (fread(dat, 1, 4, fp) < 4) return -1; - - - Serial.printf("sample_rate: %d\n", sample_rate); - Serial.printf("bits : %d\n", bits_sample); - Serial.printf("channels : %d\n", channels); - - if ((bits_sample != 8) && (bits_sample != 16)) return -1; - - samples_per_bit = sample_rate/(float)BAUD_RATE; - - Serial.printf("samples/bit: %.2f\n", samples_per_bit); - - return 0; -} -#endif - -#if 0 -#define EOF_INT 0x1000000 - -#define LEN_movAvg 3 -int movAvg[LEN_movAvg]; -unsigned long sample_count = 0; -double bitgrenze = 0; - -int read_signed_sample(FILE *fp) { // int = i32_t - int byte, i, sample, s=0; // EOF -> 0x1000000 - - for (i = 0; i < channels; i++) { - // i = 0: links bzw. mono - byte = fgetc(fp); - if (byte == EOF) return EOF_INT; - if (i == 0) sample = byte; - - if (bits_sample == 16) { - byte = fgetc(fp); - if (byte == EOF) return EOF_INT; - if (i == 0) sample += byte << 8; - } - - } - - if (bits_sample == 8) s = sample-128; // 8bit: 00..FF, centerpoint 0x80=128 - if (bits_sample == 16) s = (short)sample; - - if (option_avg) { - movAvg[sample_count % LEN_movAvg] = s; - s = 0; - for (i = 0; i < LEN_movAvg; i++) s += movAvg[i]; - s = (s+0.5) / LEN_movAvg; - } - - sample_count++; - - return s; -} - -int par=1, par_alt=1; - -int read_bits_fsk(FILE *fp, int *bit, int *len) { - static int sample; - int n, y0; - float l, x1; - static float x0; - - n = 0; - do{ - y0 = sample; - sample = read_signed_sample(fp); - if (sample == EOF_INT) return EOF; - //sample_count++; // in read_signed_sample() - par_alt = par; - par = (sample >= 0) ? 1 : -1; // 8bit: 0..127,128..255 (-128..-1,0..127) - n++; - } while (par*par_alt > 0); - - if (!option_res) l = (float)n / samples_per_bit; - else { // genauere Bitlaengen-Messung - x1 = sample/(float)(sample-y0); // hilft bei niedriger sample rate - l = (n+x0-x1) / samples_per_bit; // meist mehr frames (nicht immer) - x0 = x1; - } - - *len = (int)(l+0.5); - - if (!option_inv) *bit = (1+par_alt)/2; // oben 1, unten -1 - else *bit = (1-par_alt)/2; // sdr#= 0) ? 1 : -1; // 8bit: 0..127,128..255 (-128..-1,0..127) - sum += sample; - n++; - } while (sample_count < bitgrenze); // n < samples_per_bit - - if (sum >= 0) *bit = 1; - else *bit = 0; - - if (option_inv) *bit ^= 1; - - return 0; -} - -/* ------------------------------------------------------------------------------------ */ - -// manchester1 1->10,0->01: 1.bit -// manchester2 0->10,1->01: 2.bit -// RS92-SGP: 8N1 manchester2 -char manch(char *mbits) { - if ((mbits[0] == 1) && (mbits[1] == 0)) return 0; - else if ((mbits[0] == 0) && (mbits[1] == 1)) return 1; - else return -1; -} -int bits2byte(char bits[]) { - int i, byteval=0, d=1; - int bit8[8]; - - if (manch(bits+0) != 0) return 0x100; - for (i = 0; i < 8; i++) { - bit8[i] = manch(bits+2*(i+1)); - } - if (manch(bits+(2*(8+1))) != 1) return 0x100; - - for (i = 0; i < 8; i++) { // little endian - if (bit8[i] == 1) byteval += d; - else if (bit8[i] == 0) byteval += 0; - else return 0x100; - d <<= 1; - } - return byteval; -} - - -void inc_bufpos() { - bufpos = (bufpos+1) % HEADLEN; -} - -int compare() { - int i=0, j = bufpos; - - while (i < HEADLEN) { - if (j < 0) j = HEADLEN-1; - if (buf[j] != header[HEADOFS+HEADLEN-1-i]) break; - j--; - i++; - } - return i; -} -#endif - -/* -uint8_t xorbyte(int pos) { - return xframe[pos] ^ mask[pos % MASK_LEN]; -} -*/ uint8_t framebyte(int pos) { return frame[pos]; } @@ -698,53 +459,6 @@ void prn12(uint8_t *prn_le, uint8_t prns[12]) { } -int calc_satpos_alm(EPHEM_t alm[], double t, SAT_t *satp) { - return -1; -#if 0 - double X, Y, Z, vX, vY, vZ; - int j; - int week; - double cl_corr, cl_drift; - - for (j = 1; j < 33; j++) { - if (alm[j].prn > 0) { // prn==j - - // Woche hat 604800 sec - if (t-alm[j].toa > WEEKSEC/2) rollover = +1; - else if (t-alm[j].toa < -WEEKSEC/2) rollover = -1; - else rollover = 0; - week = alm[j].week - rollover; - /*if (j == 1)*/ gpx.week = week + GPS_WEEK1024*1024; - - if (option_vel >= 2) { - GPS_SatellitePositionVelocity_Ephem( - week, t, alm[j], - &cl_corr, &cl_drift, &X, &Y, &Z, &vX, &vY, &vZ - ); - satp[alm[j].prn].clock_drift = cl_drift; - satp[alm[j].prn].vX = vX; - satp[alm[j].prn].vY = vY; - satp[alm[j].prn].vZ = vZ; - } - else { - GPS_SatellitePosition_Ephem( - week, t, alm[j], - &cl_corr, &X, &Y, &Z - ); - } - - satp[alm[j].prn].X = X; - satp[alm[j].prn].Y = Y; - satp[alm[j].prn].Z = Z; - satp[alm[j].prn].clock_corr = cl_corr; - - } - } - - return 0; -#endif -} - int calc_satpos_rnx(EPHEM_t eph[][24], double t, SAT_t *satp) { double X, Y, Z, vX, vY, vZ; int j, i, ti; @@ -924,12 +638,10 @@ int get_pseudorange() { // GPS Sat Pos (& Vel) - //if (almanac) calc_satpos_alm( alm, gpstime/1000.0, sat); if (ephem) calc_satpos_rnx2(ephs, gpstime/1000.0, sat); // GPS Sat Pos t -= 1s if (option_vel == 1) { - //if (almanac) calc_satpos_alm( alm, gpstime/1000.0-1, sat1s); if (ephem) calc_satpos_rnx2(ephs, gpstime/1000.0-1, sat1s); } @@ -1477,259 +1189,3 @@ void get_eph(const char *file) { if (!option_der) d_err = 1000; } - - -#if 0 -int main(int argc, char *argv[]) { - - FILE *fp, *fp_alm = NULL, *fp_eph = NULL; - char *fpname; - char bitbuf[BITS]; - int bit_count = 0, - byte_count = FRAMESTART, - header_found = 0, - byte, i; - int bit, len; - char *pbuf = NULL; - -#ifdef CYGWIN - _setmode(_fileno(stdin), _O_BINARY); -#endif - setbuf(stdout, NULL); - - fpname = argv[0]; - ++argv; - while ((*argv) && (!fileloaded)) { - if ( (strcmp(*argv, "-h") == 0) || (strcmp(*argv, "--help") == 0) ) { - Serial.printf("%s [options] \n", fpname); - Serial.printf(" file: audio.wav or raw_data\n"); - Serial.printf(" options:\n"); - Serial.printf(" --vel; --vel1, --vel2 (-g2)\n"); - Serial.printf(" -v, -vx, -vv\n"); - Serial.printf(" -r, --raw\n"); - Serial.printf(" -i, --invert\n"); - Serial.printf(" -a, --almanac \n"); - Serial.printf(" -e, --ephem \n"); - Serial.printf(" -g1 (verbose GPS: 4 sats)\n"); - Serial.printf(" -g2 (verbose GPS: all sats)\n"); - Serial.printf(" -gg (vverbose GPS)\n"); - Serial.printf(" --crc (CRC check GPS)\n"); - Serial.printf(" --rawin1,2 (raw_data file)\n"); - return 0; - } - else if ( (strcmp(*argv, "--vel") == 0) ) { - option_vel = 4; - } - else if ( (strcmp(*argv, "--vel1") == 0) ) { - option_vel = 1; - if (option_vergps < 1) option_vergps = 2; - } - else if ( (strcmp(*argv, "--vel2") == 0) ) { - option_vel = 2; - if (option_vergps < 1) option_vergps = 2; - } - else if ( (strcmp(*argv, "--iter") == 0) ) { - option_iter = 1; - } - else if ( (strcmp(*argv, "-v") == 0) ) { - option_verbose = 1; - } - else if ( (strcmp(*argv, "-vv") == 0) ) { - option_verbose = 4; - } - else if ( (strcmp(*argv, "-vx") == 0) ) { - option_aux = 1; - } - else if (strcmp(*argv, "--crc") == 0) { option_crc = 1; } - else if ( (strcmp(*argv, "-r") == 0) || (strcmp(*argv, "--raw") == 0) ) { - option_raw = 1; - } - else if ( (strcmp(*argv, "-i") == 0) || (strcmp(*argv, "--invert") == 0) ) { - option_inv = 1; - } - else if ( (strcmp(*argv, "-a") == 0) || (strcmp(*argv, "--almanac") == 0) ) { - ++argv; - if (*argv) fp_alm = fopen(*argv, "r"); // txt-mode - else return -1; - if (fp_alm == NULL) Serial.printf("[almanac] %s konnte nicht geoeffnet werden\n", *argv); - } - else if ( (strcmp(*argv, "-e") == 0) || (strncmp(*argv, "--ephem", 7) == 0) ) { - ++argv; - if (*argv) fp_eph = fopen(*argv, "rb"); // bin-mode - else return -1; - if (fp_eph == NULL) Serial.printf("[rinex] %s konnte nicht geoeffnet werden\n", *argv); - } - else if ( (strcmp(*argv, "--dop") == 0) ) { - ++argv; - if (*argv) { - dop_limit = atof(*argv); - if (dop_limit <= 0 || dop_limit >= 100) dop_limit = 9.9; - } - else return -1; - } - else if ( (strcmp(*argv, "--der") == 0) ) { - ++argv; - if (*argv) { - d_err = atof(*argv); - if (d_err <= 0 || d_err >= 100000) d_err = 10000; - else option_der = 1; - } - else return -1; - } - else if ( (strcmp(*argv, "--exsat") == 0) ) { - ++argv; - if (*argv) { - exSat = atoi(*argv); - if (exSat < 1 || exSat > 32) exSat = -1; - } - else return -1; - } - else if (strcmp(*argv, "-g1") == 0) { option_vergps = 1; } // verbose1 GPS - else if (strcmp(*argv, "-g2") == 0) { option_vergps = 2; } // verbose2 GPS (bancroft) - else if (strcmp(*argv, "-gg") == 0) { option_vergps = 8; } // vverbose GPS - else if (strcmp(*argv, "--rawin1") == 0) { rawin = 2; } // raw_txt input1 - else if (strcmp(*argv, "--rawin2") == 0) { rawin = 3; } // raw_txt input2 (SM) - else if ( (strcmp(*argv, "--avg") == 0) ) { - option_avg = 1; - } - else if (strcmp(*argv, "-b") == 0) { option_b = 1; } - else { - if (!rawin) fp = fopen(*argv, "rb"); - else fp = fopen(*argv, "r"); - if (fp == NULL) { - Serial.printf("%s konnte nicht geoeffnet werden\n", *argv); - return -1; - } - fileloaded = 1; - } - ++argv; - } - if (!fileloaded) fp = stdin; - - if (fp_alm) { - i = read_SEMalmanac(fp_alm, alm); - if (i == 0) { - almanac = 1; - } - fclose(fp_alm); - if (!option_der) d_err = 4000; - } - if (fp_eph) { - /* i = read_RNXephemeris(fp_eph, eph); - if (i == 0) { - ephem = 1; - almanac = 0; - } - fclose(fp_eph); */ - ephs = read_RNXpephs(fp_eph); - if (ephs) { - ephem = 1; - almanac = 0; - } - fclose(fp_eph); - if (!option_der) d_err = 1000; - } - - - if (!rawin) { - - i = read_wav_header(fp); - if (i) { - fclose(fp); - return -1; - } - - while (!read_bits_fsk(fp, &bit, &len)) { - - if (len == 0) { // reset_frame(); - if (byte_count > pos_SondeID+8) { - if (byte_count < FRAME_LEN-20) err_gps = 1; - print_frame(byte_count); - err_gps = 0; - } - bit_count = 0; - byte_count = FRAMESTART; - header_found = 0; - inc_bufpos(); - buf[bufpos] = 'x'; - continue; // ... - } - - for (i = 0; i < len; i++) { - - inc_bufpos(); - buf[bufpos] = 0x30 + bit; // Ascii - - if (!header_found) { - if (compare() >= HEADLEN) header_found = 1; - } - else { - bitbuf[bit_count] = bit; - bit_count++; - - if (bit_count == BITS) { - bit_count = 0; - byte = bits2byte(bitbuf); - frame[byte_count] = byte; - byte_count++; - if (byte_count == FRAME_LEN) { - byte_count = FRAMESTART; - header_found = 0; - //inc_bufpos(); - //buf[bufpos] = 'x'; - print_frame(FRAME_LEN); - } - } - } - } - if (header_found && option_b) { - bitstart = 1; - - while ( byte_count < FRAME_LEN ) { - if (read_rawbit(fp, &bit) == EOF) break; - bitbuf[bit_count] = bit; - bit_count++; - if (bit_count == BITS) { - bit_count = 0; - byte = bits2byte(bitbuf); - frame[byte_count] = byte; - byte_count++; - } - } - header_found = 0; - print_frame(byte_count); - byte_count = FRAMESTART; - - } - } - - } - else //if (rawin) - { - if (rawin == 3) frameofs = 5; - - while (1 > 0) { - - pbuf = fgets(buffer_rawin, rawin*FRAME_LEN+4, fp); - if (pbuf == NULL) break; - buffer_rawin[rawin*FRAME_LEN+1] = '\0'; - len = strlen(buffer_rawin) / rawin; - if (len > pos_SondeID+8) { - for (i = 0; i < len-frameofs; i++) { //%2x SCNx8=%hhx(inttypes.h) - sscanf(buffer_rawin+rawin*i, "%2hhx", frame+frameofs+i); - // wenn ohne %hhx: sscanf(buffer_rawin+rawin*i, "%2x", &byte); frame[frameofs+i] = (uint8_t)byte; - } - if (len < FRAME_LEN-20) err_gps = 1; - print_frame(len); - err_gps = 0; - } - } - } - - free(ephs); - fclose(fp); - - return 0; -} - -#endif diff --git a/libraries/SondeLib/rs92gps.h b/RX_FSK/src/rs92gps.h similarity index 100% rename from libraries/SondeLib/rs92gps.h rename to RX_FSK/src/rs92gps.h diff --git a/libraries/SondeLib/rsc.cpp b/RX_FSK/src/rsc.cpp similarity index 100% rename from libraries/SondeLib/rsc.cpp rename to RX_FSK/src/rsc.cpp diff --git a/libraries/SondeLib/rsc.h b/RX_FSK/src/rsc.h similarity index 100% rename from libraries/SondeLib/rsc.h rename to RX_FSK/src/rsc.h diff --git a/libraries/SondeLib/rsc_decode.cpp b/RX_FSK/src/rsc_decode.cpp similarity index 100% rename from libraries/SondeLib/rsc_decode.cpp rename to RX_FSK/src/rsc_decode.cpp diff --git a/RX_FSK/version.h b/RX_FSK/version.h index e356351..2b47269 100644 --- a/RX_FSK/version.h +++ b/RX_FSK/version.h @@ -1,4 +1,4 @@ const char *version_name = "rdzTTGOsonde"; -const char *version_id = "devel20210908b"; +const char *version_id = "devel20210912"; const int SPIFFS_MAJOR=2; const int SPIFFS_MINOR=14; diff --git a/platformio.ini b/platformio.ini index c9941b0..44b3fd5 100644 --- a/platformio.ini +++ b/platformio.ini @@ -22,12 +22,15 @@ lib_deps_external = stevemarple/MicroNMEA @ ^2.0.5 ; nkawu/TFT 22 ILI9225 @ ^1.4.4 me-no-dev/ESP Async WebServer @ ^1.2.3 - https://github.com/moononournation/Arduino_GFX + https://github.com/moononournation/Arduino_GFX#v1.1.5 +; most recent has compile error (initialization order wrong) +; https://github.com/moononournation/Arduino_GFX https://github.com/dx168b/async-mqtt-client [env:ttgo-lora32] platform = https://github.com/platformio/platform-espressif32.git board = ttgo-lora32-v1 +; board_build.partitions = partition.csv framework = arduino monitor_speed = 115200 lib_deps = diff --git a/scripts/makeimage.py b/scripts/makeimage.py index a713c30..b51d710 100755 --- a/scripts/makeimage.py +++ b/scripts/makeimage.py @@ -55,6 +55,7 @@ spiproc = subprocess.Popen([MKSPIFFS,'-c',data_dir,'-b','4096','-p','256','-s',s spiproc.wait(); files_in = [ +## for arduino esp32 2.0 ('bootloader', OFFSET_BOOTLOADER, esp32tools+"/sdk/esp32/bin/bootloader_dio_80m.bin"), ('bootloader', OFFSET_BOOTLOADER, esp32tools+"/sdk/bin/bootloader_dio_80m.bin"), ('partitions', OFFSET_PARTITIONS, file_part), ('bootapp0', OFFSET_BOOTAPP0, esp32tools+"/partitions/boot_app0.bin"),