0
down vote
favorite
I'm beginner in qtstate machine and I'm trying to convert a state machine that is created using switch case, how would I model the state machine to the qt state machine. For example I have a state machine like the following
switch (state)
{
case ZL_ZL_RINSINGCUP_UP:
if(!GSet.defaultCleaningCup_LTC)
{
wtim=0;
emit stateChanged(state=ZL_RINSE,resStat);
break;
}
if(Fp.LidClose()||Global::UL>USERLEVEL_6){
if(wtim)
{
mot.Up(); // dont move when custom cup is used!
wtim=0;
}
else
{
if((!mot.isDown() && !mot.inMove())){
emit stateChanged(state=ZL_RINSE,resStat);
}
}
}
else
{
if(!wtim){ //lid opened
mot.Stop();
wtim=1;
}
}
break;
case ZL_RINSE: // GUI
break;
}
switch (state)
{
case ZL_ZL_RINSINGCUP_UP:
if(!GSet.defaultCleaningCup_LTC)
{
wtim=0;
emit stateChanged(state=ZL_RINSE,resStat);
break;
}
if(Fp.LidClose()||Global::UL>USERLEVEL_6){
if(wtim)
{
mot.Up(); // dont move when custom cup is used!
wtim=0;
}
else
{
if((!mot.isDown() && !mot.inMove())){
emit stateChanged(state=ZL_RINSE,resStat);
}
}
}
else
{
if(!wtim){ //lid opened
mot.Stop();
wtim=1;
}
}
break;
case ZL_RINSE: // GUI
break;
}
To copy to clipboard, switch view to plain text mode
Bookmarks