diff --git a/bin/firmware-debug.bin b/bin/firmware-debug.bin index 82d2bfa..e67ccc5 100644 Binary files a/bin/firmware-debug.bin and b/bin/firmware-debug.bin differ diff --git a/bin/firmware.bin b/bin/firmware.bin index 68356e3..4cb1ef6 100644 Binary files a/bin/firmware.bin and b/bin/firmware.bin differ diff --git a/bin/version.json b/bin/version.json index 416f1c1..3d09c82 100644 --- a/bin/version.json +++ b/bin/version.json @@ -1 +1 @@ -{ "project":"gravmon", "version":"0.2.2", "html": [ "index.min.htm", "device.min.htm", "config.min.htm", "about.min.htm" ] } \ No newline at end of file +{ "project":"gravmon", "version":"0.2.3", "html": [ "index.min.htm", "device.min.htm", "config.min.htm", "about.min.htm" ] } \ No newline at end of file diff --git a/platformio.ini b/platformio.ini index 9767358..a539be4 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.2\"" + -D CFG_APPVER="\"0.2.3\"" lib_deps = # https://github.com/jrowberg/i2cdevlib.git # Using local copy of this library https://github.com/codeplea/tinyexpr diff --git a/src/calc.cpp b/src/calc.cpp index 5a724c7..3c88220 100644 --- a/src/calc.cpp +++ b/src/calc.cpp @@ -27,8 +27,6 @@ SOFTWARE. #include "tinyexpr.h" #include "tempsensor.h" -//#define LOG_LEVEL 5 - // // Calculates gravity according to supplied formula, compatible with iSpindle/Fermentrack formula // diff --git a/src/helper.cpp b/src/helper.cpp index a5e98c0..2f29ffd 100644 --- a/src/helper.cpp +++ b/src/helper.cpp @@ -49,6 +49,9 @@ void printBuildOptions() { #ifdef SKIP_SLEEPMODE "SKIP_SLEEP " #endif +#ifdef EMBED_HTML + "EMBED_HTML " +#endif #ifdef ACTIVATE_OTA "OTA " #endif diff --git a/src/tempsensor.cpp b/src/tempsensor.cpp index 72a49e4..1ca2b7c 100644 --- a/src/tempsensor.cpp +++ b/src/tempsensor.cpp @@ -32,7 +32,7 @@ SOFTWARE. // Conversion between C and F // float convertCtoF( float t ) { - return (t * 1.8 ) + 32.0; + return (t * 1.8 ) + 32.0; } OneWire myOneWire(D6); @@ -47,36 +47,36 @@ TempSensor myTempSensor; void TempSensor::setup() { #if defined( SIMULATE_TEMP ) - hasSensors = true; - return; -#endif - - if( mySensors.getDeviceCount() ) + hasSensors = true; return; - -#if LOG_LEVEL==6 - Log.verbose(F("TSEN: Looking for temp sensors." CR)); #endif - mySensors.begin(); - if( mySensors.getDeviceCount() ) { - Log.notice(F("TSEN: Found %d sensors." CR), mySensors.getDeviceCount()); - mySensors.setResolution(TEMPERATURE_PRECISION); - } - - float t = myConfig.getTempSensorAdj(); - - // Set the temp sensor adjustment values - if( myConfig.isTempC() ) { - tempSensorAdjF = t * 1.8; // Convert the adjustment value to C - tempSensorAdjC = t; - } else { - tempSensorAdjF = t; - tempSensorAdjC = t * 0.556; // Convert the adjustent value to F - } + if( mySensors.getDeviceCount() ) + return; #if LOG_LEVEL==6 - Log.verbose(F("TSEN: Adjustment values for temp sensor %F C, %F F." CR), tempSensorAdjC, tempSensorAdjF ); + Log.verbose(F("TSEN: Looking for temp sensors." CR)); +#endif + mySensors.begin(); + + if( mySensors.getDeviceCount() ) { + Log.notice(F("TSEN: Found %d sensors." CR), mySensors.getDeviceCount()); + mySensors.setResolution(TEMPERATURE_PRECISION); + } + + float t = myConfig.getTempSensorAdj(); + + // Set the temp sensor adjustment values + if( myConfig.isTempC() ) { + tempSensorAdjF = t * 1.8; // Convert the adjustment value to C + tempSensorAdjC = t; + } else { + tempSensorAdjF = t; + tempSensorAdjC = t * 0.556; // Convert the adjustent value to F + } + +#if LOG_LEVEL==6 + Log.verbose(F("TSEN: Adjustment values for temp sensor %F C, %F F." CR), tempSensorAdjC, tempSensorAdjF ); #endif } @@ -84,25 +84,25 @@ void TempSensor::setup() { // Retrieving value from sensor // float TempSensor::getValue() { - float c = 0; + float c = 0; #if defined( SIMULATE_TEMP ) - return 21; + return 21; #endif - // Read the sensors - mySensors.requestTemperatures(); + // Read the sensors + mySensors.requestTemperatures(); - if( mySensors.getDeviceCount() >= 1) { - c = mySensors.getTempCByIndex(0); + if( mySensors.getDeviceCount() >= 1) { + c = mySensors.getTempCByIndex(0); #if LOG_LEVEL==6 - Log.verbose(F("TSEN: Reciving temp value for sensor %F C." CR), c); + Log.verbose(F("TSEN: Reciving temp value for sensor %F C." CR), c); #endif - hasSensor = true; - } + hasSensor = true; + } - return c; + return c; } // EOF \ No newline at end of file diff --git a/src/wifi.cpp b/src/wifi.cpp index 367d8d5..3ebc96f 100644 --- a/src/wifi.cpp +++ b/src/wifi.cpp @@ -75,13 +75,18 @@ bool Wifi::connect( bool showPortal ) { } } - // TODO: Add timeout after x retries to not end up in forever loop. - // Connect to wifi + int i = 0; + WiFi.begin(); while( WiFi.status() != WL_CONNECTED ) { delay(100); Serial.print( "." ); + + if( i++ > 100 ) { + LittleFS.end(); + ESP.reset(); + } } Serial.print( CR ); connectedFlag = true;