From 4973d1aaa1f55240294288db03c7ad3cc8dfb21e Mon Sep 17 00:00:00 2001 From: Gregg Date: Thu, 10 Feb 2022 21:09:42 -0600 Subject: [PATCH] Revert "Initial coding of protectPinISR(pin) method" This reverts commit 852a916d614193fc9277bc8f66049cbfc5015622. --- src/HomeSpan.cpp | 18 ------------------ src/HomeSpan.h | 9 --------- 2 files changed, 27 deletions(-) diff --git a/src/HomeSpan.cpp b/src/HomeSpan.cpp index 5ecda27..0435c93 100644 --- a/src/HomeSpan.cpp +++ b/src/HomeSpan.cpp @@ -1387,24 +1387,6 @@ void Span::checkRanges(){ homeSpan.configLog+="\n\n"; } -/////////////////////////////// - -void Span::protectGPIOs(boolean suspend){ - - auto gp=ProtectedGPIOs.begin(); - while(gp!=ProtectedGPIOs.end()){ - if(suspend){ - Serial.printf("PIN: %d Status: %d : ",gp->first,GPIO.pin[gp->first].int_type); - gp->second=GPIO.pin[gp->first].int_type; - GPIO.pin[gp->first].int_type=0; - Serial.printf("PIN: %d Status: %d\n",gp->first,GPIO.pin[gp->first].int_type); - } else { - GPIO.pin[gp->first].int_type=gp->second; - } - gp++; - } -} - /////////////////////////////// // SpanAccessory // /////////////////////////////// diff --git a/src/HomeSpan.h b/src/HomeSpan.h index da1ffac..607f0e0 100644 --- a/src/HomeSpan.h +++ b/src/HomeSpan.h @@ -146,7 +146,6 @@ struct Span{ vector Notifications; // vector of SpanBuf objects that store info for Characteristics that are updated with setVal() and require a Notification Event vector PushButtons; // vector of pointer to all PushButtons unordered_map TimedWrites; // map of timed-write PIDs and Alarm Times (based on TTLs) - unordered_map ProtectedGPIOs; // map of pins to protect when running an ISR during NVS operations unordered_map UserCommands; // map of pointers to all UserCommands @@ -161,7 +160,6 @@ struct Span{ void commandMode(); // allows user to control and reset HomeSpan settings with the control button void processSerialCommand(const char *c); // process command 'c' (typically from readSerial, though can be called with any 'c') void checkRanges(); // checks values of all Characteristics to ensure they are each within range - void protectGPIOs(boolean suspend); // true - disable ISRs on protectedGPIOs; false - re-enable ISRs on protectedGPIOs int sprintfAttributes(char *cBuf); // prints Attributes JSON database into buf, unless buf=NULL; return number of characters printed, excluding null terminator, even if buf=NULL void prettyPrint(char *buf, int nsp=2); // print arbitrary JSON from buf to serial monitor, formatted with indentions of 'nsp' spaces @@ -194,7 +192,6 @@ struct Span{ void setWifiCallback(void (*f)()){wifiCallback=f;} // sets an optional user-defined function to call once WiFi connectivity is established void setPairCallback(void (*f)(boolean isPaired)){pairCallback=f;} // sets an optional user-defined function to call when Pairing is established (true) or lost (false) void setApFunction(void (*f)()){apFunction=f;} // sets an optional user-defined function to call when activating the WiFi Access Point - void protectPinISR(uint8_t pin){ProtectedGPIOs[pin]=0;} // protects ISR on pin from NVS operations void setPairingCode(const char *s){sprintf(pairingCodeCommand,"S %9s",s);} // sets the Pairing Code - use is NOT recommended. Use 'S' from CLI instead void deleteStoredValues(){processSerialCommand("V");} // deletes stored Characteristic values from NVS @@ -415,7 +412,6 @@ struct SpanCharacteristic{ uvSet(value,val); if(nvsStore){ - homeSpan.protectGPIOs(true); nvsKey=(char *)malloc(16); uint16_t t; sscanf(type,"%x",&t); @@ -445,7 +441,6 @@ struct SpanCharacteristic{ nvsFlag=1; } } - homeSpan.protectGPIOs(false); } uvSet(newValue,value); @@ -542,10 +537,8 @@ struct SpanCharacteristic{ homeSpan.Notifications.push_back(sb); // store SpanBuf in Notifications vector if(nvsKey){ - homeSpan.protectGPIOs(true); nvs_set_str(homeSpan.charNVS,nvsKey,value.STRING); // store data nvs_commit(homeSpan.charNVS); - homeSpan.protectGPIOs(false); } } // setString() @@ -576,10 +569,8 @@ struct SpanCharacteristic{ homeSpan.Notifications.push_back(sb); // store SpanBuf in Notifications vector if(nvsKey){ - homeSpan.protectGPIOs(true); nvs_set_blob(homeSpan.charNVS,nvsKey,&value,sizeof(UVal)); // store data nvs_commit(homeSpan.charNVS); - homeSpan.protectGPIOs(false); } }