本文整理汇总了C++中FSM::immediateTransitionTo方法的典型用法代码示例。如果您正苦于以下问题:C++ FSM::immediateTransitionTo方法的具体用法?C++ FSM::immediateTransitionTo怎么用?C++ FSM::immediateTransitionTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FSM
的用法示例。
在下文中一共展示了FSM::immediateTransitionTo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: computeKeypadInput
void computeKeypadInput(char key)
{
static uint8_t index = 0;
static time_t modifiedTime;
if (fsm.isInState(_waitState))
{
switch (key)
{
case '#':
lcd.clear();
fsm.transitionTo(_menuState);
break;
}
}
if (fsm.isInState(_menuState))
{
switch (key)
{
case '#':
lcd.clear();
fsm.transitionTo(_waitState);
break;
case '*':
lcd.clear();
// We have to call an empty state or the menuState function
// will not be called
fsm.immediateTransitionTo(_emptyState);
fsm.transitionTo(_menuState);
break;
case '1':
lcd.clear();
fsm.transitionTo(_changeHourState);
break;
case '2':
lcd.clear();
fsm.transitionTo(_changeStartLedState);
break;
case '3':
lcd.clear();
fsm.transitionTo(_changeStopLedState);
break;
}
}
if (fsm.isInState(_changeHourState) or
fsm.isInState(_changeStartLedState) or
fsm.isInState(_changeStopLedState) or
fsm.isInState(_changeFadeInState) or
fsm.isInState(_changeFadeOutState))
{
switch (key)
{
case '*':
if (index != 6) {
break;
}
index = 0;
lcd.clear();
if (fsm.isInState(_changeHourState)) {
RTC.set(modifiedTime);
setSyncProvider(RTC.get);
fsm.transitionTo(_waitState);
}
else if (fsm.isInState(_changeStartLedState)) {
led.setStartTime(modifiedTime);
led.saveEepromDatas();
fsm.transitionTo(_changeFadeInState);
}
else if (fsm.isInState(_changeStopLedState)) {
led.setStopTime(modifiedTime);
led.saveEepromDatas();
fsm.transitionTo(_changeFadeOutState);
}
else if (fsm.isInState(_changeFadeInState)) {
led.setFadeInTime(modifiedTime);
led.saveEepromDatas();
fsm.transitionTo(_waitState);
}
else if (fsm.isInState(_changeFadeOutState)) {
led.setFadeOutTime(modifiedTime);
led.saveEepromDatas();
fsm.transitionTo(_waitState);
}
break;
case '#':
index = 0;
lcd.clear();
fsm.transitionTo(_waitState);
break;
default:
modifiedTime = computeUserInput(index, atoi(&key));
index++;
break;
}
}
}