This commit is contained in:
ecarlett 2024-05-29 12:56:22 +02:00 committed by Eve C
parent d6a6bda6ba
commit 8929563950
2 changed files with 2 additions and 1 deletions

Binary file not shown.

View file

@ -191,6 +191,7 @@ WatchFaceMeow::WatchFaceMeow(Controllers::DateTime& dateTimeController,
lv_line_set_points(lines[i], linePoints[i], 2); lv_line_set_points(lines[i], linePoints[i], 2);
} }
//Battery indicator
logoPine = lv_img_create(lv_scr_act(), nullptr); logoPine = lv_img_create(lv_scr_act(), nullptr);
lv_img_set_src(logoPine, "F:/images/pine_small.bin"); lv_img_set_src(logoPine, "F:/images/pine_small.bin");
lv_obj_set_pos(logoPine, 15, 106); lv_obj_set_pos(logoPine, 15, 106);
@ -198,6 +199,7 @@ WatchFaceMeow::WatchFaceMeow(Controllers::DateTime& dateTimeController,
lineBattery = lv_line_create(lv_scr_act(), nullptr); lineBattery = lv_line_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_line_width(lineBattery, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, 24); lv_obj_set_style_local_line_width(lineBattery, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, 24);
lv_obj_set_style_local_line_color(lineBattery, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, (*colors)[4]); lv_obj_set_style_local_line_color(lineBattery, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, (*colors)[4]);
lv_obj_set_style_local_line_color(lineBattery, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, (*colors)[4]);
lv_obj_set_style_local_line_opa(lineBattery, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, 190); lv_obj_set_style_local_line_opa(lineBattery, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, 190);
lineBatteryPoints[0] = {27, 105}; lineBatteryPoints[0] = {27, 105};
lineBatteryPoints[1] = {27, 106}; lineBatteryPoints[1] = {27, 106};
@ -532,7 +534,6 @@ void WatchFaceMeow::Refresh() {
} }
void WatchFaceMeow::SetBatteryLevel(uint8_t batteryPercent) { void WatchFaceMeow::SetBatteryLevel(uint8_t batteryPercent) {
// starting point (y) + Pine64 logo height * (100 - batteryPercent) / 100
lineBatteryPoints[1] = {27, static_cast<lv_coord_t>(105 + 32 * (100 - batteryPercent) / 100)}; lineBatteryPoints[1] = {27, static_cast<lv_coord_t>(105 + 32 * (100 - batteryPercent) / 100)};
lv_line_set_points(lineBattery, lineBatteryPoints, 2); lv_line_set_points(lineBattery, lineBatteryPoints, 2);
} }