static QState uiMenuSettimeMinutes(struct UI *me) { switch (Q_SIG(me)) { case Q_ENTRY_SIG: lcd_buttons(LCD_BUTTONS_ALL); me->settime_YmdHM = 'M'; display_set_time(me, TRUE, TRUE); QActive_armX((QActive*)me, 1, 17); return Q_HANDLED(); case Q_TIMEOUT1_SIG: return Q_TRAN(uiMenuSettimeMinutesFlash); case BUTTON_ENTER_PRESS_SIGNAL: ACTION(); me->settime.seconds = 0; set_rtc_time(&me->settime); return Q_TRAN(uiMenuMaybeSettime); case BUTTON_UP_PRESS_SIGNAL: case BUTTON_UP_LONG_PRESS_SIGNAL: case BUTTON_UP_REPEAT_SIGNAL: ACTION(); inc_minute(&me->settime); display_set_time(me, TRUE, TRUE); QActive_armX((QActive*)me, 1, 17); return Q_HANDLED(); case BUTTON_DOWN_PRESS_SIGNAL: case BUTTON_DOWN_LONG_PRESS_SIGNAL: case BUTTON_DOWN_REPEAT_SIGNAL: ACTION(); dec_minute(&me->settime); display_set_time(me, TRUE, TRUE); QActive_armX((QActive*)me, 1, 17); return Q_HANDLED(); } return Q_SUPER(uiMenu); }
void inc_second(dstime *t, int i) { t->second += i; if(t->second >= 60) { inc_minute(t, 1); t->second -= 60; } }