From 52ebb41e4bd5b90affcbe13a0ab75be69d85ffba Mon Sep 17 00:00:00 2001 From: Tobias Antonson Date: Thu, 8 Dec 2022 15:20:58 +0100 Subject: [PATCH] Added function to start battery autoupdate to avoid syslink queue overflow. --- src/hal/src/pm_stm32f4.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/hal/src/pm_stm32f4.c b/src/hal/src/pm_stm32f4.c index b52cb84169..26bd616093 100644 --- a/src/hal/src/pm_stm32f4.c +++ b/src/hal/src/pm_stm32f4.c @@ -256,6 +256,15 @@ static void pmGracefulShutdown() syslinkSendPacket(&slp); } +static void pmEnableBatteryStatusAutoupdate() +{ + SyslinkPacket slp = { + .type = SYSLINK_PM_BATTERY_AUTOUPDATE, + }; + + syslinkSendPacket(&slp); +} + void pmSyslinkUpdate(SyslinkPacket *slp) { if (slp->type == SYSLINK_PM_BATTERY_STATE) { @@ -399,6 +408,10 @@ void pmTask(void *param) pmSetChargeState(charge500mA); systemWaitStart(); + // Continuous battery voltage and status messages must be enabled + // after system startup to avoid syslink queue overflow. + pmEnableBatteryStatusAutoupdate(); + while(1) { vTaskDelay(100);