diff --git a/RX_FSK/RX_FSK.ino b/RX_FSK/RX_FSK.ino index 00cb44c..d6f2eb4 100644 --- a/RX_FSK/RX_FSK.ino +++ b/RX_FSK/RX_FSK.ino @@ -1217,23 +1217,34 @@ void gpsTask(void *parameter) { #define UBX_SYNCH_2 0x62 uint8_t ubx_set9k6[]={UBX_SYNCH_1, UBX_SYNCH_2, 0x06, 0x00, 0x14, 0x00, 0x01, 0x00, 0x00, 0x00, 0xC0, 0x08, 0x00, 0x00, 0x80, 0x25, 0x00, 0x00, 0x03, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8D, 0x8F}; uint8_t ubx_factorydef[]={UBX_SYNCH_1, UBX_SYNCH_2, 0x06, 0x09, 13, 0, 0xff, 0xff, 0xff, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0x17, 0x8A }; +uint8_t ubx_hardreset[]={UBX_SYNCH_1, UBX_SYNCH_2, 0x06, 0x04, 4, 0, 0xff, 0xff, 0, 0, 0x0C, 0x5D }; void initGPS() { if (sonde.config.gps_rxd < 0) return; // GPS disabled if (sonde.config.gps_txd >= 0) { // TX enable, thus try setting baud to 9600 and do a factory reset - Serial.println("Trying to reset GPS..."); - Serial2.begin(115200, SERIAL_8N1, sonde.config.gps_rxd, sonde.config.gps_txd); - Serial2.write(ubx_set9k6, sizeof(ubx_set9k6)); - delay(100); - Serial2.begin(38400, SERIAL_8N1, sonde.config.gps_rxd, sonde.config.gps_txd); - Serial2.write(ubx_set9k6, sizeof(ubx_set9k6)); - delay(100); - Serial2.begin(19200, SERIAL_8N1, sonde.config.gps_rxd, sonde.config.gps_txd); - Serial2.write(ubx_set9k6, sizeof(ubx_set9k6)); - delay(100); - Serial2.begin(9600, SERIAL_8N1, sonde.config.gps_rxd, sonde.config.gps_txd); - Serial2.write(ubx_factorydef, sizeof(ubx_factorydef)); - delay(1000); + File testfile = SPIFFS.open("/GPSRESET", FILE_READ); + if(testfile && !testfile.isDirectory()) { + testfile.close(); + Serial.println("GPS factory reset..."); + Serial2.begin(115200, SERIAL_8N1, sonde.config.gps_rxd, sonde.config.gps_txd); + Serial2.write(ubx_set9k6, sizeof(ubx_set9k6)); + delay(100); + Serial2.begin(38400, SERIAL_8N1, sonde.config.gps_rxd, sonde.config.gps_txd); + Serial2.write(ubx_set9k6, sizeof(ubx_set9k6)); + delay(100); + Serial2.begin(19200, SERIAL_8N1, sonde.config.gps_rxd, sonde.config.gps_txd); + Serial2.write(ubx_set9k6, sizeof(ubx_set9k6)); + delay(100); + Serial2.begin(9600, SERIAL_8N1, sonde.config.gps_rxd, sonde.config.gps_txd); + Serial2.write(ubx_factorydef, sizeof(ubx_factorydef)); + delay(100); + Serial2.write(ubx_hardreset, sizeof(ubx_hardreset)); + //delay(5000); + SPIFFS.remove("/GPSRESET"); + } else if (testfile) { + Serial.println("GPS reset file: not found/isdir"); + testfile.close(); + } } else { Serial2.begin(9600, SERIAL_8N1, sonde.config.gps_rxd, sonde.config.gps_txd); } diff --git a/RX_FSK/data/GPSRESET b/RX_FSK/data/GPSRESET new file mode 100644 index 0000000..fd38861 --- /dev/null +++ b/RX_FSK/data/GPSRESET @@ -0,0 +1 @@ ++ diff --git a/RX_FSK/data/config.txt b/RX_FSK/data/config.txt index 4e8b2e8..bda55a1 100644 --- a/RX_FSK/data/config.txt +++ b/RX_FSK/data/config.txt @@ -26,7 +26,7 @@ #tft_cs=0 tft_orient=1 #gps_rxd=-1 -gps_txd=-1 +#gps_txd=-1 # Show AFC value (for RS41 and M10/M20, maybe also DFM, but not useful for RS92) showafc=1 # Frequency correction, in Hz diff --git a/RX_FSK/version.h b/RX_FSK/version.h index e702617..31a1153 100644 --- a/RX_FSK/version.h +++ b/RX_FSK/version.h @@ -1,4 +1,4 @@ const char *version_name = "rdzTTGOsonde"; -const char *version_id = "devel20210220"; +const char *version_id = "devel20210226"; const int SPIFFS_MAJOR=2; const int SPIFFS_MINOR=10; diff --git a/libraries/SondeLib/Display.cpp b/libraries/SondeLib/Display.cpp index 00a261b..8557c83 100644 --- a/libraries/SondeLib/Display.cpp +++ b/libraries/SondeLib/Display.cpp @@ -780,8 +780,8 @@ void Display::parseDispElement(char *text, DispEntry *de) de->extra = (char *)circinfo; } else { de->extra = strdup(text+1); + Serial.printf("parsing 'g' entry: extra is '%s'\n", de->extra); } - Serial.printf("parsing 'g' entry: extra is '%s'\n", de->extra); break; case 'r': de->func = disp.drawRSSI; break; @@ -839,7 +839,7 @@ int Display::countEntries(File f) { break; } f.seek(pos, SeekSet); - Serial.printf("Counted %d entries\n", n); + //Serial.printf("Counted %d entries\n", n); return n; } @@ -970,9 +970,11 @@ void Display::initFromFile(int index) { what++; newlayouts[idx].de[what].func = NULL; } else { +#if 0 for(int i=0; i<12; i++) { Serial.printf("action %d: %d\n", i, (int)newlayouts[idx].actions[i]); } +#endif what=-1; } break; diff --git a/libraries/SondeLib/Sonde.cpp b/libraries/SondeLib/Sonde.cpp index 6f16a14..0c9c590 100644 --- a/libraries/SondeLib/Sonde.cpp +++ b/libraries/SondeLib/Sonde.cpp @@ -114,6 +114,7 @@ void Sonde::defaultConfig() { //config.button2_pin = 255; config.button2_axp = 1; config.gps_rxd = 34; + config.gps_txd = 12; // Check for I2C-Display@21,22 #define SSD1306_ADDRESS 0x3c Wire.begin(21, 22);