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; }
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; }
static void update_countdown(u8 timernum) { int cur_row = GUI_ScrollableCurrentRow(&gui->scrollable); int idx = timernum - cur_row * TIMERCOLUMNS; if (idx < 0 || idx >= TIMERS_PER_PAGE) return; u8 hide = Model.timer[timernum].type == TIMER_STOPWATCH || Model.timer[timernum].type == TIMER_STOPWATCH_PROP || Model.timer[timernum].type == TIMER_PERMANENT; GUI_SetHidden((guiObject_t *)&gui->start[idx], hide); GUI_SetHidden((guiObject_t *)&gui->startlbl[idx], hide); GUI_SetSelectable((guiObject_t *)&gui->start[idx], !hide); // Permanent timer OR Standard Mixer do not have reset command hide = Model.timer[timernum].type == TIMER_PERMANENT || Model.mixer_mode == MIXER_STANDARD ; GUI_SetHidden((guiObject_t *)&gui->resetsrc[idx], hide); GUI_SetSelectable((guiObject_t *)&gui->resetsrc[idx], !hide); GUI_SetHidden((guiObject_t *)&gui->resetlbl[idx], hide); hide = Model.timer[timernum].type == TIMER_STOPWATCH || Model.timer[timernum].type == TIMER_COUNTDOWN || Model.timer[timernum].type == TIMER_STOPWATCH_PROP || Model.timer[timernum].type == TIMER_COUNTDOWN_PROP; GUI_SetHidden((guiObject_t *)&gui->resetperm[idx], hide); GUI_SetSelectable((guiObject_t *)&gui->resetperm[idx], !hide); GUI_SetHidden((guiObject_t *)&gui->setperm[idx], hide); GUI_SetSelectable((guiObject_t *)&gui->setperm[idx], !hide); GUI_SetHidden((guiObject_t *)&gui->resetpermlbl[idx], hide); GUI_Redraw(&gui->switchlbl[idx]); }
static inline guiObject_t * _get_obj(int idx, int objid) { if (PAGE_GetModal()) { if(objid == TRIM_MINUS) { return (guiObject_t *)&gui_ed->neg; } else if(objid == TRIM_SWITCH) { return (guiObject_t *)&gui_ed->sw; } } else { if(objid == TRIM_MINUS) { return (guiObject_t *)&gui->neg[idx - GUI_ScrollableCurrentRow(&gui->scrollable)]; } } return NULL; }