Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Alarm
- {
- public:
- void TestRelay();
- void ShowDateMenu();
- void ShowTimeMenu();
- void MoveDTCursor(int move);
- void BlinkTargetCursor();
- void HideDTMenu();
- };
- void Alarm::TestRelay()
- {
- Serial.println("RelayTest_Start");
- digitalWrite(RELAI1, LOW);
- delay(1000);
- digitalWrite(RELAI1, HIGH);
- digitalWrite(RELAI2, LOW);
- delay(1000);
- digitalWrite(RELAI2, HIGH);
- menuStatus = NONE;
- Serial.println("RelayTest_Stop");
- }
- void Alarm::ShowDateMenu()
- {
- DTCursorEnabled = true;
- DTMode = 1;
- DTCursorPos = 1;
- ResetScreen();
- BlinkTargetCursor();
- }
- void Alarm::ShowTimeMenu()
- {
- DTCursorEnabled = true;
- DTMode = 2;
- DTCursorPos = 1;
- DTBlinkStatus = false;
- ResetScreen();
- BlinkTargetCursor();
- }
- void Alarm::MoveDTCursor(int move)
- {
- DTCursorPos += move;
- if(DTCursorPos == 1 && move < 0)
- DTCursorPos = 3;
- else if(DTCursorPos == 3 && move > 0)
- DTCursorPos = 0;
- }
- void Alarm::BlinkTargetCursor()
- {
- if(!DTCursorEnabled) return;
- switch(DTCursorPos)
- {
- case 1: // Heure ou jour
- {
- if(!DTBlinkStatus)
- {
- screen.ClearCharacter(3, 0);
- screen.ClearCharacter(3, 1*8);
- DTBlinkStatus = false;
- }
- else
- {
- if(DTMode == 1)
- {
- if(DTValues.year < 10)
- {
- screen.SendString("0", 3);
- screen.SendInt(DTValues.year, 3, 1*8);
- }
- else
- screen.SendInt(DTValues.year, 3);
- }
- else
- {
- if(DTValues.hour < 10)
- {
- screen.SendString("0", 3);
- screen.SendInt(DTValues.hour, 3, 1*8);
- }
- else
- screen.SendInt(DTValues.hour, 3);
- }
- DTBlinkStatus = true;
- }
- break;
- }
- case 2: // Minute ou mois
- {
- if(!DTBlinkStatus)
- {
- screen.ClearCharacter(3, 3*8);
- screen.ClearCharacter(3, 4*8);
- DTBlinkStatus = false;
- }
- else
- {
- if(DTMode == 1)
- {
- if(DTValues.month < 10)
- {
- screen.SendString("0", 3, 3*8);
- screen.SendInt(DTValues.month, 3, 4*8);
- }
- else
- screen.SendInt(DTValues.month, 3, 3*8);
- }
- else
- {
- if(DTValues.minute < 10)
- {
- screen.SendString("0", 3);
- screen.SendInt(DTValues.minute, 3, 1*8);
- }
- else
- screen.SendInt(DTValues.minute, 3);
- }
- DTBlinkStatus = true;
- }
- break;
- }
- case 3: // Seconde ou année
- {
- if(!DTBlinkStatus)
- {
- screen.ClearCharacter(3, 6*8);
- screen.ClearCharacter(3, 7*8);
- DTBlinkStatus = false;
- }
- else
- {
- if(DTMode == 1)
- {
- if(DTValues.day < 10)
- {
- screen.SendString("0", 3, 6*8);
- screen.SendInt(DTValues.day, 3, 7*8);
- }
- else
- screen.SendInt(DTValues.day, 3, 6*8);
- }
- else
- {
- if(DTValues.day < 10)
- {
- screen.SendString("0", 3);
- screen.SendInt(DTValues.day, 3, 1*8);
- }
- else
- screen.SendInt(DTValues.day, 3);
- }
- DTBlinkStatus = true;
- }
- break;
- }
- default:
- {
- screen.SendString("Erreur", 3);
- break;
- }
- }
- }
- void Alarm::HideDTMenu()
- {
- DTCursorEnabled = false;
- ResetScreen();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement