Skip to content

Commit

Permalink
Added function to start battery autoupdate to avoid syslink queue
Browse files Browse the repository at this point in the history
overflow.
  • Loading branch information
tobbeanton committed Dec 8, 2022
1 parent 4f481ab commit 52ebb41
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/hal/src/pm_stm32f4.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 52ebb41

Please sign in to comment.