Added 'V' command to CLI
This command erases all values of saved Characteristics
This commit is contained in:
parent
c7d82f74c6
commit
6356012fd6
|
|
@ -784,6 +784,14 @@ void Span::processSerialCommand(const char *c){
|
|||
}
|
||||
break;
|
||||
|
||||
case 'V': {
|
||||
|
||||
nvs_erase_all(charNVS);
|
||||
nvs_commit(charNVS);
|
||||
Serial.print("\n*** Values for all saved Characteristics erased!\n\n");
|
||||
}
|
||||
break;
|
||||
|
||||
case 'H': {
|
||||
|
||||
statusLED.off();
|
||||
|
|
@ -893,6 +901,7 @@ void Span::processSerialCommand(const char *c){
|
|||
Serial.print(" O - change the OTA password\n");
|
||||
Serial.print(" A - start the HomeSpan Setup Access Point\n");
|
||||
Serial.print("\n");
|
||||
Serial.print(" V - delete value settings for all saved Characteristics\n");
|
||||
Serial.print(" U - unpair device by deleting all Controller data\n");
|
||||
Serial.print(" H - delete HomeKit Device ID as well as all Controller data and restart\n");
|
||||
Serial.print("\n");
|
||||
|
|
|
|||
|
|
@ -380,6 +380,8 @@ struct SpanCharacteristic{
|
|||
|
||||
template <typename T, typename A=boolean, typename B=boolean> void init(T val, boolean nvsStore, A min=0, B max=1){
|
||||
|
||||
int nvsFlag=0;
|
||||
|
||||
uvSet(value,val);
|
||||
uvSet(newValue,val);
|
||||
uvSet(minValue,min);
|
||||
|
|
@ -396,10 +398,12 @@ struct SpanCharacteristic{
|
|||
if(!nvs_get_blob(homeSpan.charNVS,nvsKey,NULL,&len)){
|
||||
nvs_get_blob(homeSpan.charNVS,nvsKey,&value,&len);
|
||||
newValue=value;
|
||||
nvsFlag=2;
|
||||
}
|
||||
else {
|
||||
nvs_set_blob(homeSpan.charNVS,nvsKey,&value,sizeof(UVal)); // store data
|
||||
nvs_commit(homeSpan.charNVS); // commit to NVS
|
||||
nvsFlag=1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -407,8 +411,10 @@ struct SpanCharacteristic{
|
|||
if(format!=STRING && format!=BOOL)
|
||||
homeSpan.configLog+= " Range=[" + String(uvPrint(minValue)) + "," + String(uvPrint(maxValue)) + "]";
|
||||
|
||||
if(nvsStore)
|
||||
if(nvsFlag==2)
|
||||
homeSpan.configLog+=" (restored)";
|
||||
else if(nvsFlag==1)
|
||||
homeSpan.configLog+=" (storing)";
|
||||
|
||||
boolean valid=false;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue