Пример #1
0
void PAGE_TelemtestEvent() {
    if (current_page == telemetry_off)
        return;
    struct Telemetry cur_telem = Telemetry;
    int current_row = GUI_ScrollableCurrentRow(&gui->scrollable);
    int visible_rows = GUI_ScrollableVisibleRows(&gui->scrollable);
    const struct telem_layout *ptr = TELEMETRY_Type() == TELEM_DEVO
                                     ? devo_page[current_page].layout
                                     : dsm_page[current_page].layout;
    for (long i = 0; ptr->source; ptr++, i++) {
        if ((ptr->row_type & 0x0f) < current_row)
            continue;
        if ((ptr->row_type & 0x0f) >= current_row + visible_rows)
            break;
        if (!( ptr->row_type & 0x80))
            continue;
        long cur_val = _TELEMETRY_GetValue(&cur_telem, ptr->source);
        long last_val = _TELEMETRY_GetValue(&tp->telem, ptr->source);
        struct LabelDesc *font;
        font = &TELEM_FONT;
        if (cur_val != last_val) {
            GUI_Redraw(&gui->box[i]);
        } else if(! TELEMETRY_IsUpdated(ptr->source)) {
            font = &TELEM_ERR_FONT;
        }
        GUI_SetLabelDesc(&gui->box[i], font);
    }
    tp->telem = cur_telem;
}
Пример #2
0
void PAGE_TelemtestEvent() {
    if (current_page == telemetry_off)
        return;
    static u32 count;
    int flicker = ((++count & 3) == 0);
    struct Telemetry cur_telem = Telemetry;
    int current_row = GUI_ScrollableCurrentRow(&gui->scrollable);
    int visible_rows = GUI_ScrollableVisibleRows(&gui->scrollable);
    const struct telem_layout *ptr = _get_telem_layout2()->layout;
    for (long i = 0; ptr->source; ptr++, i++) {
        if ((ptr->row_type & 0x0f) < current_row)
            continue;
        if ((ptr->row_type & 0x0f) >= current_row + visible_rows)
            break;
        if (!( ptr->row_type & 0x80))
            continue;
        long cur_val = _TELEMETRY_GetValue(&cur_telem, ptr->source);
        long last_val = _TELEMETRY_GetValue(&tp->telem, ptr->source);
        struct LabelDesc *font;
        font = &TELEM_FONT;
        if((TELEMETRY_HasAlarm(ptr->source) && flicker) || ! TELEMETRY_IsUpdated(ptr->source)) {
            font = &TELEM_ERR_FONT;
        } else if (cur_val != last_val) {
            GUI_Redraw(&gui->box[i]);
        }
        GUI_SetLabelDesc(&gui->box[i], font);
    }
    tp->telem = cur_telem;
}