kopia lustrzana https://github.com/dl9rdz/rdz_ttgo_sonde
exception workaround
rodzic
49bff43090
commit
f30c9b6d89
|
@ -0,0 +1,18 @@
|
|||
|
||||
Important behaviour of WiFiClient:
|
||||
|
||||
If anything goes wrong in a read or write operation on a WiFiClient, it internally
|
||||
will call WiFiClient.stop(), which sets _rxBuffer to NULL and connected to false.
|
||||
|
||||
Subsequently, any function call to WiFiClient that uses _rxBuffer will cause an
|
||||
>>> Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
|
||||
error and subsequent reboot.
|
||||
|
||||
available() is safe to call (it checks that rxBuffer is not null)
|
||||
write() is safe to call (it checks that connected is true)
|
||||
but read() and peek() are not.
|
||||
|
||||
This has been fixed in newer versions of the esp library, see
|
||||
https://github.com/espressif/arduino-esp32/commit/cb7aef1e886ffe43213f9a090e0a8968205a41df#diff-0d8101826fd3df09b38bef2aeca6d093de76841daf38f65f4fefbf6b56da8f81
|
||||
|
||||
So there is at least one reason to eventually upgrade to 2.0.0. Currently we stick to 1.0.6.
|
|
@ -3518,9 +3518,16 @@ void sondehub_station_update(WiFiClient * client, struct st_sondehub * conf) {
|
|||
Serial.println(data);
|
||||
Serial.println("Waiting for response");
|
||||
// TODO: better do this asyncrhonously
|
||||
String response = client->readString();
|
||||
Serial.println(response);
|
||||
Serial.println("Response done...");
|
||||
// At least, do this safely. See Notes-on-Using-WiFiClient.txt for details
|
||||
// If any of the client->print failed before (remote end closed connection),
|
||||
// then calling client->read will cause a LoadProhibited exception
|
||||
if(client->connected()) {
|
||||
String response = client->readString();
|
||||
Serial.println(response);
|
||||
Serial.println("Response done...");
|
||||
} else {
|
||||
Serial.println("SH client connection closed\n");
|
||||
}
|
||||
//client->stop();
|
||||
}
|
||||
|
||||
|
|
|
@ -1363,7 +1363,6 @@ void Display::drawKilltimer(DispEntry *de) {
|
|||
#define PI (3.1415926535897932384626433832795)
|
||||
#endif
|
||||
// defined by Arduino.h #define radians(x) ( (x)*180.0F/PI )
|
||||
#define FAKEGPS 0
|
||||
|
||||
extern int lastCourse; // from RX_FSK.ino
|
||||
|
||||
|
@ -1376,42 +1375,22 @@ float calcLatLonDist(float lat1, float lon1, float lat2, float lon2) {
|
|||
}
|
||||
|
||||
void Display::calcGPS() {
|
||||
// base data
|
||||
#if 0
|
||||
#if FAKEGPS
|
||||
gpsValid = true;
|
||||
gpsLat = 48.9;
|
||||
gpsLon = 13.3;
|
||||
gpsAlt = 33000;
|
||||
static int tmpc=0;
|
||||
tmpc = (tmpc+5)%360;
|
||||
gpsCourse = tmpc;
|
||||
#else
|
||||
gpsValid = nmea.isValid();
|
||||
gpsLon = nmea.getLongitude()*0.000001;
|
||||
gpsLat = nmea.getLatitude()*0.000001;
|
||||
long alt = 0;
|
||||
nmea.getAltitude(alt); gpsAlt=(int)(alt/1000);
|
||||
gpsCourse = (int)(nmea.getCourse()/1000);
|
||||
gpsCourseOld = false;
|
||||
if(gpsCourse==0) {
|
||||
// either north or not new
|
||||
if(lastCourse!=0) // use old value...
|
||||
{
|
||||
gpsCourseOld = true;
|
||||
gpsCourse = lastCourse;
|
||||
}
|
||||
float mylat = sonde.config.rxlat;
|
||||
float mylon = sonde.config.rxlon;
|
||||
bool valid = !(isnan(mylat)||isnan(mylon));
|
||||
if( gpsPos.valid) {
|
||||
mylat = gpsPos.lat;
|
||||
mylon = gpsPos.lon;
|
||||
valid = true;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
// distance
|
||||
if( gpsPos.valid && (sonde.si()->d.validPos&0x03)==0x03 && (layout->usegps&GPSUSE_DIST)) {
|
||||
if( valid && (sonde.si()->d.validPos&0x03)==0x03 && (layout->usegps&GPSUSE_DIST)) {
|
||||
gpsDist = (int)calcLatLonDist(gpsPos.lat, gpsPos.lon, sonde.si()->d.lat, sonde.si()->d.lon);
|
||||
} else {
|
||||
gpsDist = -1;
|
||||
}
|
||||
// bearing
|
||||
if( gpsPos.valid && (sonde.si()->d.validPos&0x03)==0x03 && (layout->usegps&GPSUSE_BEARING)) {
|
||||
if( valid && (sonde.si()->d.validPos&0x03)==0x03 && (layout->usegps&GPSUSE_BEARING)) {
|
||||
float lat1 = radians(gpsPos.lat);
|
||||
float lat2 = radians(sonde.si()->d.lat);
|
||||
float lon1 = radians(gpsPos.lon);
|
||||
|
@ -1471,7 +1450,7 @@ void Display::drawGPS(DispEntry *de) {
|
|||
if( (sonde.si()->d.validPos&0x03)!=0x03 ) {
|
||||
snprintf(buf, 16, "no pos ");
|
||||
if(de->extra && *de->extra=='5') buf[5]=0;
|
||||
} else if(!gpsPos.valid) {
|
||||
} else if( disp.gpsDist < 0 ) {
|
||||
snprintf(buf, 16, "no gps ");
|
||||
if(de->extra && *de->extra=='5') buf[5]=0;
|
||||
} else {
|
||||
|
@ -1491,7 +1470,7 @@ void Display::drawGPS(DispEntry *de) {
|
|||
break;
|
||||
case 'I':
|
||||
// dIrection
|
||||
if( (!gpsPos.valid) || ((sonde.si()->d.validPos&0x03)!=0x03 ) ) {
|
||||
if( disp.gpsDir<0 ) { // 0..360 valid, -1 invalid
|
||||
drawString(de, "---");
|
||||
break;
|
||||
}
|
||||
|
@ -1503,7 +1482,7 @@ void Display::drawGPS(DispEntry *de) {
|
|||
break;
|
||||
case 'B':
|
||||
// relative bearing
|
||||
if( (!gpsPos.valid) || ((sonde.si()->d.validPos&0x03)!=0x03 ) ) {
|
||||
if( disp.gpsBear < 0 ) { // 0..360 valid, -1 invalid
|
||||
drawString(de, "---");
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const char *version_name = "rdzTTGOsonde";
|
||||
const char *version_id = "devel20210924c";
|
||||
const char *version_id = "devel20210925";
|
||||
const int SPIFFS_MAJOR=2;
|
||||
const int SPIFFS_MINOR=16;
|
||||
|
|
Ładowanie…
Reference in New Issue