mirror of
https://github.com/GreenPonik/DFRobot_ESP_PH_WITH_ADC_BY_GREENPONIK.git
synced 2026-02-20 02:21:21 +01:00
fix nan value from eeprom
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/GreenPonik/DFRobot_ESP_PH_WITH_ADC_BY_GREENPONIK.git"
|
||||
},
|
||||
"version": "1.2.2",
|
||||
"version": "1.2.3",
|
||||
"license": "LGPL-2.1",
|
||||
"frameworks": ["arduino"],
|
||||
"platforms": ["espressif32"]
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/GreenPonik/DFRobot_ESP_PH_WITH_ADC_BY_GREENPONIK.git"
|
||||
},
|
||||
"version": "1.2.2",
|
||||
"version": "1.2.3",
|
||||
"license": "LGPL-2.1",
|
||||
"frameworks": "arduino",
|
||||
"platforms": "espressif32"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name=DFRobot_ESP_PH_WITH_ADC_BY_GREENPONIK
|
||||
version=1.2.2
|
||||
version=1.2.3
|
||||
author=GREENPONIK
|
||||
maintainer=Greenponik <contact@greenponik.com>
|
||||
sentence=Update from DFROBOT library for ESP32+ADC compatibility
|
||||
|
||||
@@ -40,7 +40,7 @@ void DFRobot_ESP_PH_WITH_ADC::begin(int EepromStartAddress)
|
||||
this->_eepromStartAddress = EepromStartAddress;
|
||||
//check if calibration values (neutral and acid) are stored in eeprom
|
||||
this->_neutralVoltage = EEPROM.readFloat(this->_eepromStartAddress); //load the neutral (pH = 7.0)voltage of the pH board from the EEPROM
|
||||
if (this->_neutralVoltage == float())
|
||||
if (this->_neutralVoltage == float() || isnan(this->_neutralVoltage))
|
||||
{
|
||||
this->_neutralVoltage = PH_7_AT_25; // new EEPROM, write typical voltage
|
||||
EEPROM.writeFloat(this->_eepromStartAddress, this->_neutralVoltage);
|
||||
@@ -48,7 +48,7 @@ void DFRobot_ESP_PH_WITH_ADC::begin(int EepromStartAddress)
|
||||
}
|
||||
|
||||
this->_acidVoltage = EEPROM.readFloat(this->_eepromStartAddress + (int)sizeof(float)); //load the acid (pH = 4.0) voltage of the pH board from the EEPROM
|
||||
if (this->_acidVoltage == float())
|
||||
if (this->_acidVoltage == float() || isnan(this->_acidVoltage))
|
||||
{
|
||||
this->_acidVoltage = PH_4_AT_25; // new EEPROM, write typical voltage
|
||||
EEPROM.writeFloat(this->_eepromStartAddress + (int)sizeof(float), this->_acidVoltage);
|
||||
|
||||
Reference in New Issue
Block a user