power cycling vbat_r if engineering2 is enabled

master
Mateusz Lubecki 2023-02-02 21:50:42 +01:00
rodzic 67d08ffdce
commit 3e4ed6d01b
6 zmienionych plików z 22 dodań i 6 usunięć

Wyświetl plik

@ -141,7 +141,7 @@ typedef struct __attribute__((aligned (4))) config_data_basic_t {
uint8_t wx_double_transmit;
/**
* bit0 - must be set to zero to enable this engineering
* bit0 - must be set to ZERO to enable this engineering
* bit1 - inhibit 'wx_pwr_switch_periodic_handle'
* bit2 - early_tx_assert
* bit3 -
@ -156,7 +156,7 @@ typedef struct __attribute__((aligned (4))) config_data_basic_t {
* Ugly and nasty workarounds of (mostly hardware) problems. Use only
* where there is no hope left.
*
* bit0 - must be set to zero to enable this engineering
* bit0 - must be set to ZERO to enable this engineering
* bit1 - reboot after 99 telemetry frames
* bit2 - power cycle vbat_r two minutes before weather frame
*/

Wyświetl plik

@ -39,7 +39,7 @@ uint16_t io_vbat_meas_average(uint16_t sample);
void io_vbat_meas_disable(void);
void io_vbat_meas_enable(void);
void io_pool_vbat_r(uint8_t minutes_to_wx);
void io_pool_vbat_r(int16_t minutes_to_wx);
#endif
#define VBAT_MEAS_A_COEFF 1200

Wyświetl plik

@ -206,9 +206,15 @@ const config_data_basic_t __attribute__((section(".config_section_default.basic"
#endif
#ifdef ENG1
.engineering1 = ENG1
.engineering1 = ENG1,
#else
.engineering1 = 0xFF
.engineering1 = 0,
#endif
#ifdef ENG2
.engineering2 = ENG2
#else
.engineering2 = 0
#endif
};

Wyświetl plik

@ -843,5 +843,11 @@ int configuration_get_power_cycle_vbat_r(void) {
int out = 0;
if ((main_config_data_basic->engineering2 & ENGINEERING2) == 0) {
if ((main_config_data_basic->engineering2 & ENGINEERING2_POWER_CYCLE_R) != 0) {
out = 1;
}
}
return out;
}

Wyświetl plik

@ -491,7 +491,7 @@ void io_vbat_meas_enable(void) {
#endif
}
void io_pool_vbat_r(uint8_t minutes_to_wx) {
void io_pool_vbat_r(int16_t minutes_to_wx) {
// check how many minutes reamins to weather packet
if (minutes_to_wx == 2) {

Wyświetl plik

@ -1463,6 +1463,10 @@ int main(int argc, char* argv[]){
wx_pwr_switch_periodic_handle();
}
if (configuration_get_power_cycle_vbat_r() == 1) {
io_pool_vbat_r(packet_tx_get_minutes_to_next_wx());
}
wx_check_force_i2c_reset();
#ifdef STM32L471xx