internal watchdog enabled once again, fixed quality factor for modbus-rtu himidity sensors, average voltage margin for cutoff condition

master EB02
Mateusz Lubecki 2023-11-01 23:10:51 +01:00
rodzic d22917b322
commit eaee4cf588
8 zmienionych plików z 45 dodań i 8 usunięć

Wyświetl plik

@ -11,13 +11,15 @@
/**
* This is cutoff voltage at which the power saving subsystem will keep ParaMETEO constantly
* in L7 mode and wakeup once every 20 minutes to check B+ once again
* This is cutoff voltage (momentary / non averaged) at which the power saving
* subsystem will keep ParaMETEO constantly in L7 mode and wakeup once
* every PWR_SAVE_CUTOFF_SLEEP_TIME_IN_MINUTES minutes to check B+ once again
*/
#define PWR_SAVE_CUTOFF_VOLTAGE_DEF 1100u // 11.0V
/**
* This is the restore voltage a battery must be charged to for ParaMETEO to restore it's normal operation
* This is the restore voltage (averaged) a battery must be charged to
* for ParaMETEO to restore it's normal operation
*/
#define PWR_SAVE_STARTUP_RESTORE_VOLTAGE_DEF 1200u // 12.0V
@ -26,6 +28,14 @@
*/
#define PWR_SAVE_AGGRESIVE_POWERSAVE_VOLTAGE 1130u // 11.3V
/**
* How much average battery voltage must be greater than
* current (momentary) voltage to go to cutoff WHEN
* this current (momentary) voltage is below
* PWR_SAVE_CUTOFF_VOLTAGE_DEF
*/
#define PWR_SAVE_CUTOFF_AVG_VOLTAGE_MARGIN 100u // 0.1V
/**
* How long in minutes the controller will sleep in L7 state between checking
* if battery has been charged.

Wyświetl plik

@ -15,7 +15,7 @@
#define SYSTICK_TICKS_PER_SECONDS 100
#define SYSTICK_TICKS_PERIOD 10
//#define INTERNAL_WATCHDOG
#define INTERNAL_WATCHDOG
#define EXTERNAL_WATCHDOG
#define PWR_SWITCH_BOTH

Wyświetl plik

@ -80,7 +80,7 @@ extern float_average_t rte_wx_dallas_average;
extern ms5611_qf_t rte_wx_ms5611_qf;
extern bme280_qf_t rte_wx_bme280_qf;
extern analog_wind_qf_t rte_wx_wind_qf;
extern uint8_t rte_wx_humidity_available;
extern umb_frame_t rte_wx_umb;

Wyświetl plik

@ -9,7 +9,7 @@
#define SOFTWARE_VERSION_H_
#define SW_VER "EB02"
#define SW_DATE "29102023"
#define SW_DATE "31102023"
#define SW_KISS_PROTO "B"
extern const char software_version_str[5];

Wyświetl plik

@ -442,6 +442,23 @@ void packet_tx_handler(const config_data_basic_t * const config_basic, const con
humidity_qf = HUMIDITY_QF_NOT_AVALIABLE;
}
// additional check for modbus RTU humidity sensor
if (config_mode->wx_modbus == 1) {
// for sake of simplicity there is another variable
// which holds common information if valid humidity
// is available or not. This is kinda-sorta duplication of
// quality factors for each sensor types, although it
// simplifies few things and omits handling separate
// Modbus-RTU configuration here
if (rte_wx_humidity_available == 0) {
humidity_qf = HUMIDITY_QF_NOT_AVALIABLE;
}
else if (rte_wx_humidity_available == 1) {
humidity_qf = HUMIDITY_QF_FULL;
}
}
// wind quality factor
if (rte_wx_wind_qf == AN_WIND_QF_UNKNOWN) {
;

Wyświetl plik

@ -894,7 +894,7 @@ config_data_powersave_mode_t pwr_save_pooling_handler( const config_data_mode_t
backup_reg_set_monitor(23);
}
else {
if (vbatt_current <= PWR_SAVE_CUTOFF_VOLTAGE_DEF && vbatt_average <= PWR_SAVE_AGGRESIVE_POWERSAVE_VOLTAGE) {
if (vbatt_current <= PWR_SAVE_CUTOFF_VOLTAGE_DEF && vbatt_average <= (PWR_SAVE_CUTOFF_VOLTAGE_DEF + PWR_SAVE_CUTOFF_AVG_VOLTAGE_MARGIN)) {
backup_reg_set_monitor(22);
// if the battery voltage is below cutoff level and the ParaMETEO controller is currently not cut off

Wyświetl plik

@ -65,6 +65,7 @@ float_average_t rte_wx_dallas_average;
ms5611_qf_t rte_wx_ms5611_qf = MS5611_QF_UNKNOWN;
bme280_qf_t rte_wx_bme280_qf = BME280_QF_UKNOWN;
analog_wind_qf_t rte_wx_wind_qf = AN_WIND_QF_UNKNOWN;
uint8_t rte_wx_humidity_available = 0;
umb_frame_t rte_wx_umb;

Wyświetl plik

@ -27,7 +27,7 @@ int32_t wx_get_humidity_measurement(const config_data_wx_sources_t * const confi
//
// but MS5611 isn't a humidity sensor
;
rte_wx_humidity_available = 2;
}
else {
// BME280
@ -36,6 +36,11 @@ int32_t wx_get_humidity_measurement(const config_data_wx_sources_t * const confi
// if humidity has been retrieved successfully
if (measurement_result == BME280_OK) {
rte_wx_humidity_valid = rte_wx_humidity;
rte_wx_humidity_available = 1;
}
else {
rte_wx_humidity_available = 0;
}
}
@ -58,6 +63,10 @@ int32_t wx_get_humidity_measurement(const config_data_wx_sources_t * const confi
rte_wx_humidity_valid = rte_wx_humidity;
rte_wx_humidity_available = 1;
}
else {
rte_wx_humidity_available = 0;
}
break;