2019-01-26 17:02:19 +00:00
|
|
|
/*
|
|
|
|
* rte_wx.c
|
|
|
|
*
|
|
|
|
* Created on: 26.01.2019
|
|
|
|
* Author: mateusz
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2019-01-26 22:18:25 +00:00
|
|
|
#include <rte_wx.h>
|
2019-01-26 17:02:19 +00:00
|
|
|
|
|
|
|
float rte_wx_temperature_dallas = 0.0f, rte_wx_temperature_dallas_valid = 0.0f;
|
2019-12-22 11:34:03 +00:00
|
|
|
float rte_wx_temperature_dalls_slew_rate = 0.0f;
|
2019-10-27 19:50:01 +00:00
|
|
|
float rte_wx_temperature_average_dallas_valid = 0.0f;
|
|
|
|
float rte_wx_temperature_min_dallas_valid = 0.0f, rte_wx_temperature_max_dallas_valid = 0.0f;
|
|
|
|
float rte_wx_temperature_ms = 0.0f, rte_wx_temperature_ms_valid = 0.0f;
|
2019-01-26 17:02:19 +00:00
|
|
|
float rte_wx_pressure = 0.0f, rte_wx_pressure_valid = 0.0f;
|
2020-03-06 19:24:20 +00:00
|
|
|
float rte_wx_pressure_history[PRESSURE_AVERAGE_LN];
|
|
|
|
uint8_t rte_wx_pressure_it;
|
2019-01-26 17:02:19 +00:00
|
|
|
|
2019-12-27 21:07:24 +00:00
|
|
|
uint16_t rte_wx_windspeed_pulses = 0;
|
2020-01-04 13:15:33 +00:00
|
|
|
uint16_t rte_wx_windspeed[WIND_AVERAGE_LEN];
|
|
|
|
uint8_t rte_wx_windspeed_it = 0;
|
|
|
|
uint16_t rte_wx_winddirection[WIND_AVERAGE_LEN];
|
|
|
|
uint8_t rte_wx_winddirection_it = 0;
|
2020-02-01 22:20:17 +00:00
|
|
|
uint16_t rte_wx_winddirection_last = 0;
|
2020-01-04 13:15:33 +00:00
|
|
|
uint16_t rte_wx_average_windspeed = 0;
|
|
|
|
uint16_t rte_wx_max_windspeed = 0;
|
|
|
|
int16_t rte_wx_average_winddirection = 0;
|
2019-12-27 21:07:24 +00:00
|
|
|
|
2019-05-05 07:48:51 +00:00
|
|
|
uint8_t rte_wx_tx20_excessive_slew_rate = 0;
|
|
|
|
|
2019-01-26 17:02:19 +00:00
|
|
|
dht22Values rte_wx_dht, rte_wx_dht_valid; // quality factor inside this structure
|
2019-04-16 18:06:05 +00:00
|
|
|
DallasQF rte_wx_current_dallas_qf, rte_wx_error_dallas_qf = DALLAS_QF_UNKNOWN;
|
2019-10-27 19:50:01 +00:00
|
|
|
DallasAverage_t rte_wx_dallas_average;
|
2019-01-26 17:02:19 +00:00
|
|
|
ms5611_qf_t rte_wx_ms5611_qf;
|
|
|
|
|
2020-02-23 17:22:37 +00:00
|
|
|
#ifdef _UMB_MASTER
|
2020-02-23 06:50:22 +00:00
|
|
|
umb_frame_t rte_wx_umb;
|
2020-03-07 18:13:24 +00:00
|
|
|
umb_context_t rte_wx_umb_context;
|
2020-02-23 17:22:37 +00:00
|
|
|
uint8_t rte_wx_last_status = 0;
|
2020-02-23 06:50:22 +00:00
|
|
|
#endif
|
|
|
|
|
2020-01-04 13:15:33 +00:00
|
|
|
void rte_wx_init(void) {
|
|
|
|
int i = 0;
|
2019-01-26 17:02:19 +00:00
|
|
|
|
2020-01-04 13:15:33 +00:00
|
|
|
for (; i < WIND_AVERAGE_LEN; i++) {
|
|
|
|
rte_wx_windspeed[i] = 0;
|
|
|
|
rte_wx_winddirection[i] = 0;
|
|
|
|
}
|
2020-03-06 19:24:20 +00:00
|
|
|
|
|
|
|
rte_wx_pressure_it = 0;
|
|
|
|
|
|
|
|
for (i = 0; i < 4; i++) {
|
|
|
|
rte_wx_pressure_history[i] = 0.0f;
|
|
|
|
}
|
2020-01-04 13:15:33 +00:00
|
|
|
}
|