Hi All
End of a long day and my brain is fried. Slowly building my spa controller. I'm up to the last state of creating a menu to adjust the various settings. I've read a lot about menus and various menu libraries but I thought it would be easy to create my own structure for a simple menu. (I'm thinking I might be wrong)
Question:
can you change the enum states using some form of ++ or -- and then have a switch case that has the appropriate lcd.print items (a select button and an if statement would send them to actually editing the values). reading Enumeration declaration - cppreference.com suggests I can manipulate things via the number of the state, but I'm new to this C++ stuff
ie if sState = SetComfortTimes therefore sState = 1 can I use a sState++ to move it to 2 which is SetTemps?
if I have
// States for Settings
// 0 1 2 3 4 5
enum SSTATES {SetDateTime, SetComfortTimes, SetTemps, SetDelays};
SSTATES sState;
can I do something like (this is one of many attempts at SSTATES, sState SSTATES.sState SSTATE[sState] I've tried a few but get errors, this ones produces "no match for 'operator++' (operand type is 'SSTATES')." or dor ++ and -- operators only work on bytes and ints ?
if(btnUP.wasPressed()) // using JC_Button.h
{
backlightMillis = currentMillis;
if (sState <= 3) sState ++;
and a switch case
// Menu Switch Case
switch (sState)
{
//********************* 0
case SetDateTime:
{
lcd.setCursor(0,0);
lcd.print(" Set Date/Time");
}
break;
case SetComfortTimes:
{
lcd.setCursor(0,0);
lcd.print("Set Comfot Times");
}
break;
case SetTemps:
{
lcd.setCursor(0,0);
lcd.print("Set Temps ");
}
break;
case SetDelays:
{
lcd.setCursor(0,0);
lcd.print("Edit Delay Times");
}
break;
}// end sState
Cheers
Al