本文整理汇总了C++中FSM::isInState方法的典型用法代码示例。如果您正苦于以下问题:C++ FSM::isInState方法的具体用法?C++ FSM::isInState怎么用?C++ FSM::isInState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FSM
的用法示例。
在下文中一共展示了FSM::isInState方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: error
void error(String message) {
if(self.isInState(Start)) {
sd.initErrorPrint(&terminal);
} else {
sd.errorPrint(&terminal);
}
terminal.flush();
errorMessage = message;
self.transitionTo(Error);
}
示例2: renderError
void renderError() {
Display.setTextColor(RED, BLACK);
/***** Error Message *****/
Display.setTextSize(1);
Display.setCursor(1, 55);
Display.println(errorMessage);
if(self.isInState(Start)) {
sd.initErrorPrint(&Display);
} else {
sd.errorPrint(&Display);
}
}
示例3: render
void render() {
uint32_t start = millis();
if(clear) {
clear = false;
Display.fillScreen(BLACK);
}
if(true == self.isInState(Error)) {
renderError();
} else {
renderClock();
}
renderStatus();
frameTime = millis() - start;
}
示例4: renderStatus
void renderStatus() {
/***** RSSI Indicator *****/
drawIcon(1, 1, 12, abs(WiFi.RSSI()), YELLOW, WHITE);
Display.setTextColor(YELLOW, BLACK);
/***** SSID *****/
Display.setTextSize(1);
Display.setCursor(18, 6);
Display.print(WiFi.SSID());
/***** Snooze Indicator *****/
Display.setCursor(120, 6);
if(true == self.isInState(Snuze)) {
Display.print('Z');
} else {
Display.print(' ');
}
}
示例5: 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;
}
}
}