Now updating the battery percentage sent by the BLE battery service

This commit is contained in:
Anatole SCHRAMM 2023-07-06 15:14:38 +02:00
parent 0e6828634f
commit 8af4e2467e

View File

@ -391,6 +391,8 @@ static void parser_event_cb(const gadget_bridge_event_data_t *gadget_bridge_even
case GADGET_BRIDGE_MUSIC_STATE_STOP:
music_player_screen_set_music_playing_state(&musicPlayerScreen, MUSIC_CONTROL_PAUSE);
break;
default:
APP_LOG_INFO("Unknown GB music state");
}
music_player_screen_set_music_position(&musicPlayerScreen, gadget_bridge_event_data->music_state.position_in_seconds);
break;
@ -524,6 +526,7 @@ void gfx_task(void *param)
/* Make the first battery voltage reading here */
_battery_stats.battery_voltage = watch_peripherals_get_battery_voltage(battery_unit_mv);
_battery_stats.battery_percentage = battery_voltage_to_percentage(_battery_stats.battery_voltage);
ble_service_set_battery_value(_battery_stats.battery_percentage);
/* Check whether the RTC is running or not, if not, then the board was reset
So we start the RTC */
@ -725,6 +728,7 @@ void gfx_task(void *param)
//Let's refresh the battery percentage as well:
_battery_stats.battery_voltage = watch_peripherals_get_battery_voltage(battery_unit_mv);
_battery_stats.battery_percentage = battery_voltage_to_percentage(_battery_stats.battery_voltage);
ble_service_set_battery_value(_battery_stats.battery_percentage);
watch_face_set_battery_indicator(&watchFace, _battery_stats.battery_percentage, watch_peripherals_get_battery_controller_status());
// Also send the information over BLE to GadgetBridge