kopia lustrzana https://github.com/SP8EBC/ParaTNC
better handling of gallas quality factor in the telemetry
rodzic
9075327d8c
commit
aabeafa8bf
|
@ -3,8 +3,8 @@
|
|||
|
||||
#include "aprs/ax25.h"
|
||||
|
||||
#define SW_VER "DB02"
|
||||
#define SW_DATE "04042019"
|
||||
#define SW_VER "DB03"
|
||||
#define SW_DATE "15042019"
|
||||
|
||||
#define SYSTICK_TICKS_PER_SECONDS 100
|
||||
#define SYSTICK_TICKS_PERIOD 10
|
||||
|
|
|
@ -19,7 +19,7 @@ extern float rte_wx_pressure, rte_wx_pressure_valid;
|
|||
|
||||
extern dht22Values rte_wx_dht, rte_wx_dht_valid;
|
||||
|
||||
extern DallasQF rte_wx_dallas_qf;
|
||||
extern DallasQF rte_wx_current_dallas_qf, rte_wx_error_dallas_qf;
|
||||
extern ms5611_qf_t rte_wx_ms5611_qf;
|
||||
|
||||
|
||||
|
|
|
@ -27,6 +27,8 @@ uint8_t packet_tx_telemetry_descr_counter = 35;
|
|||
|
||||
// this shall be called in 60 seconds periods
|
||||
void packet_tx_handler(void) {
|
||||
DallasQF dallas_qf = DALLAS_QF_UNKNOWN;
|
||||
|
||||
packet_tx_beacon_counter++;
|
||||
packet_tx_telemetry_counter++;
|
||||
packet_tx_telemetry_descr_counter++;
|
||||
|
@ -60,22 +62,36 @@ void packet_tx_handler(void) {
|
|||
|
||||
if (packet_tx_telemetry_counter >= packet_tx_telemetry_interval) {
|
||||
|
||||
// if there weren't any erros related to DS12B20 from previous function call
|
||||
if (rte_wx_error_dallas_qf == DALLAS_QF_UNKNOWN) {
|
||||
dallas_qf = rte_wx_current_dallas_qf; // ir might be DEGRADATED
|
||||
}
|
||||
|
||||
// if there were any errors
|
||||
else {
|
||||
// set the error reason
|
||||
dallas_qf = rte_wx_error_dallas_qf;
|
||||
|
||||
// and reset the error
|
||||
rte_wx_error_dallas_qf = DALLAS_QF_UNKNOWN;
|
||||
}
|
||||
|
||||
#ifdef _VICTRON
|
||||
//
|
||||
telemetry_send_values_pv(rx10m, digi10m, rte_pv_battery_current, rte_pv_battery_voltage, rte_pv_cell_voltage, rte_wx_dallas_qf, rte_wx_ms5611_qf, rte_wx_dht_valid.qf);
|
||||
telemetry_send_values_pv(rx10m, digi10m, rte_pv_battery_current, rte_pv_battery_voltage, rte_pv_cell_voltage, dallas_qf, rte_wx_ms5611_qf, rte_wx_dht_valid.qf);
|
||||
//
|
||||
#else
|
||||
//
|
||||
#if defined _DALLAS_AS_TELEM
|
||||
// if _DALLAS_AS_TELEM will be enabled the fifth channel will be set to temperature measured by DS12B20
|
||||
telemetry_send_values(rx10m, tx10m, digi10m, kiss10m, rte_wx_temperature_dallas_valid, rte_wx_dallas_qf, rte_wx_ms5611_qf, rte_wx_dht_valid.qf);
|
||||
telemetry_send_values(rx10m, tx10m, digi10m, kiss10m, rte_wx_temperature_dallas_valid, dallas_qf, rte_wx_ms5611_qf, rte_wx_dht_valid.qf);
|
||||
#elif defined _METEO
|
||||
// if _METEO will be enabled, but without _DALLAS_AS_TELEM the fifth channel will be used to transmit temperature from MS5611
|
||||
// which may be treated then as 'rack/cabinet internal temperature'. Dallas DS12B10 will be used for ragular WX frames
|
||||
telemetry_send_values(rx10m, tx10m, digi10m, kiss10m, rte_wx_temperature_valid, rte_wx_dallas_qf, rte_wx_ms5611_qf, rte_wx_dht.qf);
|
||||
telemetry_send_values(rx10m, tx10m, digi10m, kiss10m, rte_wx_temperature_valid, dallas_qf, rte_wx_ms5611_qf, rte_wx_dht.qf);
|
||||
#else
|
||||
// if user will disable both _METEO and _DALLAS_AS_TELEM value will be zeroed internally anyway
|
||||
telemetry_send_values(rx10m, tx10m, digi10m, kiss10m, 0.0f, rte_wx_dallas_qf, rte_wx_ms5611_qf, rte_wx_dht.qf);
|
||||
telemetry_send_values(rx10m, tx10m, digi10m, kiss10m, 0.0f, dallas_qf, rte_wx_ms5611_qf, rte_wx_dht.qf);
|
||||
#endif
|
||||
//
|
||||
#endif
|
||||
|
|
|
@ -13,7 +13,7 @@ float rte_wx_temperature = 0.0f, rte_wx_temperature_valid = 0.0f;
|
|||
float rte_wx_pressure = 0.0f, rte_wx_pressure_valid = 0.0f;
|
||||
|
||||
dht22Values rte_wx_dht, rte_wx_dht_valid; // quality factor inside this structure
|
||||
DallasQF rte_wx_dallas_qf;
|
||||
DallasQF rte_wx_current_dallas_qf, rte_wx_error_dallas_qf;
|
||||
ms5611_qf_t rte_wx_ms5611_qf;
|
||||
|
||||
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
#include "station_config.h"
|
||||
|
||||
#include "telemetry.h"
|
||||
|
||||
void wx_get_all_measurements(void) {
|
||||
|
||||
int32_t return_value = 0;
|
||||
|
@ -18,13 +20,26 @@ void wx_get_all_measurements(void) {
|
|||
#if defined _METEO || defined _DALLAS_AS_TELEM
|
||||
|
||||
// quering dallas DS12B20 thermometer for current temperature
|
||||
rte_wx_temperature_dallas = dallas_query(&rte_wx_dallas_qf);
|
||||
rte_wx_temperature_dallas = dallas_query(&rte_wx_current_dallas_qf);
|
||||
|
||||
// checking if communication was successfull
|
||||
if (rte_wx_temperature_dallas != -128.0f)
|
||||
if (rte_wx_temperature_dallas != -128.0f) {
|
||||
|
||||
// update the current temperature
|
||||
rte_wx_temperature_dallas_valid = rte_wx_temperature_dallas;
|
||||
else
|
||||
rte_wx_temperature_dallas_valid = 0.0f;
|
||||
|
||||
if (rte_wx_temperature_dallas_valid > TELEMETRY_MIN_DALLAS && rte_wx_temperature_dallas_valid < TELEMETRY_MAX_DALLAS)
|
||||
// and set the quality factor
|
||||
rte_wx_current_dallas_qf = DALLAS_QF_FULL;
|
||||
else
|
||||
rte_wx_current_dallas_qf = DALLAS_QF_DEGRADATED;
|
||||
}
|
||||
else {
|
||||
|
||||
rte_wx_error_dallas_qf = DALLAS_QF_NOT_AVALIABLE;
|
||||
}
|
||||
//else
|
||||
// rte_wx_temperature_dallas_valid = 0.0f;
|
||||
#endif
|
||||
|
||||
#ifdef _METEO
|
||||
|
|
|
@ -14,6 +14,9 @@
|
|||
|
||||
#include "./station_config.h"
|
||||
|
||||
#define TELEMETRY_MIN_DALLAS -25.0f
|
||||
#define TELEMETRY_MAX_DALLAS 38.75f
|
||||
|
||||
#ifdef _VICTRON
|
||||
#include "ve_direct_protocol/parser.h"
|
||||
#endif
|
||||
|
|
Ładowanie…
Reference in New Issue