diff --git a/README.md b/README.md index 98e6705..49163e6 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,8 @@ SondeHub integration has mainly been tested with RS41 and DFM. Support for other radiosondes that use AFSK modulation is not feasible with the TTGO hardware. -In particular, decoding iMet radiosondes is not practical. +In particular, decoding iMet-1/iMet-4 radiosondes is not practical (iMet-5x seems to use FSK, +so should be feasible to implement). Adding support for LMS6 (see issue #48) and ims100 (see branch ims100) could be feasible, but currently I don't have plans to do add this myself. Well-tested pull requests will of diff --git a/RX_FSK/data/livemap.js b/RX_FSK/data/livemap.js index c8f3c8d..0ff62da 100644 --- a/RX_FSK/data/livemap.js +++ b/RX_FSK/data/livemap.js @@ -321,7 +321,7 @@ headtxt = function(data,stat) { var datetime = m.getUTCFullYear() + "-" + az(m.getUTCMonth()+1) + "-" + az(m.getUTCDate()) + "T" + az(m.getUTCHours()) + ":" + az(m.getUTCMinutes()) + ":" + az(m.getUTCSeconds()) + "Z"; var url = 'https://predict.cusf.co.uk/api/v1/'; - url += '?launch_latitude='+data.lat + '&launch_longitude='+data.lon; + url += '?launch_latitude='+data.lat + '&launch_longitude='+fix_lon(data.lon); url += '&launch_altitude='+data.alt + '&launch_datetime='+datetime; url += '&ascent_rate='+ascent + '&burst_altitude=' + burst + '&descent_rate='+descent; @@ -333,11 +333,11 @@ headtxt = function(data,stat) { draw_predict = function(prediction,data) { var ascending = prediction.prediction[0].trajectory; var highest = ascending[ascending.length-1]; - var highest_location = [highest.latitude,highest.longitude]; + var highest_location = [highest.latitude,fix_lon(highest.longitude)]; var descending = prediction.prediction[1].trajectory; var landing = descending[descending.length-1]; - var landing_location = [landing.latitude,landing.longitude]; + var landing_location = [landing.latitude,fix_lon(landing.longitude)]; if (!marker_landing) { marker_landing = L.marker(landing_location,{icon: icon_landing}).addTo(map) @@ -353,7 +353,7 @@ headtxt = function(data,stat) { dots_predict=[]; if (data.climb > 0) { - ascending.forEach(p => dots_predict.push([p.latitude,p.longitude])); + ascending.forEach(p => dots_predict.push([p.latitude,fix_lon(p.longitude)])); if (!marker_burst) { marker_burst = L.marker(highest_location,{icon:icon_burst}).addTo(map).bindPopup(poptxt('burst',highest),{closeOnClick:false, autoPan:false}); @@ -365,7 +365,7 @@ headtxt = function(data,stat) { } } - descending.forEach(p => dots_predict.push([p.latitude,p.longitude])); + descending.forEach(p => dots_predict.push([p.latitude,fix_lon(p.longitude)])); line_predict.setLatLngs(dots_predict); if (data.climb > 0) { @@ -378,6 +378,12 @@ headtxt = function(data,stat) { clearTimeout(predictor); predictor = setTimeout(function() {get_predict(last_data);}, predictor_time*1000); }; + + fix_lon = function(lon) { + if (lon > 180) { return lon - 360; } + if (lon < 0) { return lon + 360; } + return lon; + }; poptxt = function(t,i) { var lat_input = (i.id)?i.lat:i.latitude; diff --git a/RX_FSK/version.h b/RX_FSK/version.h index 2aef016..eae4680 100644 --- a/RX_FSK/version.h +++ b/RX_FSK/version.h @@ -1,4 +1,4 @@ const char *version_name = "rdzTTGOsonde"; -const char *version_id = "devel20210817"; +const char *version_id = "devel20210905"; const int SPIFFS_MAJOR=2; const int SPIFFS_MINOR=14; diff --git a/libraries/SondeLib/Sonde.cpp b/libraries/SondeLib/Sonde.cpp index 9f6f6c2..5e9af67 100644 --- a/libraries/SondeLib/Sonde.cpp +++ b/libraries/SondeLib/Sonde.cpp @@ -122,6 +122,11 @@ void Sonde::defaultConfig() { #define BM8563_ADDRESS 0x51 Wire.beginTransmission(BM8563_ADDRESS); byte err = Wire.endTransmission(); + if(err) { // try again + delay(400); + Wire.beginTransmission(BM8563_ADDRESS); + err = Wire.endTransmission(); + } if(err==0) { Serial.println("M5stack Core2 board detected\n"); config.type = TYPE_M5_CORE2; @@ -447,6 +452,10 @@ void Sonde::addSonde(float frequency, SondeType type, int active, char *launchsi return; } Serial.printf("Adding %f - %d - %d - %s\n", frequency, type, active, launchsite); + // reset all data if type or frequency has changed + if(type != sondeList[nSonde].type || frequency != sondeList[nSonde].freq) { + memset(&sondeList[nSonde], 0, sizeof(SondeInfo)); + } sondeList[nSonde].type = type; sondeList[nSonde].typestr[0] = 0; sondeList[nSonde].freq = frequency;