| Line 346... |
Line 346... |
| 346 |
}
|
346 |
}
|
| 347 |
};
|
347 |
};
|
| 348 |
|
348 |
|
| 349 |
bool mainchooser_preblit(struct chooser_data* data)
|
349 |
bool mainchooser_preblit(struct chooser_data* data)
|
| 350 |
{
|
350 |
{
|
| 351 |
char buf[4];
|
351 |
char buf[6];
|
| - |
|
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);
|
| 352 |
struct chooser_action_handler_wheel_data* adata;
|
357 |
struct chooser_action_handler_wheel_data* adata;
|
| 353 |
adata = (struct chooser_action_handler_wheel_data*)(data->actionhandlerdata);
|
358 |
adata = (struct chooser_action_handler_wheel_data*)(data->actionhandlerdata);
|
| 354 |
snprintf(buf, sizeof(buf), "%3d", adata->timeout_remaining / 1000000);
|
359 |
snprintf(buf, sizeof(buf), "%3d", adata->timeout_remaining / 1000000);
|
| - |
|
360 |
// remaining time
|
| 355 |
rendertext(framebuf, 302, 232, 320, 0xffffcccc, 0, buf);
|
361 |
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
|
| - |
|
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);
|
| 356 |
return false;
|
367 |
return false;
|
| 357 |
}
|
368 |
}
|
| 358 |
|
369 |
|
| 359 |
struct chooser_renderer_iconflow_itemdata mainchooser_rparams_powerdown =
|
370 |
struct chooser_renderer_iconflow_itemdata mainchooser_rparams_powerdown =
|
| 360 |
{
|
371 |
{
|
| Line 541... |
Line 552... |
| 541 |
struct emcorelib_header* libboot = loadlib(LIBBOOT_IDENTIFIER,
|
552 |
struct emcorelib_header* libboot = loadlib(LIBBOOT_IDENTIFIER,
|
| 542 |
LIBBOOT_API_VERSION, "libboot ");
|
553 |
LIBBOOT_API_VERSION, "libboot ");
|
| 543 |
boot = (struct libboot_api*)libboot->api;
|
554 |
boot = (struct libboot_api*)libboot->api;
|
| 544 |
struct emcorelib_header* libui = loadlib(LIBUI_IDENTIFIER, LIBUI_API_VERSION, "libui ");
|
555 |
struct emcorelib_header* libui = loadlib(LIBUI_IDENTIFIER, LIBUI_API_VERSION, "libui ");
|
| 545 |
ui = (struct libui_api*)libui->api;
|
556 |
ui = (struct libui_api*)libui->api;
|
| - |
|
557 |
// draw the battery meter box
|
| - |
|
558 |
// top line
|
| - |
|
559 |
ui->blendcolor(24, 1, 0xffffcccc, bg, 4, 4, 320, bg, 4, 4, 320);
|
| - |
|
560 |
// bottom line
|
| - |
|
561 |
ui->blendcolor(24, 1, 0xffffcccc, bg, 4, 11, 320, bg, 4, 11, 320);
|
| - |
|
562 |
// left line
|
| - |
|
563 |
ui->blendcolor(1, 6, 0xffffcccc, bg, 4, 5, 320, bg, 4, 5, 320);
|
| - |
|
564 |
// right line
|
| - |
|
565 |
ui->blendcolor(1, 6, 0xffffcccc, bg, 27, 5, 320, bg, 27, 5, 320);
|
| - |
|
566 |
// tip - right
|
| - |
|
567 |
ui->blendcolor(1, 4, 0xffffcccc, bg, 28, 6, 320, bg, 28, 6, 320);
|
| 546 |
framebuf = malloc(320 * 240 * 3);
|
568 |
framebuf = malloc(320 * 240 * 3);
|
| 547 |
if (!framebuf) panicf(PANIC_KILLTHREAD, "Could not allocate framebuffer!");
|
569 |
if (!framebuf) panicf(PANIC_KILLTHREAD, "Could not allocate framebuffer!");
|
| 548 |
|
570 |
|
| 549 |
mainchooser.actionhandler = ui->chooser_action_handler_wheel;
|
571 |
mainchooser.actionhandler = ui->chooser_action_handler_wheel;
|
| 550 |
mainchooser.renderer = ui->chooser_renderer_iconflow;
|
572 |
mainchooser.renderer = ui->chooser_renderer_iconflow;
|