From 99d6ddedeb2f88ca72b27a610ede03929fe299c6 Mon Sep 17 00:00:00 2001 From: Mateusz Lubecki Date: Sun, 6 Nov 2022 13:26:50 +0100 Subject: [PATCH] delay before doubled wx transmission --- include/main.h | 1 + src/it_handlers.c | 1 + src/main.c | 1 + src/packet_tx_handler.c | 4 +++- system/src/aprs/telemetry.c | 5 +++-- 5 files changed, 9 insertions(+), 3 deletions(-) diff --git a/include/main.h b/include/main.h index 04974bf..76be4e9 100644 --- a/include/main.h +++ b/include/main.h @@ -86,6 +86,7 @@ extern srl_context_t* main_gsm_srl_ctx_ptr; extern uint8_t main_kiss_enabled; extern uint8_t main_woken_up; +extern uint8_t main_woken_up_for_telemetry; extern int8_t main_cpu_load; diff --git a/src/it_handlers.c b/src/it_handlers.c index acca9a3..2d1f105 100644 --- a/src/it_handlers.c +++ b/src/it_handlers.c @@ -96,6 +96,7 @@ void it_handlers_set_priorities(void) { void RTC_WKUP_IRQHandler(void) { main_woken_up = 1; + main_woken_up_for_telemetry = 1; // clear pending interrupt NVIC_ClearPendingIRQ(RTC_WKUP_IRQn); diff --git a/src/main.c b/src/main.c index a1112b3..f359146 100644 --- a/src/main.c +++ b/src/main.c @@ -273,6 +273,7 @@ uint32_t rte_main_tx_total = 0; #if defined(PARAMETEO) uint8_t main_woken_up = 0; +uint8_t main_woken_up_for_telemetry = 0; #endif char after_tx_lock; diff --git a/src/packet_tx_handler.c b/src/packet_tx_handler.c index 5c57c33..857afcd 100644 --- a/src/packet_tx_handler.c +++ b/src/packet_tx_handler.c @@ -67,6 +67,8 @@ uint8_t packet_tx_trigger_tcp = 0; void packet_tx_send_wx_frame(void) { main_wait_for_tx_complete(); + delay_fixed(1100); + SendWXFrame(rte_wx_average_windspeed, rte_wx_max_windspeed, rte_wx_average_winddirection, rte_wx_temperature_average_external_valid, rte_wx_pressure_valid, rte_wx_humidity_valid); } @@ -78,7 +80,7 @@ void packet_tx_configure(uint8_t meteo_interval, uint8_t beacon_interval, config // 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 = meteo_interval - 1; + packet_tx_meteo_counter = meteo_interval - 3; } diff --git a/system/src/aprs/telemetry.c b/system/src/aprs/telemetry.c index c2cdb1e..2f61ead 100644 --- a/system/src/aprs/telemetry.c +++ b/system/src/aprs/telemetry.c @@ -636,7 +636,7 @@ void telemetry_send_chns_description_tatry(const config_data_basic_t * const con // clear the output frame buffer memset(main_own_aprs_msg, 0x00, sizeof(main_own_aprs_msg)); - main_own_aprs_msg_len = sprintf(main_own_aprs_msg, ":%-6s :PARM.Spi,LastTempr,MaxTempr,Vbatt,PtSts,LSERDY,RTCEN,MAX_OK,N,N,N,N,N", config_basic->callsign); + main_own_aprs_msg_len = sprintf(main_own_aprs_msg, ":%-6s :PARM.Spi,LastTempr,MaxTempr,Vbatt,PtSts,LSERDY,RTCEN,MAX_OK,SLEEP,N,N,N,N", config_basic->callsign); main_own_aprs_msg[main_own_aprs_msg_len] = 0; ax25_sendVia(&main_ax25, main_own_path, main_own_path_ln, main_own_aprs_msg, main_own_aprs_msg_len); @@ -723,12 +723,13 @@ void telemetry_send_values_tatry() { ((RCC->BDCR & RCC_BDCR_LSERDY) > 0) ? '1' : '0', ((RCC->BDCR & RCC_BDCR_RTCEN) > 0) ? '1' : '0', (max31865_ok) ? '1' : '0', - '0', + (main_woken_up_for_telemetry > 0) ? '1' : '0', '0', '0', '0', '0'); + main_woken_up_for_telemetry = 0; // reset the frame counter if it overflowed if (telemetry_counter > 999)