Update to wifi connection sequence + new perf target
This commit is contained in:
parent
202aeb8212
commit
940520006a
@ -76,7 +76,8 @@ http://gravmon.local/config.htm
|
||||
"interval": 900,
|
||||
"temperature": 20.5, // C or F based on setting, adjusted value.
|
||||
"temp-units": "C", // C or F based on setting
|
||||
"gravity": 1.0050, //
|
||||
"gravity": 1.0050, // Raw or temperature corrected gravity (based on setting)
|
||||
"corr-gravity": 1.0050, // Temperature corrected gravity
|
||||
"angle": 45.34,
|
||||
"battery": 3.67,
|
||||
"rssi": -12,
|
||||
@ -100,8 +101,9 @@ http://gravmon.local/config.htm
|
||||
### This is the format for InfluxDB v2
|
||||
|
||||
```
|
||||
measurement,host=<mdns>,device=<id>,temp-format=<C|F>,gravity-format=SG gravity=1.0004,angle=45.45,temp=20.1,battery=3.96,rssi=-18
|
||||
measurement,host=<mdns>,device=<id>,temp-format=<C|F>,gravity-format=SG,gravity=1.0004,corr-gravity=1.0004,angle=45.45,temp=20.1,battery=3.96,rssi=-18
|
||||
```
|
||||
|
||||

|
||||
|
||||
* The third section contains the gravity formula and also option for doing temperature compensation. The calibration formula uses two keywords, temp and tilt. Temperature is in the selected device format.
|
||||
|
@ -72,6 +72,24 @@ extra_scripts =
|
||||
script/copy_firmware.py
|
||||
script/create_versionjson.py
|
||||
build_unflags = ${common_env_data.build_unflags}
|
||||
build_flags =
|
||||
${common_env_data.build_flags}
|
||||
-D LOG_LEVEL=4
|
||||
lib_deps =
|
||||
${common_env_data.lib_deps}
|
||||
board = ${common_env_data.board}
|
||||
build_type = release
|
||||
board_build.filesystem = littlefs
|
||||
|
||||
[env:gravity-perf]
|
||||
upload_speed = ${common_env_data.upload_speed}
|
||||
monitor_speed = ${common_env_data.monitor_speed}
|
||||
framework = ${common_env_data.framework}
|
||||
platform = ${common_env_data.platform}
|
||||
extra_scripts =
|
||||
script/copy_firmware.py
|
||||
script/create_versionjson.py
|
||||
build_unflags = ${common_env_data.build_unflags}
|
||||
build_flags =
|
||||
${common_env_data.build_flags}
|
||||
-D COLLECT_PERFDATA # This option will collect runtime data for a few defined methods to measure time, dumped to serial and/or influxdb
|
||||
|
@ -16,6 +16,8 @@ def after_build(source, target, env):
|
||||
target = dir + "\\bin\\firmware-debug.bin"
|
||||
if name == "gravity-release" :
|
||||
target = dir + "\\bin\\firmware.bin"
|
||||
if name == "gravity-perf" :
|
||||
target = dir + "\\bin\\firmware-perf.bin"
|
||||
print( "Copy file : " + source + " -> " + target )
|
||||
shutil.copyfile( source, target )
|
||||
|
||||
|
@ -40,7 +40,7 @@ Config::Config() {
|
||||
setTempFormat('C');
|
||||
setGravityFormat('G');
|
||||
setSleepInterval(900); // 15 minutes
|
||||
setVoltageFactor(1.59); // Conversion factor for battery
|
||||
setVoltageFactor(1.59); // Conversion factor for battery
|
||||
setTempSensorAdj(0.0);
|
||||
setGravityTempAdj(false);
|
||||
gyroCalibration = { 0, 0, 0, 0, 0 ,0 };
|
||||
@ -185,6 +185,8 @@ bool Config::loadFile() {
|
||||
setVoltageFactor( doc[ CFG_PARAM_VOLTAGEFACTOR ].as<float>() );
|
||||
if( !doc[ CFG_PARAM_GRAVITY_FORMULA ].isNull() )
|
||||
setGravityFormula( doc[ CFG_PARAM_GRAVITY_FORMULA ] );
|
||||
if( !doc[ CFG_PARAM_GRAVITY_TEMP_ADJ ].isNull() )
|
||||
setGravityTempAdj( doc[ CFG_PARAM_GRAVITY_TEMP_ADJ ].as<bool>() );
|
||||
if( !doc[ CFG_PARAM_GRAVITY_FORMAT ].isNull() ) {
|
||||
String s = doc[ CFG_PARAM_GRAVITY_FORMAT ];
|
||||
setGravityFormat( s.charAt(0) );
|
||||
@ -247,11 +249,12 @@ void Config::debug() {
|
||||
Log.verbose(F("CFG : mDNS; '%s'." CR), getMDNS() );
|
||||
Log.verbose(F("CFG : Sleep interval; %d." CR), getSleepInterval() );
|
||||
Log.verbose(F("CFG : OTA; '%s'." CR), getOtaURL() );
|
||||
Log.verbose(F("CFG : Temp; %c." CR), getTempFormat() );
|
||||
Log.verbose(F("CFG : Temp Format; %c." CR), getTempFormat() );
|
||||
Log.verbose(F("CFG : Temp Adj; %F." CR), getTempSensorAdj() );
|
||||
Log.verbose(F("CFG : VoltageFactor; %F." CR), getVoltageFactor() );
|
||||
Log.verbose(F("CFG : Gravity formula; '%s'." CR), getGravityFormula() );
|
||||
Log.verbose(F("CFG : Gravity format; '%c'." CR), getGravityFormat() );
|
||||
Log.verbose(F("CFG : Gravity temp adj; %s." CR), isGravityTempAdj()?"true":"false" );
|
||||
Log.verbose(F("CFG : Push brewfather; '%s'." CR), getBrewfatherPushUrl() );
|
||||
Log.verbose(F("CFG : Push http; '%s'." CR), getHttpPushUrl() );
|
||||
Log.verbose(F("CFG : Push http2; '%s'." CR), getHttpPushUrl2() );
|
||||
|
@ -31,6 +31,15 @@ SOFTWARE.
|
||||
SerialDebug mySerial;
|
||||
BatteryVoltage myBatteryVoltage;
|
||||
|
||||
//
|
||||
// Print the heap information.
|
||||
//
|
||||
void printHeap() {
|
||||
#if LOG_LEVEL==6
|
||||
Log.verbose(F("HELP: Heap %d kb, HeapFrag %d %%, FreeSketch %d kb." CR), ESP.getFreeHeap()/1024, ESP.getHeapFragmentation(), ESP.getFreeSketchSpace()/1024 );
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
// Enter deep sleep for the defined duration (Argument is seconds)
|
||||
//
|
||||
@ -50,9 +59,6 @@ void printBuildOptions() {
|
||||
#ifdef SKIP_SLEEPMODE
|
||||
"SKIP_SLEEP "
|
||||
#endif
|
||||
#ifdef USE_GYRO_TEMP
|
||||
"GYRO_TEMP "
|
||||
#endif
|
||||
#ifdef EMBED_HTML
|
||||
"EMBED_HTML "
|
||||
#endif
|
||||
|
@ -40,6 +40,7 @@ float reduceFloatPrecision( float f, int dec = 2 );
|
||||
// Logging via serial
|
||||
void printTimestamp(Print* _logOutput);
|
||||
void printNewline(Print* _logOutput);
|
||||
void printHeap();
|
||||
|
||||
// Classes
|
||||
class SerialDebug {
|
||||
|
@ -82,18 +82,24 @@ bool Wifi::connect( bool showPortal ) {
|
||||
int i = 0;
|
||||
|
||||
Log.notice(F("WIFI: Connecting to WIFI." CR));
|
||||
WiFi.mode(WIFI_STA);
|
||||
if( strlen(userSSID) ) {
|
||||
Log.notice(F("WIFI: Connecting to wifi using predefined settings %s." CR), userSSID);
|
||||
WiFi.begin( userSSID, userPWD );
|
||||
} else {
|
||||
WiFi.begin();
|
||||
#if LOG_LEVEL==6
|
||||
Log.debug(F("WIFI: Using SSID=%s, KEY=%s." CR), WiFi.SSID().c_str(), WiFi.psk().c_str() );
|
||||
#endif
|
||||
}
|
||||
|
||||
while( WiFi.status() != WL_CONNECTED ) {
|
||||
delay(100);
|
||||
Serial.print( "." );
|
||||
|
||||
if( i++ > 60 ) { // Try for 6 seconds.
|
||||
// if( i++ > 60 ) { // Try for 6 seconds.
|
||||
if( i++ > 200 ) { // Try for 20 seconds.
|
||||
Log.error(F("WIFI: Failed to connect to wifi, aborting." CR));
|
||||
return connectedFlag; // Return to main that we have failed to connect.
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user