Applied pre-commit on v1.0 source
This commit is contained in:
parent
5e9e705b96
commit
390c0882d1
@ -35,7 +35,8 @@ int createFormula(RawFormulaData &fd, char *formulaBuffer,
|
|||||||
int noAngles = 0;
|
int noAngles = 0;
|
||||||
RawFormulaData fd2;
|
RawFormulaData fd2;
|
||||||
|
|
||||||
// Check how many valid values we have got and make sure we have a full series.
|
// Check how many valid values we have got and make sure we have a full
|
||||||
|
// series.
|
||||||
for (int i = 0; i < FORMULA_DATA_SIZE; i++) {
|
for (int i = 0; i < FORMULA_DATA_SIZE; i++) {
|
||||||
if (fd.a[i]) {
|
if (fd.a[i]) {
|
||||||
fd2.a[noAngles] = fd.a[i];
|
fd2.a[noAngles] = fd.a[i];
|
||||||
@ -50,7 +51,7 @@ int createFormula(RawFormulaData &fd, char *formulaBuffer,
|
|||||||
order, noAngles);
|
order, noAngles);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (noAngles <3) {
|
if (noAngles < 3) {
|
||||||
ErrorFileLog errLog;
|
ErrorFileLog errLog;
|
||||||
errLog.addEntry(F("CALC: Not enough values for deriving formula"));
|
errLog.addEntry(F("CALC: Not enough values for deriving formula"));
|
||||||
return ERR_FORMULA_NOTENOUGHVALUES;
|
return ERR_FORMULA_NOTENOUGHVALUES;
|
||||||
@ -62,7 +63,8 @@ int createFormula(RawFormulaData &fd, char *formulaBuffer,
|
|||||||
// Returned value is 0 if no error
|
// Returned value is 0 if no error
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
#if LOG_LEVEL == 6 && !defined(CALC_DISABLE_LOGGING)
|
#if LOG_LEVEL == 6 && !defined(CALC_DISABLE_LOGGING)
|
||||||
Log.verbose(F("CALC: Finshied processing data points, order = %d." CR), order);
|
Log.verbose(F("CALC: Finshied processing data points, order = %d." CR),
|
||||||
|
order);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Print the formula based on 'order'
|
// Print the formula based on 'order'
|
||||||
|
@ -479,7 +479,8 @@ bool AdvancedConfig::loadFile() {
|
|||||||
if (!doc[PARAM_HW_PUSH_INTERVAL_MQTT].isNull())
|
if (!doc[PARAM_HW_PUSH_INTERVAL_MQTT].isNull())
|
||||||
this->setPushIntervalMqtt(doc[PARAM_HW_PUSH_INTERVAL_MQTT].as<int>());
|
this->setPushIntervalMqtt(doc[PARAM_HW_PUSH_INTERVAL_MQTT].as<int>());
|
||||||
if (!doc[PARAM_HW_TEMPSENSOR_RESOLUTION].isNull())
|
if (!doc[PARAM_HW_TEMPSENSOR_RESOLUTION].isNull())
|
||||||
this->setTempSensorResolution(doc[PARAM_HW_TEMPSENSOR_RESOLUTION].as<int>());
|
this->setTempSensorResolution(
|
||||||
|
doc[PARAM_HW_TEMPSENSOR_RESOLUTION].as<int>());
|
||||||
if (!doc[PARAM_HW_IGNORE_LOW_ANGLES].isNull())
|
if (!doc[PARAM_HW_IGNORE_LOW_ANGLES].isNull())
|
||||||
setIgnoreLowAnges(doc[PARAM_HW_IGNORE_LOW_ANGLES].as<bool>());
|
setIgnoreLowAnges(doc[PARAM_HW_IGNORE_LOW_ANGLES].as<bool>());
|
||||||
|
|
||||||
|
@ -88,8 +88,7 @@ class AdvancedConfig {
|
|||||||
|
|
||||||
int getTempSensorResolution() { return _tempSensorResolution; }
|
int getTempSensorResolution() { return _tempSensorResolution; }
|
||||||
void setTempSensorResolution(int t) {
|
void setTempSensorResolution(int t) {
|
||||||
if (t>=9 && t<=12)
|
if (t >= 9 && t <= 12) _tempSensorResolution = t;
|
||||||
_tempSensorResolution = t;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float getDefaultCalibrationTemp() { return _defaultCalibrationTemp; }
|
float getDefaultCalibrationTemp() { return _defaultCalibrationTemp; }
|
||||||
@ -130,9 +129,7 @@ class AdvancedConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const bool isIgnoreLowAnges() { return _IgnoreLowAnges; }
|
const bool isIgnoreLowAnges() { return _IgnoreLowAnges; }
|
||||||
void setIgnoreLowAnges(bool b) {
|
void setIgnoreLowAnges(bool b) { _IgnoreLowAnges = b; }
|
||||||
_IgnoreLowAnges = b;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool saveFile();
|
bool saveFile();
|
||||||
bool loadFile();
|
bool loadFile();
|
||||||
|
@ -318,7 +318,9 @@ void PerfLogging::pushInflux() {
|
|||||||
if (!myConfig.isInfluxDb2Active()) return;
|
if (!myConfig.isInfluxDb2Active()) return;
|
||||||
|
|
||||||
if (myConfig.isInfluxSSL()) {
|
if (myConfig.isInfluxSSL()) {
|
||||||
Log.warning(F("PERF: InfluxDB2 with SSL is not supported when pushing performance data, skipping" CR));
|
Log.warning(
|
||||||
|
F("PERF: InfluxDB2 with SSL is not supported when pushing performance "
|
||||||
|
"data, skipping" CR));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ SOFTWARE.
|
|||||||
#include <webserver.hpp>
|
#include <webserver.hpp>
|
||||||
#include <wifi.hpp>
|
#include <wifi.hpp>
|
||||||
|
|
||||||
//#define FORCE_GRAVITY_MODE
|
// #define FORCE_GRAVITY_MODE
|
||||||
|
|
||||||
// Define constats for this program
|
// Define constats for this program
|
||||||
#ifdef DEACTIVATE_SLEEPMODE
|
#ifdef DEACTIVATE_SLEEPMODE
|
||||||
@ -275,8 +275,11 @@ bool loopReadGravity() {
|
|||||||
bool pushExpired = (abs((int32_t)(millis() - pushMillis)) >
|
bool pushExpired = (abs((int32_t)(millis() - pushMillis)) >
|
||||||
(myConfig.getSleepInterval() * 1000));
|
(myConfig.getSleepInterval() * 1000));
|
||||||
|
|
||||||
if (myAdvancedConfig.isIgnoreLowAnges() && (angle < myConfig.getFormulaData().a[0]) ) {
|
if (myAdvancedConfig.isIgnoreLowAnges() &&
|
||||||
Log.warning(F("Main: Angle is lower than water, so we regard this as faulty and dont send any data." CR));
|
(angle < myConfig.getFormulaData().a[0])) {
|
||||||
|
Log.warning(
|
||||||
|
F("Main: Angle is lower than water, so we regard this as faulty and "
|
||||||
|
"dont send any data." CR));
|
||||||
pushExpired = false;
|
pushExpired = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,9 +204,11 @@ void PushTarget::sendInfluxDb2(TemplatingEngine& engine, bool isSecure) {
|
|||||||
String auth = "Token " + String(myConfig.getInfluxDb2PushToken());
|
String auth = "Token " + String(myConfig.getInfluxDb2PushToken());
|
||||||
|
|
||||||
if (isSecure) {
|
if (isSecure) {
|
||||||
#if defined( ESP8266 )
|
#if defined(ESP8266)
|
||||||
if (runMode == RunMode::configurationMode) {
|
if (runMode == RunMode::configurationMode) {
|
||||||
Log.notice(F("PUSH: Skipping InfluxDB since SSL is enabled and we are in config mode." CR));
|
Log.notice(
|
||||||
|
F("PUSH: Skipping InfluxDB since SSL is enabled and we are in config "
|
||||||
|
"mode." CR));
|
||||||
_lastCode = -100;
|
_lastCode = -100;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -293,9 +295,11 @@ void PushTarget::sendHttpPost(TemplatingEngine& engine, bool isSecure,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (isSecure) {
|
if (isSecure) {
|
||||||
#if defined( ESP8266 )
|
#if defined(ESP8266)
|
||||||
if (runMode == RunMode::configurationMode) {
|
if (runMode == RunMode::configurationMode) {
|
||||||
Log.notice(F("PUSH: Skipping HTTP since SSL is enabled and we are in config mode." CR));
|
Log.notice(
|
||||||
|
F("PUSH: Skipping HTTP since SSL is enabled and we are in config "
|
||||||
|
"mode." CR));
|
||||||
_lastCode = -100;
|
_lastCode = -100;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -370,9 +374,11 @@ void PushTarget::sendHttpGet(TemplatingEngine& engine, bool isSecure) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (isSecure) {
|
if (isSecure) {
|
||||||
#if defined( ESP8266 )
|
#if defined(ESP8266)
|
||||||
if (runMode == RunMode::configurationMode) {
|
if (runMode == RunMode::configurationMode) {
|
||||||
Log.notice(F("PUSH: Skipping HTTP since SSL is enabled and we are in config mode." CR));
|
Log.notice(
|
||||||
|
F("PUSH: Skipping HTTP since SSL is enabled and we are in config "
|
||||||
|
"mode." CR));
|
||||||
_lastCode = -100;
|
_lastCode = -100;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -424,9 +430,11 @@ void PushTarget::sendMqtt(TemplatingEngine& engine, bool isSecure) {
|
|||||||
int port = myConfig.getMqttPort();
|
int port = myConfig.getMqttPort();
|
||||||
|
|
||||||
if (myConfig.isMqttSSL()) {
|
if (myConfig.isMqttSSL()) {
|
||||||
#if defined( ESP8266 )
|
#if defined(ESP8266)
|
||||||
if (runMode == RunMode::configurationMode) {
|
if (runMode == RunMode::configurationMode) {
|
||||||
Log.notice(F("PUSH: Skipping MQTT since SSL is enabled and we are in config mode." CR));
|
Log.notice(
|
||||||
|
F("PUSH: Skipping MQTT since SSL is enabled and we are in config "
|
||||||
|
"mode." CR));
|
||||||
_lastCode = -100;
|
_lastCode = -100;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ class PushTarget {
|
|||||||
void sendHttpPost(TemplatingEngine& engine, bool isSecure, int index);
|
void sendHttpPost(TemplatingEngine& engine, bool isSecure, int index);
|
||||||
void sendHttpGet(TemplatingEngine& engine, bool isSecure);
|
void sendHttpGet(TemplatingEngine& engine, bool isSecure);
|
||||||
void addHttpHeader(HTTPClient& http, String header);
|
void addHttpHeader(HTTPClient& http, String header);
|
||||||
void probeMaxFragement( String& serverPath );
|
void probeMaxFragement(String& serverPath);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void sendAll(float angle, float gravitySG, float corrGravitySG, float tempC,
|
void sendAll(float angle, float gravitySG, float corrGravitySG, float tempC,
|
||||||
@ -68,7 +68,7 @@ class PushTarget {
|
|||||||
|
|
||||||
class PushIntervalTracker {
|
class PushIntervalTracker {
|
||||||
private:
|
private:
|
||||||
int _counters[5] = { 0, 0, 0, 0, 0 };
|
int _counters[5] = {0, 0, 0, 0, 0};
|
||||||
void update(const int index, const int defaultValue);
|
void update(const int index, const int defaultValue);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -51,7 +51,8 @@ void TempSensor::setup() {
|
|||||||
|
|
||||||
if (mySensors.getDS18Count()) {
|
if (mySensors.getDS18Count()) {
|
||||||
#if !defined(TSEN_DISABLE_LOGGING)
|
#if !defined(TSEN_DISABLE_LOGGING)
|
||||||
Log.notice(F("TSEN: Found %d temperature sensor(s). Using %d resolution" CR),
|
Log.notice(
|
||||||
|
F("TSEN: Found %d temperature sensor(s). Using %d resolution" CR),
|
||||||
mySensors.getDS18Count(), myAdvancedConfig.getTempSensorResolution());
|
mySensors.getDS18Count(), myAdvancedConfig.getTempSensorResolution());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -695,7 +695,9 @@ void WebServerHandler::webHandleConfigAdvancedWrite() {
|
|||||||
_server->arg(PARAM_HW_TEMPSENSOR_RESOLUTION).toInt());
|
_server->arg(PARAM_HW_TEMPSENSOR_RESOLUTION).toInt());
|
||||||
if (_server->hasArg(PARAM_HW_IGNORE_LOW_ANGLES))
|
if (_server->hasArg(PARAM_HW_IGNORE_LOW_ANGLES))
|
||||||
myAdvancedConfig.setIgnoreLowAnges(
|
myAdvancedConfig.setIgnoreLowAnges(
|
||||||
_server->arg(PARAM_HW_IGNORE_LOW_ANGLES).equalsIgnoreCase("on") ? true : false);
|
_server->arg(PARAM_HW_IGNORE_LOW_ANGLES).equalsIgnoreCase("on")
|
||||||
|
? true
|
||||||
|
: false);
|
||||||
else
|
else
|
||||||
myAdvancedConfig.setIgnoreLowAnges(false);
|
myAdvancedConfig.setIgnoreLowAnges(false);
|
||||||
|
|
||||||
@ -1195,7 +1197,7 @@ bool WebServerHandler::setupWebServer() {
|
|||||||
MDNS.addService("http", "tcp", 80);
|
MDNS.addService("http", "tcp", 80);
|
||||||
|
|
||||||
// Show files in the filessytem at startup
|
// Show files in the filessytem at startup
|
||||||
#if defined( ESP8266 )
|
#if defined(ESP8266)
|
||||||
FSInfo fs;
|
FSInfo fs;
|
||||||
LittleFS.info(fs);
|
LittleFS.info(fs);
|
||||||
Log.notice(F("WEB : File system Total=%d, Used=%d." CR), fs.totalBytes,
|
Log.notice(F("WEB : File system Total=%d, Used=%d." CR), fs.totalBytes,
|
||||||
@ -1213,8 +1215,7 @@ bool WebServerHandler::setupWebServer() {
|
|||||||
File root = LittleFS.open("/");
|
File root = LittleFS.open("/");
|
||||||
File f = root.openNextFile();
|
File f = root.openNextFile();
|
||||||
while (f) {
|
while (f) {
|
||||||
Log.notice(F("WEB : File=%s, %d bytes" CR), f.name(),
|
Log.notice(F("WEB : File=%s, %d bytes" CR), f.name(), f.size());
|
||||||
f.size());
|
|
||||||
if (!f.size()) {
|
if (!f.size()) {
|
||||||
Log.notice(F("WEB : Empty file detected, removing file." CR));
|
Log.notice(F("WEB : Empty file detected, removing file." CR));
|
||||||
LittleFS.remove(f.name());
|
LittleFS.remove(f.name());
|
||||||
|
@ -31,9 +31,9 @@ SOFTWARE.
|
|||||||
#define MAX_SKETCH_SPACE 1044464
|
#define MAX_SKETCH_SPACE 1044464
|
||||||
#else // defined (ESP32)
|
#else // defined (ESP32)
|
||||||
#include <ESPmDNS.h>
|
#include <ESPmDNS.h>
|
||||||
|
#include <Update.h>
|
||||||
#include <WebServer.h>
|
#include <WebServer.h>
|
||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
#include <Update.h>
|
|
||||||
#define MAX_SKETCH_SPACE 1835008
|
#define MAX_SKETCH_SPACE 1835008
|
||||||
#endif
|
#endif
|
||||||
#include <incbin.h>
|
#include <incbin.h>
|
||||||
|
@ -285,8 +285,8 @@ bool WifiConnection::connect() {
|
|||||||
connectAsync(1);
|
connectAsync(1);
|
||||||
|
|
||||||
if (waitForConnection(timeout)) {
|
if (waitForConnection(timeout)) {
|
||||||
Log.notice(
|
Log.notice(F("WIFI: Connected to second SSID %s, making secondary "
|
||||||
F("WIFI: Connected to second SSID %s, making secondary default." CR),
|
"default." CR),
|
||||||
myConfig.getWifiSSID(1));
|
myConfig.getWifiSSID(1));
|
||||||
|
|
||||||
myConfig.swapPrimaryWifi();
|
myConfig.swapPrimaryWifi();
|
||||||
|
Loading…
Reference in New Issue
Block a user