本文整理汇总了C++中FSM::transitionTo方法的典型用法代码示例。如果您正苦于以下问题:C++ FSM::transitionTo方法的具体用法?C++ FSM::transitionTo怎么用?C++ FSM::transitionTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FSM
的用法示例。
在下文中一共展示了FSM::transitionTo方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: disconnectedUpdate
void disconnectedUpdate() {
if(Particle.connected()) {
connectionFsm.transitionTo(Online);
} else if(connectionFsm.timeInCurrentState() > DISCONNECTED_TIMEOUT) {
connectionFsm.transitionTo(Offline);
}
}
示例2: updateSnuze
void updateSnuze() {
if(-1 == clicks) {
self.transitionTo(Clock);
return;
}
if(snuzeRuntime.check()) {
self.transitionTo(Alarm);
return;
}
}
示例3: updateAlarm
void updateAlarm() {
RGB.brightness(map(abs((millis() % 2000) - 1000), 0, 1000, 0, 255));
switch(clicks) {
case -1:
self.transitionTo(Clock);
return;
case 1:
self.transitionTo(Snuze);
return;
}
}
示例4: offlineUpdate
void offlineUpdate() {
digitalWrite(LIGHT_PIN, LIGHT_ON);
if(Particle.connected()) {
connectionFsm.transitionTo(Online);
}
}
示例5: updateStart
void updateStart() {
if(Time.now() > 10000 && millis() > 5000) {
self.transitionTo(Clock);
return;
}
}
示例6: error
void error(String message) {
if(self.isInState(Start)) {
sd.initErrorPrint(&terminal);
} else {
sd.errorPrint(&terminal);
}
terminal.flush();
errorMessage = message;
self.transitionTo(Error);
}
示例7: updateClock
void updateClock() {
uint8_t currentMinute = Time.minute();
if(currentMinute != previousMinute) {
previousMinute = currentMinute;
if(alarms.check()) {
self.transitionTo(Alarm);
return;
}
}
}
示例8: onlineUpdate
void onlineUpdate() {
digitalWrite(LIGHT_PIN, LIGHT_OFF);
if(!Particle.connected()) {
connectionFsm.transitionTo(Disconnected);
}
}
示例9: 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;
}
}
}
示例10: updateError
void updateError() {
if(-1 == clicks) {
self.transitionTo(Clock);
}
}