kopia lustrzana https://github.com/SP8EBC/ParaTNC
daily with power saving works
rodzic
ae49c447fa
commit
48c15a1b16
|
@ -20,7 +20,7 @@ typedef struct packet_tx_counter_values_t {
|
|||
|
||||
} packet_tx_counter_values_t;
|
||||
|
||||
void packet_tx_configure(uint8_t meteo_interval, uint8_t beacon_interval);
|
||||
void packet_tx_configure(uint8_t meteo_interval, uint8_t beacon_interval, config_data_powersave_mode_t powersave);
|
||||
void packet_tx_handler(const config_data_basic_t * const config_basic, const config_data_mode_t * const config_mode);
|
||||
void packet_tx_get_current_counters(packet_tx_counter_values_t * out);
|
||||
void packet_tx_set_current_counters(packet_tx_counter_values_t * in);
|
||||
|
|
|
@ -8,15 +8,17 @@
|
|||
#ifndef STATION_CONFIG_H_
|
||||
#define STATION_CONFIG_H_
|
||||
|
||||
//#define _POWERSAVE_NORMAL
|
||||
#define _POWERSAVE_AGGRESIVE
|
||||
/* ------------------ */
|
||||
/* MODES OF OPERATION */
|
||||
|
||||
#define _METEO // Enable meteo station
|
||||
#define _DIGI // Enable WIDE1-1 digipeater
|
||||
//#define _DIGI // Enable WIDE1-1 digipeater
|
||||
//#define _DIGI_ONLY_789 // Limit digipeater to handle only -7, -8 and -9 SSIDs
|
||||
//#define _VICTRON // Enable support for Victron VE.Direct protocol
|
||||
|
||||
#define _GSM // only for ParaMETEO
|
||||
//#define _GSM // only for ParaMETEO
|
||||
|
||||
/* MODES OF OPERATION */
|
||||
/* ------------------ */
|
||||
|
@ -51,8 +53,8 @@
|
|||
#define _ANEMOMETER_ANALOGUE // Use analogue/mechanical (like Davis 6410) as an internal anemometr
|
||||
#define _ANEMOMETER_PULSES_IN_10SEC_PER_ONE_MS_OF_WINDSPEED 10
|
||||
|
||||
//#define _SENSOR_MS5611
|
||||
#define _SENSOR_BME280
|
||||
#define _SENSOR_MS5611
|
||||
//#define _SENSOR_BME280
|
||||
|
||||
#define _UMB_SLAVE_ID 1
|
||||
#define _UMB_SLAVE_CLASS 8
|
||||
|
@ -258,9 +260,9 @@
|
|||
#else
|
||||
#error "Wrong symbol configuration in station_config.h"
|
||||
#endif
|
||||
#if defined (_METEO) && !defined (_DIGI)
|
||||
#define _DIGI
|
||||
#endif
|
||||
//#if defined (_METEO) && !defined (_DIGI)
|
||||
//#define _DIGI
|
||||
//#endif
|
||||
|
||||
#if defined(PARATNC_HWREV_A) && (defined (_METEO) || defined (_DALLAS_AS_TELEM)) && !defined(_DALLAS_SPLIT_PIN)
|
||||
#define _DALLAS_SPLIT_PIN
|
||||
|
|
|
@ -391,7 +391,7 @@ int main(int argc, char* argv[]){
|
|||
}
|
||||
|
||||
// set packets intervals
|
||||
packet_tx_configure(main_config_data_basic->wx_transmit_period, main_config_data_basic->beacon_transmit_period);
|
||||
packet_tx_configure(main_config_data_basic->wx_transmit_period, main_config_data_basic->beacon_transmit_period, main_config_data_mode->powersave);
|
||||
|
||||
#if defined(PARATNC_HWREV_A) || defined(PARATNC_HWREV_B) || defined(PARATNC_HWREV_C)
|
||||
// disabling access to BKP registers
|
||||
|
|
|
@ -45,11 +45,15 @@ uint8_t packet_tx_modbus_status = (uint8_t)(_TELEM_DESCR_INTERVAL - _WX_INTERVAL
|
|||
|
||||
uint8_t packet_tx_more_than_one = 0;
|
||||
|
||||
void packet_tx_configure(uint8_t meteo_interval, uint8_t beacon_interval) {
|
||||
void packet_tx_configure(uint8_t meteo_interval, uint8_t beacon_interval, config_data_powersave_mode_t powersave) {
|
||||
packet_tx_meteo_interval = meteo_interval;
|
||||
|
||||
packet_tx_beacon_interval = beacon_interval;
|
||||
|
||||
// if user selected aggressive powersave mode the meteo counter must be set back to zero
|
||||
// to prevent quirks with waking from sleep mode
|
||||
packet_tx_meteo_counter = 0;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -177,6 +177,7 @@ void pwr_save_exit_from_stop2(void) {
|
|||
|
||||
// rewind all timers in packet tx handler as they were no updated when micro was sleeping
|
||||
// sleep shall be always set as wx packet interval minus one minute
|
||||
timers.wx_counter += (pwr_save_sleep_time_in_seconds / 60);
|
||||
timers.beacon_counter += (pwr_save_sleep_time_in_seconds / 60);
|
||||
timers.kiss_counter += (pwr_save_sleep_time_in_seconds / 60);
|
||||
timers.telemetry_counter += (pwr_save_sleep_time_in_seconds / 60);
|
||||
|
@ -641,7 +642,7 @@ void pwr_save_pooling_handler(config_data_mode_t * config, config_data_basic_t *
|
|||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
else { // gsm is not enabled
|
||||
// if digipeater is enabled
|
||||
if (config->digi == 1) { // DIGI + WX
|
||||
if (minutes_to_wx > 1) {
|
||||
|
@ -654,11 +655,17 @@ void pwr_save_pooling_handler(config_data_mode_t * config, config_data_basic_t *
|
|||
else { // WX
|
||||
if (minutes_to_wx > 1) {
|
||||
// if there is more than one minute to send wx packet
|
||||
reinit_sensors= pwr_save_switch_mode_to_m4();
|
||||
pwr_save_switch_mode_to_l7((timers->wx_transmit_period * 60) - 60);
|
||||
}
|
||||
else {
|
||||
if (pwr_save_seconds_to_wx <= 30) {
|
||||
reinit_sensors = pwr_save_switch_mode_to_c1();
|
||||
pwr_save_switch_mode_to_c1();
|
||||
|
||||
// do not reinitialize everything as reinitialization had been done when switching to m4 mode
|
||||
reinit_sensors = 0;
|
||||
}
|
||||
else {
|
||||
reinit_sensors= pwr_save_switch_mode_to_m4();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue