From 971a2e6d652f855fdd02e3e754dd84d777acea49 Mon Sep 17 00:00:00 2001 From: "Hansi, dl9rdz" Date: Thu, 23 Sep 2021 12:07:54 +0200 Subject: [PATCH 1/4] +RS41 P data --- RX_FSK/src/RS41.cpp | 40 ++++++++++++++++++++++++++++++++++++++-- RX_FSK/src/Sonde.h | 7 ++++--- 2 files changed, 42 insertions(+), 5 deletions(-) diff --git a/RX_FSK/src/RS41.cpp b/RX_FSK/src/RS41.cpp index c423fb7..ce6768d 100644 --- a/RX_FSK/src/RS41.cpp +++ b/RX_FSK/src/RS41.cpp @@ -554,6 +554,36 @@ static float _RS41_waterVaporSaturationPressure (float Tcelsius) return p / 100.0f; } +#define PM(x) calibration->value.matrixP[x] +// CALIB_P: matrixP (frames 0x25..0x2A) and type (frame 0x21) +#define CALIB_P ((0x3Fll<<0x25)|(1ll<<0x21)) +float GetRAP( uint32_t m, uint32_t m1, uint32_t m2, int16_t ptraw) { + struct subframeBuffer *calibration = (struct subframeBuffer *)sonde.si()->extra; + float pt = (float)ptraw*0.01; + float pw[6]; + pw[0] = PM(0) + pt*PM(7) + pt*pt*PM(11) + pt*pt*pt*PM(15); + pw[1] = PM(1) + pt*PM(8) + pt*pt*PM(12) + pt*pt*pt*PM(16); + pw[2] = PM(2) + pt*PM(9) + pt*pt*PM(13) + pt*pt*pt*PM(17); + pw[3] = PM(3) + pt*PM(10)+ pt*pt*PM(14); + pw[4] = PM(4); + pw[5] = PM(5); + float f = (float)m; //meas[9]; + float f1 = (float)m1; //meas[10]; + float f2 = (float)m2; //meas[11]; + float r = f-f1; + if(r!=0.0) { + r = (f2-f1) * PM(6) / r; + float xx = 1.0; + float p = 0.0; + for(int i=0; i<=5; i++) { + p += pw[i] * xx; + xx = xx * r; + } + return p; + } + return NAN; +} + // taken from https://github.com/einergehtnochrein/ra-firmware float GetRATemp( uint32_t measuredCurrent, uint32_t refMin, uint32_t refMax, float calT, float taylorT[3], float polyT[6] ) { struct subframeBuffer *calibration = (struct subframeBuffer *)sonde.si()->extra; @@ -751,11 +781,10 @@ int RS41::decode41(byte *data, int maxlen) uint32_t tempHumiMain = getint24(data, 560, p+18); uint32_t tempHumiRef1 = getint24(data, 560, p+21); uint32_t tempHumiRef2 = getint24(data, 560, p+24); - #if 0 uint32_t pressureMain = getint24(data, 560, p+27); uint32_t pressureRef1 = getint24(data, 560, p+30); uint32_t pressureRef2 = getint24(data, 560, p+33); - #endif + int16_t ptraw = getint16(data, 560, p+38); #if 0 Serial.printf( "External temp: tempMeasMain = %ld, tempMeasRef1 = %ld, tempMeasRef2 = %ld\n", tempMeasMain, tempMeasRef1, tempMeasRef2 ); Serial.printf( "Rel Humidity: humidityMain = %ld, humidityRef1 = %ld, humidityRef2 = %ld\n", humidityMain, humidityRef1, humidityRef2 ); @@ -767,6 +796,13 @@ int RS41::decode41(byte *data, int maxlen) bool validExternalTemperature = calibration!=NULL && (calibration->valid & 0xF8) == 0xF8; bool validHumidity = calibration!=NULL && (calibration->valid & 0x7FE0001FFFF8) == 0x7FE0001FFFF8; + bool validPressure = calibration!=NULL && (calibration->valid & CALIB_P)==CALIB_P && calibration->value.names.variant[7]=='P'; + + if ( validPressure ) { + si->pressure = GetRAP( pressureMain, pressureRef1, pressureRef2, ptraw ); + Serial.printf("Pressure sensor = %f\n", si->pressure); + } + if ( validExternalTemperature ) { si->temperature = GetRATemp( tempMeasMain, tempMeasRef1, tempMeasRef2, calibration->value.calT, calibration->value.taylorT, calibration->value.polyT ); diff --git a/RX_FSK/src/Sonde.h b/RX_FSK/src/Sonde.h index 01db603..8381f0a 100644 --- a/RX_FSK/src/Sonde.h +++ b/RX_FSK/src/Sonde.h @@ -99,9 +99,10 @@ typedef struct st_sondedata { uint16_t launchKT, burstKT, countKT; uint16_t crefKT; // frame number in which countKT was last sent // sonde specific extra data, NULL if unused or not yet initialized, currently used for RS41 subframe data (calibration) - float temperature = -300.0; // platinum resistor temperature - float tempRHSensor = -300.0; // temperature of relative humidity sensor - float relativeHumidity = -1.0; // relative humidity + float temperature; // platinum resistor temperature + float tempRHSensor; // temperature of relative humidity sensor + float relativeHumidity; // relative humidity + float pressure; float batteryVoltage = -1; } SondeData; From 8d0d897c3bd0273a99b7a77049dc51f4ca7f59d9 Mon Sep 17 00:00:00 2001 From: "Hansi, dl9rdz" Date: Thu, 23 Sep 2021 12:10:58 +0200 Subject: [PATCH 2/4] RS41 P to sondehub --- RX_FSK/RX_FSK.ino | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/RX_FSK/RX_FSK.ino b/RX_FSK/RX_FSK.ino index 535f0b8..c8b942e 100644 --- a/RX_FSK/RX_FSK.ino +++ b/RX_FSK/RX_FSK.ino @@ -3749,6 +3749,12 @@ void sondehub_send_data(WiFiClient * client, SondeInfo * s, struct st_sondehub * w += strlen(w); } + // Only send pressure if provided + if (!isnan(s->d.pressure)) { + sprintf(w, "\"pressure\": %.1f,", s->d.pressure); + w += strlen(w); + } + // Only send burst timer if RS41 and fresh within the last 51s if ((realtype == STYPE_RS41) && (s->d.crefKT > 0) && (s->d.vframe - s->d.crefKT < 51)) { sprintf(w, "\"burst_timer\": %d,", (int)s->d.countKT); From 280dd6cef19f77cc2d652d7557d37dce94d1da51 Mon Sep 17 00:00:00 2001 From: "Hansi, dl9rdz" Date: Thu, 23 Sep 2021 12:11:25 +0200 Subject: [PATCH 3/4] +version update --- RX_FSK/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RX_FSK/version.h b/RX_FSK/version.h index 4fa1af3..9107600 100644 --- a/RX_FSK/version.h +++ b/RX_FSK/version.h @@ -1,4 +1,4 @@ const char *version_name = "rdzTTGOsonde"; -const char *version_id = "devel20210922"; +const char *version_id = "devel20210923"; const int SPIFFS_MAJOR=2; const int SPIFFS_MINOR=16; From 469d64ab01e6afb845e688073a1fe239ea91b319 Mon Sep 17 00:00:00 2001 From: "Hansi, dl9rdz" Date: Thu, 23 Sep 2021 12:16:06 +0200 Subject: [PATCH 4/4] update default config for RS92 eph --- RX_FSK/data/config.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RX_FSK/data/config.txt b/RX_FSK/data/config.txt index 7babac7..73f7250 100644 --- a/RX_FSK/data/config.txt +++ b/RX_FSK/data/config.txt @@ -85,8 +85,8 @@ dfm.rxbw=10400 # s1: igs.bkg.bund.de/IGS/BRDC/ # s2: www.ngs.noaa.gov/cors/rinex/ #-------------------------------# -ephftp=www.ngs.noaa.gov/cors/rinex/ -#ephftp=igs.bkg.bund.de/IGS/BRDC/ +#ephftp=www.ngs.noaa.gov/cors/rinex/ +ephftp=igs.bkg.bund.de/IGS/BRDC/ #-------------------------------# # axudp for sending to aprsmap #-------------------------------#