const char *show_box_cb(guiObject_t *obj, const void *data) { (void)obj; u8 idx = (long)data; #if HAS_RTC if (idx <= NUM_RTC) { u32 time = RTC_GetValue(); idx == 1 ? RTC_GetTimeFormatted(tempstring, time) : RTC_GetDateFormatted(tempstring, time); return tempstring; } #endif if (idx - NUM_RTC <= NUM_TIMERS) { TIMER_SetString(tempstring, TIMER_GetValue(idx - NUM_RTC - 1)); } else if(idx - NUM_RTC - NUM_TIMERS <= NUM_TELEM) { TELEMETRY_GetValueStr(tempstring, idx - NUM_RTC - NUM_TIMERS); } else { unsigned channel = idx - (NUM_RTC + NUM_TIMERS + NUM_TELEM + 1); s16 val_raw = MIXER_GetChannel(channel, APPLY_SAFETY | APPLY_SCALAR); s16 val_scale = MIXER_GetChannelDisplayScale(channel); const char* val_format = MIXER_GetChannelDisplayFormat(channel); sprintf(tempstring, val_format, val_raw/val_scale); } return tempstring; }
const char *show_timerperm_cb(guiObject_t *obj, const void *data) { (void)obj; u8 idx = (long)data; if (idx & 0x80) snprintf(tempstring, sizeof(tempstring), _tr("Set to")); else TIMER_SetString(tempstring,(long)Model.timer[idx & 0x7f].val); return tempstring; }
const char * timer_value_str_cb(guiObject_t *obj, const void *data) { (void)obj; switch ((long)data) { case OLD_TIMER: TIMER_SetString(tempstring, tp->oldvalue); return tempstring; case ADD_TIMER: TIMER_SetString(tempstring, ((tp->hour * 60 + tp->minute) * 60 + tp->second) * 1000); return tempstring; case NEW_TIMER: TIMER_SetString(tempstring, tp->newvalue); return tempstring; case ADD_BUTTON: return _tr("Add"); case SET_BUTTON: return _tr("Set"); } return ""; }
const char *set_start_cb(guiObject_t *obj, int dir, void *data) { (void)obj; u8 idx = (long)data; u8 changed; struct Timer *timer = &Model.timer[idx]; timer->timer = GUI_TextSelectHelper(timer->timer, 0, TIMER_MAX_VAL, dir, 5, 30, &changed); if (changed) TIMER_Reset(idx); TIMER_SetString(tp->timer, timer->timer*1000); return tp->timer; }
static const char *batalarmwarn_select_cb(guiObject_t *obj, int dir, void *data) { (void)obj; (void)data; u8 changed; u16 batt_warning = Transmitter.batt_warning_interval; batt_warning = GUI_TextSelectHelper(batt_warning, MIN_BATTERY_WARNING_INTERVAL, MAX_BATTERY_WARNING_INTERVAL, dir, 5, 30, &changed); if (changed) Transmitter.batt_warning_interval = batt_warning; if( 0 == batt_warning) return _tr("Off"); TIMER_SetString(tempstring, Transmitter.batt_warning_interval * 1000); return tempstring; }
static const char *prealert_time_cb(guiObject_t *obj, int dir, void *data) { (void)obj; (void)data; u8 changed; u16 prealert_time = Transmitter.countdown_timer_settings.prealert_time/1000; prealert_time = GUI_TextSelectHelper(prealert_time, MIN_PERALERT_TIME, MAX_PERALERT_TIME, dir, 5, 10, &changed); if (changed) Transmitter.countdown_timer_settings.prealert_time = prealert_time * 1000; if (prealert_time == 0) return _tr("Off"); TIMER_SetString(tempstring, Transmitter.countdown_timer_settings.prealert_time); return tempstring; }
const char *show_box_cb(guiObject_t *obj, const void *data) { (void)obj; u8 idx = (long)data; #if HAS_RTC if (idx <= NUM_RTC) { u32 time = RTC_GetValue(); idx == 1 ? RTC_GetTimeFormatted(tempstring, time) : RTC_GetDateFormatted(tempstring, time); return tempstring; } #endif if (idx - NUM_RTC <= NUM_TIMERS) { TIMER_SetString(tempstring, TIMER_GetValue(idx - NUM_RTC - 1)); } else if(idx - NUM_RTC - NUM_TIMERS <= NUM_TELEM) { TELEMETRY_GetValueStr(tempstring, idx - NUM_RTC - NUM_TIMERS); } else { sprintf(tempstring, "%3d%%", RANGE_TO_PCT(MIXER_GetChannel(idx - (NUM_RTC + NUM_TIMERS + NUM_TELEM + 1), APPLY_SAFETY | APPLY_SCALAR))); } return tempstring; }
static const char *auto_dimmer_time_cb(guiObject_t *obj, int dir, void *data) { (void)obj; (void)data; u8 changed; u16 dimmer_timmer = Transmitter.auto_dimmer.timer/1000; dimmer_timmer = GUI_TextSelectHelper(dimmer_timmer, MIN_BACKLIGHT_DIMTIME, MAX_BACKLIGHT_DIMTIME, dir, 5, 10, &changed); if (changed) Transmitter.auto_dimmer.timer = dimmer_timmer * 1000; guiObject_t *dimobj = _get_obj(ITEM_DIMVAL, 0); if (dimmer_timmer == 0) { if(dimobj) GUI_TextSelectEnable((guiTextSelect_t *)dimobj, 0); return _tr("Off"); } if (dimobj) GUI_TextSelectEnable((guiTextSelect_t *)dimobj, 1); TIMER_SetString(tempstring, Transmitter.auto_dimmer.timer); return tempstring; }