energy load error handling
This commit is contained in:
parent
8aeb6ab30a
commit
c2e45490b0
|
@ -84,6 +84,9 @@ void CurrentTransformerCard::saveEnergy(){
|
||||||
}
|
}
|
||||||
void CurrentTransformerCard::loadEnergy(){
|
void CurrentTransformerCard::loadEnergy(){
|
||||||
this->fram->read(this->framAddress, (uint8_t*)&this->energy, sizeof(this->energy));
|
this->fram->read(this->framAddress, (uint8_t*)&this->energy, sizeof(this->energy));
|
||||||
|
if (this->energy < 0 || isnan(this->energy)) {
|
||||||
|
this->energy = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CurrentTransformerCard::setEnergyAutoSave(bool autoSave){
|
void CurrentTransformerCard::setEnergyAutoSave(bool autoSave){
|
||||||
|
|
Loading…
Reference in New Issue