diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c index 51ea99f6fa..7e1523eb57 100644 --- a/firmware/powermgmt.c +++ b/firmware/powermgmt.c @@ -103,10 +103,12 @@ static unsigned int avgbat; /* filtered battery voltage, millivolts */ static unsigned int battery_millivolts; #else +#ifndef SIMULATOR int _battery_voltage(void) { return -1; } const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11]; const unsigned short percent_to_volt_charge[11]; #endif +#endif #if !(CONFIG_BATTERY_MEASURE & TIME_MEASURE) static int powermgmt_est_runningtime_min; diff --git a/uisimulator/common/powermgmt-sim.c b/uisimulator/common/powermgmt-sim.c index 3430b1ea79..511648bc9d 100644 --- a/uisimulator/common/powermgmt-sim.c +++ b/uisimulator/common/powermgmt-sim.c @@ -79,7 +79,7 @@ static void battery_status_update(void) #if CONFIG_CHARGING >= CHARGING_MONITOR /* Keep external power until tick */ ext_power_until_tick = current_tick + POWER_AFTER_CHARGE_TICKS; -#elif CONFIG_CHARGING +#elif CONFIG_CHARGING /* Pretend the charger was disconnected */ charger_input_state = CHARGER_UNPLUGGED; #endif @@ -111,13 +111,17 @@ const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = const unsigned short percent_to_volt_charge[11] = { 3300, 3400, 3500, 3600, 3700, 3800, 3900, 4000, 4100, 4200, 4300 }; - int _battery_voltage(void) { battery_status_update(); return battery_millivolts; } +#if (CONFIG_BATTERY_MEASURE & TIME_MEASURE) +static int powermgmt_est_runningtime_min; +int _battery_time(void) { return powermgmt_est_runningtime_min; } +#endif + #if CONFIG_CHARGING unsigned int power_input_status(void) {