switchng pwr_save_pooling to use average battery voltage instead of momentary

sr9wxz_new_configuration_for_ZZ06
Mateusz Lubecki 2022-04-22 20:43:28 +02:00
rodzic dcd064ad74
commit 6a7e6b82a2
3 zmienionych plików z 17 dodań i 9 usunięć

Wyświetl plik

@ -8,7 +8,7 @@
#include "config_data.h"
#define SW_VER "EA05"
#define SW_DATE "17042022"
#define SW_DATE "22042022"
#define SYSTICK_TICKS_PER_SECONDS 100
#define SYSTICK_TICKS_PERIOD 10

Wyświetl plik

@ -14,17 +14,17 @@
* 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
*/
#define PWR_SAVE_CUTOFF_VOLTAGE_DEF 1120u // 11.2V
#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
*/
#define PWR_SAVE_STARTUP_RESTORE_VOLTAGE_DEF 1220u // 12.2V
#define PWR_SAVE_STARTUP_RESTORE_VOLTAGE_DEF 1230u // 12.3V
/**
* This is voltage above which controller will switch to PWSAVE_AGGRESV
*/
#define PWR_SAVE_AGGRESIVE_POWERSAVE_VOLTAGE (PWR_SAVE_CUTOFF_VOLTAGE_DEF + 50u)
#define PWR_SAVE_AGGRESIVE_POWERSAVE_VOLTAGE 1150u // 11.5V
/**
* How long in minutes the controller will sleep in L7 state between checking

Wyświetl plik

@ -905,6 +905,7 @@ int main(int argc, char* argv[]){
#if defined(PARAMETEO)
rte_main_battery_voltage = io_vbat_meas_get();
rte_main_average_battery_voltage = rte_main_battery_voltage;
pwr_save_switch_mode_to_c0();
@ -958,13 +959,15 @@ int main(int argc, char* argv[]){
if (main_config_data_basic-> beacon_at_bootup == 1) {
#if defined(PARAMETEO)
beacon_send_own(rte_main_battery_voltage);
delay_fixed(1500);
#else
beacon_send_own(0);
#endif
delay_fixed(1500);
#if defined(PARAMETEO)
telemetry_send_status_powersave_registers(REGISTER_LAST_SLEEP, REGISTER_LAST_WKUP, REGISTER_COUNTERS, REGISTER_MONITOR, REGISTER_LAST_SLTIM);
#endif
}
// Infinite loop
@ -1019,9 +1022,14 @@ int main(int argc, char* argv[]){
#if defined(PARAMETEO)
if (main_woken_up == 1) {
// io_vbat_meas_init(VBAT_MEAS_A_COEFF, VBAT_MEAS_B_COEFF);
rte_main_battery_voltage = io_vbat_meas_get();
rte_main_battery_voltage = io_vbat_meas_get();
rte_main_average_battery_voltage = io_vbat_meas_average(rte_main_battery_voltage);
// meas average will return 0 if internal buffer isn't filled completely
if (rte_main_average_battery_voltage == 0) {
rte_main_average_battery_voltage = rte_main_battery_voltage;
}
// reinitialize APRS radio modem to clear all possible intermittent state caused by
// switching power state in the middle of reception APRS packet
@ -1256,7 +1264,7 @@ int main(int argc, char* argv[]){
*
* TEST TEST TEST TODO
*/
retval = http_client_async_get("http://pogoda.cc:8080/meteo_backend/status", strlen("http://pogoda.cc:8080/meteo_backend/status"), 0xFFF0, 0x1, dupa);
//retval = http_client_async_get("http://pogoda.cc:8080/meteo_backend/status", strlen("http://pogoda.cc:8080/meteo_backend/status"), 0xFFF0, 0x1, dupa);
//retval = http_client_async_post("http://pogoda.cc:8080/meteo_backend/parameteo/skrzyczne/status", strlen("http://pogoda.cc:8080/meteo_backend/parameteo/skrzyczne/status"), post_content, strlen(post_content), 0, dupa);
}
@ -1313,7 +1321,7 @@ int main(int argc, char* argv[]){
#ifdef PARAMETEO
// inhibit any power save switching when modem transmits data
if (!main_afsk.sending && main_woken_up == 0) {
pwr_save_pooling_handler(main_config_data_mode, main_config_data_basic, packet_tx_get_minutes_to_next_wx(), rte_main_battery_voltage);
pwr_save_pooling_handler(main_config_data_mode, main_config_data_basic, packet_tx_get_minutes_to_next_wx(), rte_main_average_battery_voltage);
}
#endif