#63 tilt validation

This commit is contained in:
Magnus Persson 2022-05-01 18:07:16 +02:00
parent 7ede9a6d19
commit a3cd3217ab
13 changed files with 126 additions and 57 deletions

View File

@ -105,7 +105,7 @@
<input type="text" name="id" id="id1" hidden>
<div class="row mb-3">
<label for="mdns" class="col-sm-2 col-form-label">Device name:</label>
<label for="mdns" class="col-sm-2 col-form-label">Device name</label>
<div class="col-sm-3">
<input type="text" maxlength="12" class="form-control" name="mdns" id="mdns" placeholder="gravmon" data-bs-toggle="tooltip" title="Name of the device. Will be used for identifying the device when pushing data and on the local network.">
</div>
@ -113,7 +113,7 @@
<div class="row mb-3">
<fieldset class="form-group row">
<legend class="col-form-label col-sm-2 float-sm-left pt-0">Temperature Format:</legend>
<legend class="col-form-label col-sm-2 float-sm-left pt-0">Temperature Format</legend>
<div class="col-sm-4">
<div class="form-check">
<input class="form-check-input" type="radio" name="temp-format" id="temp-format-c" value="C" checked data-bs-toggle="tooltip" title="Temperature format used with displaying data">
@ -128,7 +128,7 @@
</div>
<div class="row mb-3">
<label for="sleep-interval" class="col-sm-2 col-form-label">Interval (seconds):</label>
<label for="sleep-interval" class="col-sm-2 col-form-label">Interval (seconds)</label>
<div class="col-sm-2">
<input type="number" min="10" max="3600" class="form-control" name="sleep-interval" id="sleep-interval" placeholder="300" data-bs-toggle="tooltip" title="The number of seconds that the device will sleep between gravity readings. Recommended value is 300s">
</div>
@ -145,7 +145,7 @@
<hr class="my-2">
<div class="row mb-3">
<label for="calibrate-btn" class="col-sm-2 col-form-label">Current calibration:</label>
<label for="calibrate-btn" class="col-sm-2 col-form-label">Current calibration</label>
<label for="calibrate-btn" class="col-sm-2 col-form-label" id="gyro-calibration-data">Loading...</label>
<label for="gyro-calibration-data" class="col-sm-2 col-form-label" id="angle">Loading...</label>
<div class="col-sm-8 offset-sm-2">
@ -174,7 +174,7 @@
<input type="text" name="http-push2-h2" id="http-push2-h2" hidden>
<div class="row mb-3">
<label for="http-push" class="col-sm-2 col-form-label">HTTP 1 (POST):</label>
<label for="http-push" class="col-sm-2 col-form-label">HTTP 1 (POST)</label>
<div class="col-sm-8">
<input type="url" maxlength="120" class="form-control" name="http-push" id="http-push" placeholder="http://www.internet.com/path" data-bs-toggle="tooltip" title="URL to push target, use format http://servername.com/resource (Supports http and https)">
</div>
@ -184,7 +184,7 @@
</div>
<div class="row mb-3">
<label for="http-push2" class="col-sm-2 col-form-label">HTTP 2 (POST):</label>
<label for="http-push2" class="col-sm-2 col-form-label">HTTP 2 (POST)</label>
<div class="col-sm-8">
<input type="url" maxlength="120" class="form-control" name="http-push2" id="http-push2" placeholder="http://www.internet.com/path" data-bs-toggle="tooltip" title="URL to push target, use format http://servername.com/resource (Supports http and https)">
</div>
@ -194,21 +194,21 @@
</div>
<div class="row mb-3">
<label for="token" class="col-sm-2 col-form-label">Token:</label>
<label for="token" class="col-sm-2 col-form-label">Token</label>
<div class="col-sm-4">
<input type="text" maxlength="50" class="form-control" name="token" id="token" data-bs-toggle="tooltip" title="Token can be used in the format template as a variable, some services use this for authentication">
</div>
</div>
<div class="row mb-3">
<label for="http-push3" class="col-sm-2 col-form-label">HTTP 3 (GET):</label>
<label for="http-push3" class="col-sm-2 col-form-label">HTTP 3 (GET)</label>
<div class="col-sm-8">
<input type="url" maxlength="120" class="form-control" name="http-push3" id="http-push3" placeholder="http://www.internet.com/path" data-bs-toggle="tooltip" title="URL to push target, use format http://servername.com/resource (Supports http and https). Do not add the query string, that will be added via the format template">
</div>
</div>
<div class="row mb-3">
<label for="token2" class="col-sm-2 col-form-label">Token 2:</label>
<label for="token2" class="col-sm-2 col-form-label">Token 2</label>
<div class="col-sm-4">
<input type="text" maxlength="50" class="form-control" name="token2" id="token2" data-bs-toggle="tooltip" title="Token can be used in the format template as a variable, some services use this for authentication">
</div>
@ -246,28 +246,28 @@
<input type="text" name="section" value="collapsePush2" hidden>
<div class="row mb-3">
<label for="influxdb2-push" class="col-sm-2 col-form-label">InfluxDB v2 URL:</label>
<label for="influxdb2-push" class="col-sm-2 col-form-label">InfluxDB v2 URL</label>
<div class="col-sm-8">
<input type="url" maxlength="40" class="form-control" name="influxdb2-push" placeholder="http://www.internet.com" id="influxdb2-push" data-bs-toggle="tooltip" title="URL to push target, use format http://servername.com (Supports http and https)">
</div>
</div>
<div class="row mb-3">
<label for="influxdb2-org" class="col-sm-2 col-form-label">InfluxDB v2 Org:</label>
<label for="influxdb2-org" class="col-sm-2 col-form-label">InfluxDB v2 Org</label>
<div class="col-sm-4">
<input type="text" maxlength="50" class="form-control" name="influxdb2-org" id="influxdb2-org" data-bs-toggle="tooltip" title="Identifier to what organisation to use">
</div>
</div>
<div class="row mb-3">
<label for="influxdb2-bucket" class="col-sm-2 col-form-label">InfluxDB v2 Bucket:</label>
<label for="influxdb2-bucket" class="col-sm-2 col-form-label">InfluxDB v2 Bucket</label>
<div class="col-sm-4">
<input type="text" maxlength="50" class="form-control" name="influxdb2-bucket" id="influxdb2-bucket" data-bs-toggle="tooltip" title="Identifier for the data bucket to use">
</div>
</div>
<div class="row mb-3">
<label for="influxdb2-auth" class="col-sm-2 col-form-label">InfluxDB v2 Auth:</label>
<label for="influxdb2-auth" class="col-sm-2 col-form-label">InfluxDB v2 Auth</label>
<div class="col-sm-4">
<input type="text" maxlength="100" class="form-control" name="influxdb2-auth" id="influxdb2-auth" data-bs-toggle="tooltip" title="Authentication token for accessing data bucket">
</div>
@ -276,28 +276,28 @@
<hr class="my-2">
<div class="row mb-3">
<label for="mqtt-push" class="col-sm-2 col-form-label">MQTT Server:</label>
<label for="mqtt-push" class="col-sm-2 col-form-label">MQTT Server</label>
<div class="col-sm-4">
<input type="text" maxlength="40" class="form-control" name="mqtt-push" id="mqtt-push" placeholder="www.internet.com" data-bs-toggle="tooltip" title="Name of server to connect to, use format servername.com">
</div>
</div>
<div class="row mb-3">
<label for="mqtt-topic" class="col-sm-2 col-form-label">MQTT Port:</label>
<label for="mqtt-topic" class="col-sm-2 col-form-label">MQTT Port</label>
<div class="col-sm-4">
<input type="number" min="1" max="65535" class="form-control" name="mqtt-port" id="mqtt-port" placeholder="1883" data-bs-toggle="tooltip" title="Port number to use, 1883 is standard. Ports higher than 8000 will assume to use SSL">
</div>
</div>
<div class="row mb-3">
<label for="mqtt-user" class="col-sm-2 col-form-label">MQTT User:</label>
<label for="mqtt-user" class="col-sm-2 col-form-label">MQTT User</label>
<div class="col-sm-4">
<input type="text" maxlength="20" class="form-control" name="mqtt-user" id="mqtt-user" data-bs-toggle="tooltip" title="Username to use. Leave blank if authentication is disabled">
</div>
</div>
<div class="row mb-3">
<label for="mqtt-pass" class="col-sm-2 col-form-label">MQTT Password:</label>
<label for="mqtt-pass" class="col-sm-2 col-form-label">MQTT Password</label>
<div class="col-sm-4">
<input type="text" maxlength="20" class="form-control" name="mqtt-pass" id="mqtt-pass" data-bs-toggle="tooltip" title="Password to use. Leave blank if authentication is disabled">
</div>
@ -335,7 +335,7 @@
<div class="row mb-3">
<fieldset class="form-group row">
<legend class="col-form-label col-sm-2 float-sm-left pt-0">Gravity Format:</legend>
<label for="gravity-format" class="col-sm-2 col-form-label">Gravity Format</label>
<div class="col-sm-4">
<div class="form-check">
<input class="form-check-input" type="radio" name="gravity-format" id="gravity-format-g" value="G" checked data-bs-toggle="tooltip" title="Present gravity in SG format">
@ -357,7 +357,7 @@
</div>
<div class="row mb-3">
<div class="col-sm-4 offset-sm-2">
<div class="col-sm-3 offset-sm-2">
<div class="form-check">
<input class="form-check-input" type="checkbox" name="gravity-temp-adjustment" id="gravity-temp-adjustment" checked data-bs-toggle="tooltip" title="Adjust the calculated gravity based on the current temperature. Assumes that calibration is done using 20C / 68F">
<label class="form-check-label" for="gravity-temp-adjustment">Temperature adjust gravity</label>
@ -388,7 +388,7 @@
<input type="text" name="id" id="id4" hidden>
<div class="row mb-3">
<label for="voltage-factor" class="col-sm-2 col-form-label">Voltage factor:</label>
<label for="voltage-factor" class="col-sm-2 col-form-label">Voltage factor</label>
<div class="col-sm-2">
<input type="number" step=".01" class="form-control" name="voltage-factor" id="voltage-factor" placeholder="1.59" data-bs-toggle="tooltip" title="Factor used to calculate the battery voltage. When running on battery, the voltage should be less than 4.15V">
</div>
@ -396,7 +396,7 @@
</div>
<div class="row mb-3">
<label for="temp-adjustment-value" class="col-sm-2 col-form-label">Temp Sensor Adj:</label>
<label for="temp-adjustment-value" class="col-sm-2 col-form-label">Temp Sensor Adj</label>
<div class="col-sm-2">
<input type="number" step=".1" class="form-control" name="temp-adjustment-value" id="temp-adjustment-value" placeholder="0" data-bs-toggle="tooltip" title="This value will be added to the sensor value in case the sensor dont show the correct temperature">
</div>
@ -429,7 +429,7 @@
</div>
<div class="row mb-3">
<label for="ota-url" class="col-sm-2 col-form-label">OTA base URL:</label>
<label for="ota-url" class="col-sm-2 col-form-label">OTA base URL</label>
<div class="col-sm-8">
<input type="url" maxlength="90" class="form-control" name="ota-url" id="ota-url" placeholder="http://www.local.com/path/" data-bs-toggle="tooltip" title="Base URL to where firmware and version.json file can be found. Needs to end with '/', example: http://www.mysite.com/firmware/">
</div>
@ -459,38 +459,57 @@
<div id="collapseAdvanced" class="accordion-collapse collapse" aria-labelledby="headingAdvanced" data-bs-parent="#accordion">
<div class="accordion-body">
<div class="row mb-3">
<div class="col-sm-4">
<div class="form-check">
<input checked class="form-check-input" type="checkbox" name="adv-config" id="adv-config" data-bs-toggle="tooltip" title="Enable the advanced software settings.">
<label class="form-check-label" for="adv-config">Disable advanced software settings</label>
</div>
</div>
</div>
<form action="/api/config/advanced" method="post">
<input type="text" name="id" id="id6" hidden>
<div class="row mb-3">
<label for="gyro-read-count" class="col-sm-3 col-form-label">Gyro reads:</label>
<div class="col-sm-2">
<div class="col-sm-3">
<input disabled type="number" min="10" max="100" class="form-control" name="gyro-read-count" id="gyro-read-count" placeholder="50" checked data-bs-toggle="tooltip" title="How many times should we read the gyro to get an accurate angle. More reads = better accuracy but higher battery drain">
</div>
<div class="col-sm-5">(10-100) - default 50</div>
</div>
<div class="row mb-3">
<label for="gyro-moving-threashold" class="col-sm-3 col-form-label">Gyro moving theashold:</label>
<div class="col-sm-2">
<label for="gyro-moving-threashold" class="col-sm-3 col-form-label">Gyro moving theashold</label>
<div class="col-sm-3">
<input disabled type="number" min="50" max="1000" class="form-control" name="gyro-moving-threashold" id="gyro-moving-threashold" placeholder="500" checked data-bs-toggle="tooltip" title="How much deviation between gyro reads are acceptable in order to regard this as a valid angle">
</div>
<div class="col-sm-5">(50-1000) - default 500</div>
</div>
<div class="row mb-3">
<label for="formula-max-deviation" class="col-sm-3 col-form-label">Formula max deviation (SG):</label>
<div class="col-sm-2">
<label for="formula-max-deviation" class="col-sm-3 col-form-label">Formula max deviation (SG)</label>
<div class="col-sm-3">
<input disabled type="number" step=".1" min="1" max="10" class="form-control" name="formula-max-deviation" id="formula-max-deviation" placeholder="1.6" checked data-bs-toggle="tooltip" title="When validating the derived formula this is the maximum accepted deviation for the supplied values">
</div>
<div class="col-sm-5">(1 - 10) - default 1.6 SG</div>
</div>
<div class="row mb-3">
<div class="col-sm-3 offset-sm-3">
<div class="form-check">
<input disabled class="form-check-input" type="checkbox" class="form-control" name="ignore-low-angles" id="ignore-low-angles" data-bs-toggle="tooltip" title="When active, angles below water will be ignored. Note! Angle must be defined under calibration, first field.">
<label class="form-check-label" for="ignore-low-angles">Ignore angles below water</label>
</div>
</div>
<div class="col-sm-5" name="water-angle" id="water-angle"></div>
</div>
<hr>
<div class="row mb-3">
<label for="tempsensor-resolution" class="col-sm-3 col-form-label">DS18B20 resolution (bits):</label>
<div class="col-sm-2">
<label for="tempsensor-resolution" class="col-sm-3 col-form-label">DS18B20 resolution (bits)</label>
<div class="col-sm-3">
<input disabled type="number" min="9" max="12" class="form-control" name="tempsensor-resolution" id="tempsensor-resolution" placeholder="9" checked data-bs-toggle="tooltip" title="Resolution when reading the DS18B20 temperature sensor, higher resolution give better accuracy but takes longer">
</div>
<div class="col-sm-5">(9 - 12) - default 9 bits</div>
@ -499,16 +518,16 @@
<hr>
<div class="row mb-3">
<label for="wifi-connect-timeout" class="col-sm-3 col-form-label">Wifi connect timeout (s):</label>
<div class="col-sm-2">
<label for="wifi-connect-timeout" class="col-sm-3 col-form-label">Wifi connect timeout (s)</label>
<div class="col-sm-3">
<input disabled type="number" min="1" max="60" class="form-control" name="wifi-connect-timeout" id="wifi-connect-timeout" placeholder="20" checked data-bs-toggle="tooltip" title="Max time waiting for a wifi connection before going back to sleep">
</div>
<div class="col-sm-5">(1 - 60) - default 20 s</div>
</div>
<div class="row mb-3">
<label for="wifi-portal-timeout" class="col-sm-3 col-form-label">Wifi portal timeout (s):</label>
<div class="col-sm-2">
<label for="wifi-portal-timeout" class="col-sm-3 col-form-label">Wifi portal timeout (s)</label>
<div class="col-sm-3">
<input disabled type="number" min="10" max="240" class="form-control" name="wifi-portal-timeout" id="wifi-portal-timeout" placeholder="120" checked data-bs-toggle="tooltip" title="Max time the wifi portal is active before existing">
</div>
<div class="col-sm-5">(10 - 240) - default 120 s</div>
@ -518,39 +537,39 @@
<div class="row mb-3">
<label for="int-http1" class="col-sm-3 col-form-label">Skip interval - HTTP 1 (POST):</label>
<div class="col-sm-2">
<div class="col-sm-3">
<input disabled type="number" min="0" max="5" class="form-control" name="int-http1" id="int-http1" placeholder="0" checked data-bs-toggle="tooltip" title="Defines how many sleep cycles to skip between pushing data to this target, 1 = every second cycle">
</div>
<div class="col-sm-5">(0 - 5) - default 0</div>
</div>
<div class="row mb-3">
<label for="int-http2" class="col-sm-3 col-form-label">Skip interval - HTTP 2 (POST):</label>
<div class="col-sm-2">
<label for="int-http2" class="col-sm-3 col-form-label">Skip interval - HTTP 2 (POST)</label>
<div class="col-sm-3">
<input disabled type="number" min="0" max="5" class="form-control" name="int-http2" id="int-http2" placeholder="0" data-bs-toggle="tooltip" title="Defines how many sleep cycles to skip between pushing data to this target, 1 = every second cycle">
</div>
<div class="col-sm-5">(0 - 5) - default 0</div>
</div>
<div class="row mb-3">
<label for="int-http3" class="col-sm-3 col-form-label">Skip interval - HTTP 3 (GET):</label>
<div class="col-sm-2">
<label for="int-http3" class="col-sm-3 col-form-label">Skip interval - HTTP 3 (GET)</label>
<div class="col-sm-3">
<input disabled type="number" min="0" max="5" class="form-control" name="int-http3" id="int-http3" placeholder="0" data-bs-toggle="tooltip" title="Defines how many sleep cycles to skip between pushing data to this target, 1 = every second cycle">
</div>
<div class="col-sm-5">(0 - 5) - default 0</div>
</div>
<div class="row mb-3">
<label for="int-influx" class="col-sm-3 col-form-label">Skip interval - InfluxDB v2:</label>
<div class="col-sm-2">
<label for="int-influx" class="col-sm-3 col-form-label">Skip interval - InfluxDB v2</label>
<div class="col-sm-3">
<input disabled type="number" min="0" max="5" class="form-control" name="int-influx" id="int-influx" placeholder="0" data-bs-toggle="tooltip" title="Defines how many sleep cycles to skip between pushing data to this target, 1 = every second cycle">
</div>
<div class="col-sm-5">(0 - 5) - default 0</div>
</div>
<div class="row mb-3">
<label for="int-mqtt" class="col-sm-3 col-form-label">Skip interval - MQTT:</label>
<div class="col-sm-2">
<label for="int-mqtt" class="col-sm-3 col-form-label">Skip interval - MQTT</label>
<div class="col-sm-3">
<input disabled type="number" min="0" max="5" class="form-control" name="int-mqtt" id="int-mqtt" placeholder="0" data-bs-toggle="tooltip" title="Defines how many sleep cycles to skip between pushing data to this target, 1 = every second cycle">
</div>
<div class="col-sm-5">(0 - 5) - default 0</div>
@ -563,15 +582,6 @@
</div>
</form>
<div class="row mb-3">
<div class="col-sm-4 offset-sm-3">
<div class="form-check">
<input class="form-check-input" type="checkbox" name="adv-config" id="adv-config" checked data-bs-toggle="tooltip" title="Enabled the advanced software settings.">
<label class="form-check-label" for="adv-config">Disable advanced software settings</label>
</div>
</div>
</div>
</div>
</div>
@ -760,6 +770,7 @@
$("#int-influx").prop("disabled", b);
$("#int-mqtt").prop("disabled", b);
$("#tempsensor-resolution").prop("disabled", b);
$("#ignore-low-angles").prop("disabled", b);
}
// Get the advanced values from the API
@ -778,6 +789,7 @@
$("#wifi-portal-timeout").val(cfg["wifi-portal-timeout"]);
$("#wifi-connect-timeout").val(cfg["wifi-connect-timeout"]);
$("#tempsensor-resolution").val(cfg["tempsensor-resolution"]);
$("#ignore-low-angles").prop( "checked", cfg["ignore-low-angles"] );
$("#int-http1").val(cfg["int-http1"]);
$("#int-http2").val(cfg["int-http2"]);
$("#int-http3").val(cfg["int-http3"]);
@ -785,7 +797,7 @@
$("#int-mqtt").val(cfg["int-mqtt"]);
if ( cfg["gyro-read-count"] != 50 || cfg["gyro-moving-threashold"] != 500 || cfg["formula-max-deviation"] != 1.6 || cfg["wifi-portal-timeout"] != 120 || cfg["wifi-connect-timeout"] != 20 || cfg["tempsensor-resolution"] != 9 ||
cfg["int-http1"] != 0 || cfg["int-http2"] != 0 || cfg["int-http3"] != 0 || cfg["int-influx"] != 0 || cfg["int-mqtt"] != 0 ) {
cfg["int-http1"] != 0 || cfg["int-http2"] != 0 || cfg["int-http3"] != 0 || cfg["int-influx"] != 0 || cfg["int-mqtt"] != 0 || cfg["ignore-low-angles"] != false ) {
$("#adv-config").attr("checked", false );
}
})
@ -852,6 +864,7 @@
$("#battery").text(cfg["battery"] + " V");
$("#angle").text(cfg["angle"]);
$("#runtime-average").val(cfg["runtime-average"]);
$("#water-angle").text( "(Water angle: " + cfg["formula-calculation-data"]["a1"] + ") - default off");
//$("#gravity").text(cfg["gravity"] + " SG");
})
.fail(function () {

File diff suppressed because one or more lines are too long

View File

@ -253,8 +253,8 @@
var s = JSON.stringify(debug, null, 2);
$("#supportContent").text( s );
$('#spinner').hide();
navigator.clipboard.writeText(s);
alert("Support information copied to clipboard");
//navigator.clipboard.writeText(s);
//alert("Support information copied to clipboard");
}
});
});

File diff suppressed because one or more lines are too long

View File

@ -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;

View File

@ -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();
};

View File

@ -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");

View File

@ -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"

View File

@ -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);

View File

@ -162,6 +162,7 @@ Used for adjusting some internal constants and other advanced settings. Should b
"wifi-portal-timeout": 120,
"wifi-connect-timeout": 20,
"formula-calibration-temp": 20,
"ignore-low-angles": false,
"int-http1": 0,
"int-http2": 0,
"int-http3": 0,
@ -174,8 +175,11 @@ POST: /api/config/advanced
Same parameters as above.
Payload should be in standard format used for posting a form
Payload should be in standard format used for posting a form.
.. note::
``ignore-low-angles`` is defined as "on" or "off" when posting since this is the output values
from a checkbox, when reading data it's sent as boolean (true,false).
GET: /api/clearwifi
===================

View File

@ -10,6 +10,8 @@ v1.0.0-beta2
* Added button on indexpage to direct to github issues.
* Added button to extract important information for support requests.
* Updated docs with information from beta1.
* First point in gravity formula is now reserved for water gravity, this to allow detection of angles below water that can be filtered out.
* Added advanced setting to ignore angles that are lower than water. This is disabled by default.
v1.0.0-beta1
------------

View File

@ -6,6 +6,7 @@
"wifi-connect-timeout": 20,
"formula-calibration-temp": 20,
"tempsensor-resolution": 9,
"ignore-low-angles": false,
"push-timeout": 10,
"int-http1": 0,
"int-http2": 0,

View File

@ -35,6 +35,28 @@
"gy": -6,
"gz": 4
},
"formula-calculation-data": {
"a1": 25,
"a3": 35,
"a2": 45,
"a4": 55,
"a5": 30,
"a6": 30,
"a7": 30,
"a8": 30,
"a9": 30,
"a10": 30,
"g1": 1.000,
"g3": 1.010,
"g2": 1.025,
"g4": 1.040,
"g5": 1.005,
"g6": 1.005,
"g7": 1.005,
"g8": 1.005,
"g9": 1.005,
"g10": 1.005
},
"angle": 90.93,
"gravity": 1.105,
"battery": 0.04,