mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-12-19 09:13:11 +00:00
1b78418f9f
* GUI: view. Flooper-blooper fix compilation error. * GUI: view and viewdispatcher bones * GUI: view implementation, view models, view dispatcher * GUI: view navigation, model refinement. Power: use view, view dispatcher. * HAL Flash: proper page write. Dolphin: views. Power: views * Dolphin: transition idle scree to Views * Dolphin: input events on stats view. Format sources. * HAL: flash erase. Dolphin: permanent state storage. * Dolphin: first start welcome. HAL: flash operation status, errata 2.2.9 crutch.
38 lines
1.2 KiB
C
38 lines
1.2 KiB
C
#include "power_views.h"
|
|
|
|
void power_info_draw_callback(Canvas* canvas, void* context) {
|
|
PowerInfoModel* data = context;
|
|
|
|
canvas_clear(canvas);
|
|
canvas_set_color(canvas, ColorBlack);
|
|
canvas_set_font(canvas, FontPrimary);
|
|
canvas_draw_str(canvas, 2, 10, "Power state:");
|
|
|
|
char buffer[64];
|
|
canvas_set_font(canvas, FontSecondary);
|
|
snprintf(
|
|
buffer,
|
|
64,
|
|
"Current: %ld/%ldmA",
|
|
(int32_t)(data->current_gauge * 1000),
|
|
(int32_t)(data->current_charger * 1000));
|
|
canvas_draw_str(canvas, 5, 22, buffer);
|
|
snprintf(
|
|
buffer,
|
|
64,
|
|
"Voltage: %ld/%ldmV",
|
|
(uint32_t)(data->voltage_gauge * 1000),
|
|
(uint32_t)(data->voltage_charger * 1000));
|
|
canvas_draw_str(canvas, 5, 32, buffer);
|
|
snprintf(buffer, 64, "Charge: %ld%%", (uint32_t)(data->charge));
|
|
canvas_draw_str(canvas, 5, 42, buffer);
|
|
snprintf(buffer, 64, "Capacity: %ld of %ldmAh", data->capacity_remaining, data->capacity_full);
|
|
canvas_draw_str(canvas, 5, 52, buffer);
|
|
snprintf(
|
|
buffer,
|
|
64,
|
|
"Temperature: %ld/%ldC",
|
|
(uint32_t)(data->temperature_gauge),
|
|
(uint32_t)(data->temperature_charger));
|
|
canvas_draw_str(canvas, 5, 62, buffer);
|
|
}
|