Subversion Repositories freemyipod

Rev

Rev 707 | Rev 765 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 707 Rev 764
Line 416... Line 416...
416
    }
416
    }
417
};
417
};
418
 
418
 
419
bool mainchooser_preblit(struct chooser_data* data)
419
bool mainchooser_preblit(struct chooser_data* data)
420
{
420
{
421
    char buf[4];
421
    char buf[6];
-
 
422
    struct rtc_datetime dt;
-
 
423
    rtc_read_datetime(&dt);
-
 
424
    snprintf(buf, sizeof(buf), "%02d:%02d", dt.hour, dt.minute);
-
 
425
    // clock
-
 
426
    rendertext(framebuf, 143, 4, 176, 0xffffcccc, 0, buf);
422
    struct chooser_action_handler_wheel_data* adata;
427
    struct chooser_action_handler_wheel_data* adata;
423
    adata = (struct chooser_action_handler_wheel_data*)(data->actionhandlerdata);
428
    adata = (struct chooser_action_handler_wheel_data*)(data->actionhandlerdata);
424
    snprintf(buf, sizeof(buf), "%3d", adata->timeout_remaining / 1000000);
429
    snprintf(buf, sizeof(buf), "%3d", adata->timeout_remaining / 1000000);
-
 
430
    // remaining time
425
    rendertext(framebuf, 158, 124, 176, 0xffffcccc, 0, buf);
431
    rendertext(framebuf, 155, 121, 176, 0xffffcccc, 0, buf);
-
 
432
    unsigned int batt_level = 22 * read_battery_mwh_current(0) / read_battery_mwh_full(0);
-
 
433
    // remaining battery level
-
 
434
    ui->blendcolor(batt_level, 6, 0xc0ffcccc, framebuf, 5, 5, 176, framebuf, 5, 5, 176);
-
 
435
    // background of the rest space
-
 
436
    ui->blendcolor(22 - batt_level, 6, 0x40000000, framebuf, 5 + batt_level, 5, 176, framebuf, 5 + batt_level, 5, 176);
426
    return false;
437
    return false;
427
}
438
}
428
 
439
 
429
struct chooser_renderer_iconflow_itemdata mainchooser_rparams_powerdown =
440
struct chooser_renderer_iconflow_itemdata mainchooser_rparams_powerdown =
430
{
441
{
Line 671... Line 682...
671
    struct emcorelib_header* libboot = loadlib(LIBBOOT_IDENTIFIER,
682
    struct emcorelib_header* libboot = loadlib(LIBBOOT_IDENTIFIER,
672
                                               LIBBOOT_API_VERSION, "libboot ");
683
                                               LIBBOOT_API_VERSION, "libboot ");
673
    boot = (struct libboot_api*)libboot->api;
684
    boot = (struct libboot_api*)libboot->api;
674
    struct emcorelib_header* libui = loadlib(LIBUI_IDENTIFIER, LIBUI_API_VERSION, "libui   ");
685
    struct emcorelib_header* libui = loadlib(LIBUI_IDENTIFIER, LIBUI_API_VERSION, "libui   ");
675
    ui = (struct libui_api*)libui->api;
686
    ui = (struct libui_api*)libui->api;
-
 
687
    // draw the battery meter box
-
 
688
    // top line
-
 
689
    ui->blendcolor(24, 1, 0xffffcccc, bg, 4, 4, 176, bg, 4, 4, 176);
-
 
690
    // bottom line
-
 
691
    ui->blendcolor(24, 1, 0xffffcccc, bg, 4, 11, 176, bg, 4, 11, 176);
-
 
692
    // left line
-
 
693
    ui->blendcolor(1, 6, 0xffffcccc, bg, 4, 5, 176, bg, 4, 5, 176);
-
 
694
    // right line
-
 
695
    ui->blendcolor(1, 6, 0xffffcccc, bg, 27, 5, 176, bg, 27, 5, 176);
-
 
696
    // tip - right
-
 
697
    ui->blendcolor(1, 4, 0xffffcccc, bg, 28, 6, 176, bg, 28, 6, 176);
676
    framebuf = malloc(176 * 132 * 3);
698
    framebuf = malloc(176 * 132 * 3);
677
    if (!framebuf) panicf(PANIC_KILLTHREAD, "Could not allocate framebuffer!");
699
    if (!framebuf) panicf(PANIC_KILLTHREAD, "Could not allocate framebuffer!");
678
    framebuf2 = malloc(176 * 132 * 3);
700
    framebuf2 = malloc(176 * 132 * 3);
679
    if (!framebuf2) panicf(PANIC_KILLTHREAD, "Could not allocate framebuffer 2!");
701
    if (!framebuf2) panicf(PANIC_KILLTHREAD, "Could not allocate framebuffer 2!");
680
    mainchooser.actionhandler = ui->chooser_action_handler_wheel;
702
    mainchooser.actionhandler = ui->chooser_action_handler_wheel;