summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/powermgmt.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c
index df796f9..8791338 100644
--- a/firmware/powermgmt.c
+++ b/firmware/powermgmt.c
@@ -235,6 +235,9 @@ void power_init(void)
{
/* init history to 0 */
memset(power_history, 0x00, sizeof(power_history));
+ /* initialize the history with a single sample to prevent level
+ flickering during the first minute of execution */
+ power_history[POWER_HISTORY_LEN-1] = (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) / 10000;
#ifdef HAVE_CHARGE_CTRL
snprintf(power_message, POWER_MESSAGE_LEN, "Powermgmt started");