diff --git a/html/index.htm b/html/index.htm index b6f5b5c..70274f5 100644 --- a/html/index.htm +++ b/html/index.htm @@ -124,7 +124,7 @@ $("#id").text(cfg["id"]); var angle = cfg["angle"]; - + if(angle==0) { $("#angle").text("Gyro moving"); $("#gravity").text("Gyro moving"); diff --git a/html/index.min.htm b/html/index.min.htm index 5e8ad5a..004a63b 100644 --- a/html/index.min.htm +++ b/html/index.min.htm @@ -1 +1 @@ -Beer Gravity Monitor

Gravity:
Loading...
Temperature:
Loading...
Angle/Tilt:
Loading...
Battery:
Loading...

(C) Copyright 2021-22 Magnus Persson
\ No newline at end of file +Beer Gravity Monitor

Gravity:
Loading...
Temperature:
Loading...
Angle/Tilt:
Loading...
Battery:
Loading...

(C) Copyright 2021-22 Magnus Persson
\ No newline at end of file diff --git a/src/webserver.cpp b/src/webserver.cpp index bd8b220..a20674c 100644 --- a/src/webserver.cpp +++ b/src/webserver.cpp @@ -263,7 +263,11 @@ void WebServerHandler::webHandleStatus() { DynamicJsonDocument doc(256); - double angle = myGyro.getAngle(); + double angle = 0; + + if (myGyro.hasValue()) + angle = myGyro.getAngle(); + double tempC = myTempSensor.getTempC(myConfig.isGyroTemp()); double gravity = calculateGravity(angle, tempC);