Esempio n. 1
0
static void _check_voltage(guiLabel_t *obj)
{
    if (CLOCK_getms() > next_scan)  {  // don't need to check battery too frequently, to avoid blink of the battery label
        next_scan = CLOCK_getms() + BATTERY_SCAN_MSEC;
        s16 batt = PWR_ReadVoltage();
        if (batt < Transmitter.batt_alarm) {
            obj->desc.style = LABEL_INVERTED;
            GUI_Redraw(obj);
        }
        if (batt / 10 != mp->battery / 10 && batt / 10 != mp->battery / 10 + 1) {
            mp->battery = batt;
            GUI_Redraw(obj);
        }
    }
}
Esempio n. 2
0
/*
 * Main page
 * KEY_UP: Press once to start timers, press again to stop timers
 * KEY_DOWN: Press to rest timers
 * KEY_ENT: enter the main menu page
 */
void PAGE_MainInit(int page)
{
    (void)page;
    (void)bar_cb;
    TGLICO_LoadFonts();
    memset(mp, 0, sizeof(struct main_page));// Bug fix: must initialize this structure to avoid unpredictable issues in the PAGE_MainEvent
    memset(gui, 0, sizeof(struct mainpage_obj));
    PAGE_SetModal(0);
    PAGE_SetActionCB(_action_cb);
    next_scan = CLOCK_getms()+BATTERY_SCAN_MSEC;

    GUI_CreateLabelBox(&gui->name, MODEL_NAME_X, MODEL_NAME_Y, //64, 12,
            LCD_WIDTH, LINE_HEIGHT, &MODELNAME_FONT, NULL, NULL, Model.name);

    show_elements();
    //Battery
    mp->battery = PWR_ReadVoltage();
}
Esempio n. 3
0
/*
 * Main page
 * KEY_UP: Press once to start timers, press again to stop timers
 * KEY_DOWN: Press to rest timers
 * KEY_ENT: enter the main menu page
 */
void PAGE_MainInit(int page)
{
    (void)page;
    (void)bar_cb;
    memset(mp, 0, sizeof(struct main_page));// Bug fix: must initialize this structure to avoid unpredictable issues in the PAGE_MainEvent
    memset(gui, 0, sizeof(struct mainpage_obj));
    PAGE_SetModal(0);
    PAGE_SetActionCB(_action_cb);
    PAGE_RemoveAllObjects();
    next_scan = CLOCK_getms()+BATTERY_SCAN_MSEC;

    GUI_CreateLabelBox(&gui->name, 0, 1, //64, 12,
            0, 0, &SMALL_FONT, NULL, NULL, Model.name);


    show_elements();
    //Battery
    mp->battery = PWR_ReadVoltage();
}