| Line 256... |
Line 256... |
| 256 |
library_unload(libmkfat32);
|
256 |
library_unload(libmkfat32);
|
| 257 |
memcpy(framebuf, bg, 320 * 240 * 3);
|
257 |
memcpy(framebuf, bg, 320 * 240 * 3);
|
| 258 |
message(106, "Data partition has", "been reformatted.");
|
258 |
message(106, "Data partition has", "been reformatted.");
|
| 259 |
}
|
259 |
}
|
| 260 |
|
260 |
|
| - |
|
261 |
bool update_display(struct chooser_data* data)
|
| - |
|
262 |
{
|
| - |
|
263 |
char buf[6];
|
| - |
|
264 |
struct rtc_datetime dt;
|
| - |
|
265 |
rtc_read_datetime(&dt);
|
| - |
|
266 |
snprintf(buf, sizeof(buf), "%02d:%02d", dt.hour, dt.minute);
|
| - |
|
267 |
// clock
|
| - |
|
268 |
rendertext(framebuf, 287, 4, 320, 0xffffcccc, 0, buf);
|
| - |
|
269 |
unsigned int batt_level = 22 * read_battery_mwh_current(0) / read_battery_mwh_full(0);
|
| - |
|
270 |
// remaining battery level
|
| - |
|
271 |
ui->blendcolor(batt_level, 6, 0xc0ffcccc, framebuf, 5, 5, 320, framebuf, 5, 5, 320);
|
| - |
|
272 |
// background of the rest space
|
| - |
|
273 |
ui->blendcolor(22 - batt_level, 6, 0x40000000, framebuf, 5 + batt_level, 5, 320, framebuf, 5 + batt_level, 5, 320);
|
| - |
|
274 |
return false;
|
| - |
|
275 |
}
|
| - |
|
276 |
|
| 261 |
struct chooser_renderer_list_params toolchooser_rparams =
|
277 |
struct chooser_renderer_list_params toolchooser_rparams =
|
| 262 |
{
|
278 |
{
|
| 263 |
.version = CHOOSER_RENDERER_LIST_PARAMS_VERSION,
|
279 |
.version = CHOOSER_RENDERER_LIST_PARAMS_VERSION,
|
| 264 |
.copy_dest = LIBUI_LOCATION(LIBUI_BUFFER(NULL, 320), LIBUI_POINT(0, 0)),
|
280 |
.copy_dest = LIBUI_LOCATION(LIBUI_BUFFER(NULL, 320), LIBUI_POINT(0, 0)),
|
| 265 |
.copy_src = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 320), LIBUI_POINT(0, 0)),
|
281 |
.copy_src = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 320), LIBUI_POINT(0, 0)),
|
| Line 274... |
Line 290... |
| 274 |
.viewport = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 320), LIBUI_POINT(30, 50)),
|
290 |
.viewport = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 320), LIBUI_POINT(30, 50)),
|
| 275 |
LIBUI_POINT(260, 160)),
|
291 |
LIBUI_POINT(260, 160)),
|
| 276 |
.blit_dest = LIBUI_POINT(0, 0),
|
292 |
.blit_dest = LIBUI_POINT(0, 0),
|
| 277 |
.blit_src = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 320), LIBUI_POINT(0, 0)),
|
293 |
.blit_src = LIBUI_SURFACE(LIBUI_LOCATION(LIBUI_BUFFER(NULL, 320), LIBUI_POINT(0, 0)),
|
| 278 |
LIBUI_POINT(320, 240)),
|
294 |
LIBUI_POINT(320, 240)),
|
| 279 |
.preblit = NULL,
|
295 |
.preblit = update_display,
|
| 280 |
.postblit = NULL
|
296 |
.postblit = NULL
|
| 281 |
};
|
297 |
};
|
| 282 |
|
298 |
|
| 283 |
struct chooser_action_handler_wheel_params toolchooser_aparams =
|
299 |
struct chooser_action_handler_wheel_params toolchooser_aparams =
|
| 284 |
{
|
300 |
{
|
| Line 346... |
Line 362... |
| 346 |
}
|
362 |
}
|
| 347 |
};
|
363 |
};
|
| 348 |
|
364 |
|
| 349 |
bool mainchooser_preblit(struct chooser_data* data)
|
365 |
bool mainchooser_preblit(struct chooser_data* data)
|
| 350 |
{
|
366 |
{
|
| 351 |
char buf[6];
|
367 |
char buf[4];
|
| 352 |
struct rtc_datetime dt;
|
- |
|
| 353 |
rtc_read_datetime(&dt);
|
- |
|
| 354 |
snprintf(buf, sizeof(buf), "%02d:%02d", dt.hour, dt.minute);
|
- |
|
| 355 |
// clock
|
- |
|
| 356 |
rendertext(framebuf, 287, 4, 320, 0xffffcccc, 0, buf);
|
- |
|
| 357 |
struct chooser_action_handler_wheel_data* adata;
|
368 |
struct chooser_action_handler_wheel_data* adata;
|
| 358 |
adata = (struct chooser_action_handler_wheel_data*)(data->actionhandlerdata);
|
369 |
adata = (struct chooser_action_handler_wheel_data*)(data->actionhandlerdata);
|
| 359 |
snprintf(buf, sizeof(buf), "%3d", adata->timeout_remaining / 1000000);
|
370 |
snprintf(buf, sizeof(buf), "%3d", adata->timeout_remaining / 1000000);
|
| 360 |
// remaining time
|
- |
|
| 361 |
rendertext(framebuf, 299, 229, 320, 0xffffcccc, 0, buf);
|
371 |
rendertext(framebuf, 299, 229, 320, 0xffffcccc, 0, buf);
|
| 362 |
unsigned int batt_level = 22 * read_battery_mwh_current(0) / read_battery_mwh_full(0);
|
- |
|
| 363 |
// remaining battery level
|
372 |
update_display(data);
|
| 364 |
ui->blendcolor(batt_level, 6, 0xc0ffcccc, framebuf, 5, 5, 320, framebuf, 5, 5, 320);
|
- |
|
| 365 |
// background of the rest space
|
- |
|
| 366 |
ui->blendcolor(22 - batt_level, 6, 0x40000000, framebuf, 5 + batt_level, 5, 320, framebuf, 5 + batt_level, 5, 320);
|
- |
|
| 367 |
return false;
|
373 |
return false;
|
| 368 |
}
|
374 |
}
|
| 369 |
|
375 |
|
| 370 |
struct chooser_renderer_iconflow_itemdata mainchooser_rparams_powerdown =
|
376 |
struct chooser_renderer_iconflow_itemdata mainchooser_rparams_powerdown =
|
| 371 |
{
|
377 |
{
|