Added timeout check at wifi connect
This commit is contained in:
parent
e15f01d290
commit
fb9fde73a4
Binary file not shown.
BIN
bin/firmware.bin
BIN
bin/firmware.bin
Binary file not shown.
@ -1 +1 @@
|
||||
{ "project":"gravmon", "version":"0.2.2", "html": [ "index.min.htm", "device.min.htm", "config.min.htm", "about.min.htm" ] }
|
||||
{ "project":"gravmon", "version":"0.2.3", "html": [ "index.min.htm", "device.min.htm", "config.min.htm", "about.min.htm" ] }
|
@ -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
|
||||
|
@ -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
|
||||
//
|
||||
|
@ -49,6 +49,9 @@ void printBuildOptions() {
|
||||
#ifdef SKIP_SLEEPMODE
|
||||
"SKIP_SLEEP "
|
||||
#endif
|
||||
#ifdef EMBED_HTML
|
||||
"EMBED_HTML "
|
||||
#endif
|
||||
#ifdef ACTIVATE_OTA
|
||||
"OTA "
|
||||
#endif
|
||||
|
@ -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
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user