Hello,
I have the following code.
Serial.println("sensorUIInfo->airTemp MAIN C");
getAirTemp(); //Air Temp = 23
//Draw pH value
myGLCD.printNumF(sensorUIInfo->phLevel, 1, 20, 120);
Serial.println("sensorUIInfo->airTemp MAIN D");
getAirTemp(); //Air Temp = 32
The reason is that printNumF, if I do printNumI or nothing it's OK. Somehow that printF alters the value.
The struct is like this:
//All the data from the HW sensors.
struct SENSOR{
float phLevel;
float eCLevel;
int airTemp;
int waterTemp;
};
SENSOR* sensorUIInfo;
And I update from the engine to the UI like this:
void HydroponicsUI::updateInfoFromSensors( SENSOR* sensorInformation )
{
Serial.println("sensorInformation->airTemp");
Serial.println(sensorInformation->airTemp);
sensorUIInfo->phLevel = sensorInformation->phLevel;
sensorUIInfo->eCLevel = sensorInformation->eCLevel;
sensorUIInfo->airTemp = sensorInformation->airTemp;
sensorUIInfo->waterTemp = sensorInformation->waterTemp;
}
The controller does the update like this:
//Update the UI of the latest Sensor Info
Hydro_UI.updateInfoFromSensors( Hydro_Eng.getSensorInformation() );
Is this an error in my code?
Thanks.