Added "not found" messages for gyro/temp sensor.

This commit is contained in:
Magnus Persson
2022-08-02 13:02:01 +02:00
parent 414d7d51c2
commit a6bff7287e
4 changed files with 22 additions and 8 deletions

View File

@ -332,9 +332,13 @@ void WebServerHandler::webHandleStatus() {
DynamicJsonDocument doc(500);
double angle = 0;
double angle = 0; // Indicate we have no valid gyro value
if (myGyro.hasValue()) angle = myGyro.getAngle();
if (myGyro.isConnected()) {
if (myGyro.hasValue()) angle = myGyro.getAngle();
} else {
angle = -1; // Indicate that we have no connection to gyro
}
double tempC = myTempSensor.getTempC(myConfig.isGyroTemp());
double gravity = calculateGravity(angle, tempC);