#63 tilt validation
This commit is contained in:
@ -391,6 +391,7 @@ bool AdvancedConfig::saveFile() {
|
||||
doc[PARAM_HW_PUSH_INTERVAL_INFLUX] = this->getPushIntervalInflux();
|
||||
doc[PARAM_HW_PUSH_INTERVAL_MQTT] = this->getPushIntervalMqtt();
|
||||
doc[PARAM_HW_TEMPSENSOR_RESOLUTION] = this->getTempSensorResolution();
|
||||
doc[PARAM_HW_IGNORE_LOW_ANGLES] = this->isIgnoreLowAnges();
|
||||
|
||||
#if LOG_LEVEL == 6 && !defined(DISABLE_LOGGING)
|
||||
serializeJson(doc, Serial);
|
||||
@ -479,6 +480,8 @@ bool AdvancedConfig::loadFile() {
|
||||
this->setPushIntervalMqtt(doc[PARAM_HW_PUSH_INTERVAL_MQTT].as<int>());
|
||||
if (!doc[PARAM_HW_TEMPSENSOR_RESOLUTION].isNull())
|
||||
this->setTempSensorResolution(doc[PARAM_HW_TEMPSENSOR_RESOLUTION].as<int>());
|
||||
if (!doc[PARAM_HW_IGNORE_LOW_ANGLES].isNull())
|
||||
setIgnoreLowAnges(doc[PARAM_HW_IGNORE_LOW_ANGLES].as<bool>());
|
||||
|
||||
Log.notice(F("CFG : Configuration file " CFG_HW_FILENAME " loaded." CR));
|
||||
return true;
|
||||
|
@ -70,6 +70,7 @@ class AdvancedConfig {
|
||||
int _pushIntervalHttp3 = 0;
|
||||
int _pushIntervalInflux = 0;
|
||||
int _pushIntervalMqtt = 0;
|
||||
bool _IgnoreLowAnges = false;
|
||||
|
||||
public:
|
||||
int getWifiPortalTimeout() { return _wifiPortalTimeout; }
|
||||
@ -128,6 +129,11 @@ class AdvancedConfig {
|
||||
: true;
|
||||
}
|
||||
|
||||
const bool isIgnoreLowAnges() { return _IgnoreLowAnges; }
|
||||
void setIgnoreLowAnges(bool b) {
|
||||
_IgnoreLowAnges = b;
|
||||
}
|
||||
|
||||
bool saveFile();
|
||||
bool loadFile();
|
||||
};
|
||||
|
@ -275,6 +275,11 @@ bool loopReadGravity() {
|
||||
bool pushExpired = (abs((int32_t)(millis() - pushMillis)) >
|
||||
(myConfig.getSleepInterval() * 1000));
|
||||
|
||||
if (myAdvancedConfig.isIgnoreLowAnges() && (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;
|
||||
}
|
||||
|
||||
if (pushExpired || runMode == RunMode::gravityMode) {
|
||||
pushMillis = millis();
|
||||
LOG_PERF_START("loop-push");
|
||||
|
@ -90,6 +90,7 @@ SOFTWARE.
|
||||
#define PARAM_HW_PUSH_INTERVAL_HTTP3 "int-http3"
|
||||
#define PARAM_HW_PUSH_INTERVAL_INFLUX "int-influx"
|
||||
#define PARAM_HW_PUSH_INTERVAL_MQTT "int-mqtt"
|
||||
#define PARAM_HW_IGNORE_LOW_ANGLES "ignore-low-angles"
|
||||
#define PARAM_FORMAT_HTTP1 "http-1"
|
||||
#define PARAM_FORMAT_HTTP2 "http-2"
|
||||
#define PARAM_FORMAT_HTTP3 "http-3"
|
||||
|
@ -576,6 +576,9 @@ void WebServerHandler::webHandleConfigGravity() {
|
||||
myConfig.setGravityTempAdj(
|
||||
_server->arg(PARAM_GRAVITY_TEMP_ADJ).equalsIgnoreCase("on") ? true
|
||||
: false);
|
||||
else
|
||||
myConfig.setGravityTempAdj(false);
|
||||
|
||||
myConfig.saveFile();
|
||||
_server->sendHeader("Location", "/config.htm#collapseGravity", true);
|
||||
_server->send(302, "text/plain", "Gravity config updated");
|
||||
@ -619,6 +622,9 @@ void WebServerHandler::webHandleConfigHardware() {
|
||||
if (_server->hasArg(PARAM_GYRO_TEMP))
|
||||
myConfig.setGyroTemp(
|
||||
_server->arg(PARAM_GYRO_TEMP).equalsIgnoreCase("on") ? true : false);
|
||||
else
|
||||
myConfig.setGyroTemp(false);
|
||||
|
||||
myConfig.saveFile();
|
||||
_server->sendHeader("Location", "/config.htm#collapseHardware", true);
|
||||
_server->send(302, "text/plain", "Hardware config updated");
|
||||
@ -687,6 +693,11 @@ void WebServerHandler::webHandleConfigAdvancedWrite() {
|
||||
if (_server->hasArg(PARAM_HW_TEMPSENSOR_RESOLUTION))
|
||||
myAdvancedConfig.setTempSensorResolution(
|
||||
_server->arg(PARAM_HW_TEMPSENSOR_RESOLUTION).toInt());
|
||||
if (_server->hasArg(PARAM_HW_IGNORE_LOW_ANGLES))
|
||||
myAdvancedConfig.setIgnoreLowAnges(
|
||||
_server->arg(PARAM_HW_IGNORE_LOW_ANGLES).equalsIgnoreCase("on") ? true : false);
|
||||
else
|
||||
myAdvancedConfig.setIgnoreLowAnges(false);
|
||||
|
||||
myAdvancedConfig.saveFile();
|
||||
_server->sendHeader("Location", "/config.htm#collapseAdvanced", true);
|
||||
@ -721,6 +732,7 @@ void WebServerHandler::webHandleConfigAdvancedRead() {
|
||||
doc[PARAM_HW_PUSH_INTERVAL_MQTT] = myAdvancedConfig.getPushIntervalMqtt();
|
||||
doc[PARAM_HW_TEMPSENSOR_RESOLUTION] =
|
||||
myAdvancedConfig.getTempSensorResolution();
|
||||
doc[PARAM_HW_IGNORE_LOW_ANGLES] = myAdvancedConfig.isIgnoreLowAnges();
|
||||
|
||||
#if LOG_LEVEL == 6 && !defined(WEB_DISABLE_LOGGING)
|
||||
serializeJson(doc, Serial);
|
||||
|
Reference in New Issue
Block a user