if(bModePressed){ // 若按下BUTTON_MODE_PIN就跳到下一個模式
needToRefresh = true;
switch(state){
case S_Normal:
state = S_Temperature_High_Limit;
break;
case S_Temperature_High_Limit:
state = S_Temperature_Low_Limit;
break;
case S_Temperature_Low_Limit:
state = S_Humidity_High_Limit;
break;
case S_Humidity_High_Limit:
state = S_Humidity_Low_Limit;
break;
case S_Humidity_Low_Limit:
state = S_Normal;
break;
}
}
switch(state){
case S_Temperature_High_Limit:
case S_Temperature_Low_Limit:
case S_Humidity_High_Limit:
case S_Humidity_Low_Limit:
if(bUpPressed){ // 按下BUTTON_UP_PIN,增加數值
limits[state]++;
needToRefresh = true;
needToSaveLimits = true;
}
if(bDownPressed){ // 按下BUTTON_DOWN_PIN,減少數值
limits[state]--;
needToRefresh = true;
needToSaveLimits = true;
}
delay(100);
break;
}
}