diff --git a/data/device.htm b/data/device.htm index b5dde8a..5921864 100644 --- a/data/device.htm +++ b/data/device.htm @@ -118,7 +118,7 @@ $('#spinner').show(); $.getJSON(url, function (cfg) { console.log( cfg ); - $("#app-ver").text(cfg["app-ver"] + " (html 0.2.2)"); + $("#app-ver").text(cfg["app-ver"] + " (html 0.3.0)"); $("#mdns").text(cfg["mdns"]); $("#id").text(cfg["id"]); }) diff --git a/data/device.min.htm b/data/device.min.htm index c06697e..0a6cba7 100644 --- a/data/device.min.htm +++ b/data/device.min.htm @@ -14,4 +14,4 @@ - -->
(C) Copyright 2021 Magnus Persson
\ No newline at end of file + -->
(C) Copyright 2021 Magnus Persson
\ No newline at end of file diff --git a/platformio.ini b/platformio.ini index ff7be43..9e4f832 100644 --- a/platformio.ini +++ b/platformio.ini @@ -26,7 +26,7 @@ build_flags = #-O0 -Wl,-Map,output.map #-D SKIP_SLEEPMODE -D USE_LITTLEFS=true #-D EMBED_HTML - -D CFG_APPVER="\"0.2.4\"" + -D CFG_APPVER="\"0.3.0\"" lib_deps = # https://github.com/jrowberg/i2cdevlib.git # Using local copy of this library https://github.com/codeplea/tinyexpr diff --git a/src/gyro.cpp b/src/gyro.cpp index 0936d46..21a0836 100644 --- a/src/gyro.cpp +++ b/src/gyro.cpp @@ -211,6 +211,7 @@ bool GyroSensor::read() { } else { validValue = true; angle = calculateAngle( raw ); + sensorTemp = ((float) raw.temp) / 340 + 36.53; //Log.notice(F("GYRO: Calculated angle %F" CR), angle ); } diff --git a/src/gyro.h b/src/gyro.h index d11b7aa..b6a9eac 100644 --- a/src/gyro.h +++ b/src/gyro.h @@ -51,6 +51,7 @@ class GyroSensor { bool sensorConnected = false; bool validValue = false; double angle = 0; + float sensorTemp = 0; RawGyroData calibrationOffset; void debug(); @@ -66,6 +67,7 @@ class GyroSensor { void calibrateSensor(); double getAngle() { return angle; }; + double getSensorTempC() { return sensorTemp; }; bool isConnected() { return sensorConnected; }; bool hasValue() { return validValue; }; void enterSleep(); diff --git a/src/main.cpp b/src/main.cpp index 9f3f663..28819a6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -151,17 +151,19 @@ void loop() { if( sleepModeActive || abs(millis() - lastMillis) > interval ) { float angle = 90; float volt = myBatteryVoltage.getVoltage(); + float sensorTemp = 0; loopCounter++; #if LOG_LEVEL==6 Log.verbose(F("Main: Entering main loop." CR) ); #endif // If we dont get any readings we just skip this and try again the next interval. if( myGyro.hasValue() ) { - angle = myGyro.getAngle(); + angle = myGyro.getAngle(); // Gyro angle + sensorTemp = myGyro.getSensorTempC(); // Temp in the Gyro float temp = myTempSensor.getValueCelcius(); // The code is build around using C for temp. float gravity = calculateGravity( angle, temp ); #if LOG_LEVEL==6 - Log.verbose(F("Main: Sensor values gyro=%F, temp=%F, gravity=%F." CR), angle, temp, gravity ); + Log.verbose(F("Main: Sensor values gyro angle=%F gyro temp=%F, temp=%F, gravity=%F." CR), angle, sensorTemp, temp, gravity ); #endif if( myConfig.isGravityTempAdj() ) { gravity = gravityTemperatureCorrection( gravity, temp); // Use default correction temperature of 20C @@ -172,7 +174,7 @@ void loop() { // Limit the printout when sleep mode is not active. if( loopCounter%10 == 0 || sleepModeActive ) - Log.notice(F("Main: Gyro angle=%F, temp=%F, gravity=%F, batt=%F." CR), angle, temp, gravity, volt ); + Log.notice(F("Main: gyro angle=%F, gyro temp=%F, DS18B20 temp=%F, gravity=%F, batt=%F." CR), angle, sensorTemp, temp, gravity, volt ); #if defined( ACTIVATE_PUSH ) unsigned long runTime = millis() - startMillis;