@@ -189,7 +189,7 @@ uint16_t ImportCurrent = IMPORT_CURRENT;
189189struct DelayedTimeStruct DelayedStartTime;
190190struct DelayedTimeStruct DelayedStopTime;
191191uint8_t DelayedRepeat; // 0 = no repeat, 1 = daily repeat
192- bool LCDlock = false ; // Lock buttons on LCD display if true
192+ uint8_t LCDlock = LCD_LOCK ; // 0 = LCD buttons operational, 1 = LCD buttons disabled
193193uint8_t Grid = GRID; // Type of Grid connected to Sensorbox (0:4Wire / 1:3Wire )
194194uint8_t SB2_WIFImode = SB2_WIFI_MODE; // Sensorbox-2 WiFi Mode (0:Disabled / 1:Enabled / 2:Start Portal)
195195uint8_t RFIDReader = RFID_READER; // RFID Reader (0:Disabled / 1:Enabled / 2:Enable One / 3:Learn / 4:Delete / 5:Delete All / 6: Remote via OCPP)
@@ -3923,7 +3923,7 @@ void read_settings() {
39233923 DelayedStartTime.epoch2 = preferences.getULong (" DelayedStartTim" , DELAYEDSTARTTIME); // epoch2 is 4 bytes long on arduino; NVS key has reached max size
39243924 DelayedStopTime.epoch2 = preferences.getULong (" DelayedStopTime" , DELAYEDSTOPTIME); // epoch2 is 4 bytes long on arduino
39253925 DelayedRepeat = preferences.getUShort (" DelayedRepeat" , 0 );
3926- LCDlock = preferences.getUShort (" LCDlock" , 0 );
3926+ LCDlock = preferences.getUChar (" LCDlock" , LCD_LOCK );
39273927 TZinfo = preferences.getString (" TimezoneInfo" ," " );
39283928 if (TZinfo != " " ) {
39293929 setenv (" TZ" ,TZinfo.c_str (),1 );
@@ -3997,6 +3997,7 @@ void write_settings(void) {
39973997 preferences.putString (" RequiredEVCCID" , String (RequiredEVCCID));
39983998 preferences.putUShort (" maxTemp" , maxTemp);
39993999 preferences.putUChar (" AutoUpdate" , AutoUpdate);
4000+ preferences.putUChar (" LCDlock" , LCDlock);
40004001
40014002#if ENABLE_OCPP
40024003 preferences.putUChar (" OcppMode" , OcppMode);
@@ -4149,7 +4150,7 @@ bool handle_URI(struct mg_connection *c, struct mg_http_message *hm, webServerR
41494150 doc[" settings" ][" starttime" ] = (DelayedStartTime.epoch2 ? DelayedStartTime.epoch2 + EPOCH2_OFFSET : 0 );
41504151 doc[" settings" ][" stoptime" ] = (DelayedStopTime.epoch2 ? DelayedStopTime.epoch2 + EPOCH2_OFFSET : 0 );
41514152 doc[" settings" ][" repeat" ] = DelayedRepeat;
4152- doc[" settings" ][" LCDlock " ] = LCDlock;
4153+ doc[" settings" ][" lcdlock " ] = LCDlock;
41534154#if MODEM
41544155 doc[" settings" ][" required_evccid" ] = RequiredEVCCID;
41554156 doc[" settings" ][" modem" ] = " Experiment" ;
@@ -4466,15 +4467,12 @@ bool handle_URI(struct mg_connection *c, struct mg_http_message *hm, webServerR
44664467 }
44674468 }
44684469
4469- if (request->hasParam (" LCDlock " )) {
4470- int lock = request->getParam (" LCDlock " )->value ().toInt ();
4470+ if (request->hasParam (" lcdlock " )) {
4471+ int lock = request->getParam (" lcdlock " )->value ().toInt ();
44714472 if (lock >= 0 && lock <= 1 ) { // boundary check
44724473 LCDlock = lock;
4473- doc[" LCDlock" ] = lock;
4474- if (preferences.begin (" settings" , false ) ) {
4475- preferences.putUShort (" LCDlock" , LCDlock);
4476- preferences.end ();
4477- }
4474+ doc[" lcdlock" ] = lock;
4475+ write_settings ();
44784476 }
44794477 }
44804478
@@ -5530,6 +5528,18 @@ void setup() {
55305528 read_settings (); // initialize with default data when starting for the first time
55315529 validate_settings ();
55325530 ReadRFIDlist (); // Read all stored RFID's from storage
5531+
5532+ // Sample middle+right button, and lock/unlock LCD buttons.
5533+ pinMatrixOutDetach (PIN_LCD_SDO_B3, false , false ); // disconnect MOSI pin
5534+ pinMode (PIN_LCD_SDO_B3, INPUT);
5535+ pinMode (PIN_LCD_A0_B2, INPUT);
5536+ if ((digitalRead (PIN_LCD_A0_B2) == 0 ) && (digitalRead (PIN_LCD_SDO_B3) == 0 )) {
5537+ LCDlock = !LCDlock;
5538+ write_settings ();
5539+ }
5540+ pinMode (PIN_LCD_SDO_B3, OUTPUT);
5541+ pinMatrixOutAttach (PIN_LCD_SDO_B3, VSPID_IN_IDX, false , false ); // re-attach MOSI pin
5542+ pinMode (PIN_LCD_A0_B2, OUTPUT);
55335543
55345544 // Create Task EVSEStates, that handles changes in the CP signal
55355545 xTaskCreate (
0 commit comments