From 19481219e373fe788b86ea232b6db50874388e56 Mon Sep 17 00:00:00 2001 From: Lexzach Date: Mon, 25 Apr 2022 23:35:55 -0400 Subject: [PATCH] Update main.cpp --- facp/src/main.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/facp/src/main.cpp b/facp/src/main.cpp index 157d639..bf3491e 100644 --- a/facp/src/main.cpp +++ b/facp/src/main.cpp @@ -23,6 +23,7 @@ bool possibleAlarm = false; //panel receieved 0 from pull station ciruit and is bool definiteAlarm = false; //panel has investigated and determined that it was not a fluke bool walkTest = false; //is the system in walk test bool silentWalkTest = false; +bool backlightOn = true; int characters[] = {32,45,46,47,48,49,50,51,52,53,54,55,56,57,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90}; //characters allowed on name int panelNameList[16]; int clearTimer = 0; //timer for keeping track of button holding for clearing character in the name editor @@ -1033,14 +1034,16 @@ void config(){ } void loop() { if (lcdTimeout!=0){ - if (lcdTimeout <= lcdTimeoutTimer){ + if (lcdTimeout <= lcdTimeoutTimer and backlightOn == true){ lcd.noBacklight(); - } else { + backlightOn = false; + } else if (backlightOn == true) { lcdTimeoutTimer++; } - if (drillPressed == true or silencePressed == true or resetPressed == true or fullAlarm == true or trouble == true){ + if ((drillPressed == true or silencePressed == true or resetPressed == true or fullAlarm == true or trouble == true) and backlightOn == false){ lcdTimeoutTimer = 0; lcd.backlight(); + backlightOn = true; } } delay(1);