Compare commits
6 Commits
4167a222d7
...
371e21429d
Author | SHA1 | Date | |
---|---|---|---|
371e21429d | |||
64f9e102a5 | |||
dc4dbb05ca | |||
8c0db2ffd9 | |||
c6b47fffaf | |||
1b49ed4a2e |
@ -58,8 +58,8 @@
|
|||||||
<p>
|
<p>
|
||||||
<h4>Tankinhalt verbleibend</h4>
|
<h4>Tankinhalt verbleibend</h4>
|
||||||
<div class="progress">
|
<div class="progress">
|
||||||
<div class="progress-bar" role="progressbar" aria-valuenow="%TANK_REMAIN_CAPACITY%" aria-valuemin="0"
|
<div class="progress-bar text-light" role="progressbar" aria-valuenow="%TANK_REMAIN_CAPACITY%"
|
||||||
aria-valuemax="100" style="width: %TANK_REMAIN_CAPACITY%%">
|
aria-valuemin="0" aria-valuemax="100" style="width: %TANK_REMAIN_CAPACITY%%">
|
||||||
%TANK_REMAIN_CAPACITY%%
|
%TANK_REMAIN_CAPACITY%%
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -76,10 +76,10 @@
|
|||||||
<table class="table">
|
<table class="table">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="col-md-3" scope="col">Zeitstempel</th>
|
<th class="col-6" scope="col">Zeitstempel</th>
|
||||||
<th class="col-md-3" scope="col">Fehlercode</th>
|
<th class="col-2" scope="col">Fehlercode</th>
|
||||||
<th class="col-md-3" scope="col">Schwere</th>
|
<th class="col-2" scope="col">Schwere</th>
|
||||||
<th class="col-md-3" scope="col">Aktiv</th>
|
<th class="col-2" scope="col">Aktiv</th>
|
||||||
</tr>
|
</tr>
|
||||||
%DTC_TABLE%
|
%DTC_TABLE%
|
||||||
</tbody>
|
</tbody>
|
||||||
@ -113,7 +113,7 @@
|
|||||||
Dadurch wird die WiFi-Verbindung getrennt und muss neu aufgebaut werden.
|
Dadurch wird die WiFi-Verbindung getrennt und muss neu aufgebaut werden.
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<div class="offset-4 col-8">
|
<div class="col text-center">
|
||||||
<button name="sourcesave" type="submit" class="btn btn-outline-primary">Übernehmen</button>
|
<button name="sourcesave" type="submit" class="btn btn-outline-primary">Übernehmen</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -174,12 +174,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<div class="offset-4 col-8">
|
<div class="col text-center">
|
||||||
<button name="pulsesave" type="submit" class="btn btn-outline-primary">Speichern</button>
|
<button name="pulsesave" type="submit" class="btn btn-outline-primary">Speichern</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</p>
|
</p>
|
||||||
|
<hr />
|
||||||
</div>
|
</div>
|
||||||
<!-- Div Source:Impulse Settings-->
|
<!-- Div Source:Impulse Settings-->
|
||||||
<!-- Div Source:CAN Settings-->
|
<!-- Div Source:CAN Settings-->
|
||||||
@ -197,12 +198,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<div class="offset-4 col-8">
|
<div class="col text-center">
|
||||||
<button name="cansave" type="submit" class="btn btn-outline-primary">Speichern</button>
|
<button name="cansave" type="submit" class="btn btn-outline-primary">Speichern</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</p>
|
</p>
|
||||||
|
<hr />
|
||||||
</div>
|
</div>
|
||||||
<!-- Div Source:CAN Settings-->
|
<!-- Div Source:CAN Settings-->
|
||||||
<!-- Div Source:GPS Settings-->
|
<!-- Div Source:GPS Settings-->
|
||||||
@ -220,12 +222,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<div class="offset-4 col-8">
|
<div class="col text-center">
|
||||||
<button name="gpssave" type="submit" class="btn btn-outline-primary">Speichern</button>
|
<button name="gpssave" type="submit" class="btn btn-outline-primary">Speichern</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</p>
|
</p>
|
||||||
|
<hr />
|
||||||
</div>
|
</div>
|
||||||
<!-- Div Source:GPS Settings-->
|
<!-- Div Source:GPS Settings-->
|
||||||
</div>
|
</div>
|
||||||
@ -234,8 +237,8 @@
|
|||||||
<div id="tab_lube" class="tab-pane fade" role="tabpanel">
|
<div id="tab_lube" class="tab-pane fade" role="tabpanel">
|
||||||
<h3>Schmierung</h3>
|
<h3>Schmierung</h3>
|
||||||
<hr />
|
<hr />
|
||||||
<h4>Dosierung</h4>
|
|
||||||
<p>
|
<p>
|
||||||
|
<h4>Dosierung</h4>
|
||||||
<form action="post.htm" method="POST" class="form-horizontal">
|
<form action="post.htm" method="POST" class="form-horizontal">
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label for="lubedistancenormal" class="control-label col-4">Normal (grün)</label>
|
<label for="lubedistancenormal" class="control-label col-4">Normal (grün)</label>
|
||||||
@ -262,7 +265,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<div class="offset-4 col-8">
|
<div class="col text-center">
|
||||||
<button name="oilsave" type="submit" class="btn btn-outline-primary">Speichern</button>
|
<button name="oilsave" type="submit" class="btn btn-outline-primary">Speichern</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -318,7 +321,7 @@
|
|||||||
<label for="tankremain_maint" class="control-label col-4">Tankinhalt verbleibend</label>
|
<label for="tankremain_maint" class="control-label col-4">Tankinhalt verbleibend</label>
|
||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
<div class="progress">
|
<div class="progress">
|
||||||
<div id="tankremain_maint" class="progress-bar" role="progressbar"
|
<div id="tankremain_maint" class="progress-bar text-light" role="progressbar"
|
||||||
aria-valuenow="%TANK_REMAIN_CAPACITY%" aria-valuemin="0" aria-valuemax="100"
|
aria-valuenow="%TANK_REMAIN_CAPACITY%" aria-valuemin="0" aria-valuemax="100"
|
||||||
style="width: %TANK_REMAIN_CAPACITY%%">
|
style="width: %TANK_REMAIN_CAPACITY%%">
|
||||||
%TANK_REMAIN_CAPACITY%%
|
%TANK_REMAIN_CAPACITY%%
|
||||||
@ -327,7 +330,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<div class="offset-4 col-8 row">
|
<div class="col text-center">
|
||||||
<button name="oilsave" type="submit" class="btn btn-outline-primary">Speichern</button>
|
<button name="oilsave" type="submit" class="btn btn-outline-primary">Speichern</button>
|
||||||
<button name="resettank" type="submit" class="btn btn-outline-primary ml-2">Tank zurücksetzen</button>
|
<button name="resettank" type="submit" class="btn btn-outline-primary ml-2">Tank zurücksetzen</button>
|
||||||
</div>
|
</div>
|
||||||
@ -350,7 +353,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<div class="offset-4 col-8 row">
|
<div class="col text-center">
|
||||||
<button name="maintsave" type="submit" class="btn btn-outline-primary">Speichern</button>
|
<button name="maintsave" type="submit" class="btn btn-outline-primary">Speichern</button>
|
||||||
<button name="purgenow" type="submit" class="btn btn-outline-primary ml-2">Entlüftung starten</button>
|
<button name="purgenow" type="submit" class="btn btn-outline-primary ml-2">Entlüftung starten</button>
|
||||||
</div>
|
</div>
|
||||||
@ -358,8 +361,8 @@
|
|||||||
</form>
|
</form>
|
||||||
</p>
|
</p>
|
||||||
<hr />
|
<hr />
|
||||||
<h4>EEPROM formatieren</h4>
|
|
||||||
<p>
|
<p>
|
||||||
|
<h4>EEPROM formatieren</h4>
|
||||||
<div class="alert alert-primary alert-dismissable show fade" role="alert">
|
<div class="alert alert-primary alert-dismissable show fade" role="alert">
|
||||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||||
<span aria-hidden="true">×</span>
|
<span aria-hidden="true">×</span>
|
||||||
@ -389,26 +392,37 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<div class="offset-4 col-8">
|
<div class="col text-center">
|
||||||
<button name="reset_ee_btn" type="submit" class="btn btn-outline-primary">EEPROM formatieren</button>
|
<button name="reset_ee_btn" type="submit" class="btn btn-outline-primary">EEPROM formatieren</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</p>
|
</p>
|
||||||
<hr />
|
<hr />
|
||||||
|
<p>
|
||||||
|
<h4>Gerät neustarten</h4>
|
||||||
|
<form action="post.htm" method="POST" class="form-horizontal">
|
||||||
|
<div class="form-group row">
|
||||||
|
<div class="col text-center">
|
||||||
|
<button name="reboot" type="submit" class="btn btn-outline-primary">Reboot</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</p>
|
||||||
|
<hr />
|
||||||
</div>
|
</div>
|
||||||
<!-- Div Tab Maintenance -->
|
<!-- Div Tab Maintenance -->
|
||||||
<!-- Div Tab SystemInfo -->
|
<!-- Div Tab SystemInfo -->
|
||||||
<div id="tab_sysinfo" class="tab-pane fade" role="tabpanel">
|
<div id="tab_sysinfo" class="tab-pane fade" role="tabpanel">
|
||||||
<h3>Systeminfo</h3>
|
<h3>Systeminfo</h3>
|
||||||
<hr />
|
<hr />
|
||||||
<h4>Einstellungen</h4>
|
|
||||||
<p>
|
<p>
|
||||||
|
<h4>Einstellungen</h4>
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="col-md-8" scope="col">Parameter</td>
|
<th class="col-7" scope="col">Parameter</td>
|
||||||
<th class="col-md-4" scope="col">Value</td>
|
<th class="col-5" scope="col">Value</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>DistancePerLube_Default</td>
|
<td>DistancePerLube_Default</td>
|
||||||
@ -473,13 +487,14 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</p>
|
</p>
|
||||||
<h4>Betriebsdaten</h4>
|
<hr />
|
||||||
<p>
|
<p>
|
||||||
|
<h4>Betriebsdaten</h4>
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="col-md-8" scope="col">Parameter</td>
|
<th class="col-7" scope="col">Parameter</td>
|
||||||
<th class="col-md-4" scope="col">Value</td>
|
<th class="col-5" scope="col">Value</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>writeCycleCounter</td>
|
<td>writeCycleCounter</td>
|
||||||
@ -507,6 +522,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</p>
|
</p>
|
||||||
|
<hr />
|
||||||
</div>
|
</div>
|
||||||
<!-- Div Tab SystemInfo -->
|
<!-- Div Tab SystemInfo -->
|
||||||
<!-- Div Tab Firmware Update-->
|
<!-- Div Tab Firmware Update-->
|
||||||
@ -517,6 +533,10 @@
|
|||||||
<h4>Version-Info</h4>
|
<h4>Version-Info</h4>
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<tbody>
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<th class="col-7" scope="col">Parameter</td>
|
||||||
|
<th class="col-5" scope="col">Value</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Firmware Version</td>
|
<td>Firmware Version</td>
|
||||||
<td>%SW_VERSION%</td>
|
<td>%SW_VERSION%</td>
|
||||||
@ -529,6 +549,33 @@
|
|||||||
</p>
|
</p>
|
||||||
<hr />
|
<hr />
|
||||||
<p>
|
<p>
|
||||||
|
<h4>EEPROM-Backup</h4>
|
||||||
|
<div class="form-group row">
|
||||||
|
<div class="col text-center">
|
||||||
|
<a class="btn btn-outline-primary" href="eejson" role="button" id="ee-backup-download">Download</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</p>
|
||||||
|
<hr />
|
||||||
|
<p>
|
||||||
|
<h4>EEPROM-Restore</h4>
|
||||||
|
<form method='POST' action='eeRestore' enctype='multipart/form-data'>
|
||||||
|
<div class="form-group row">
|
||||||
|
<div class="custom-file">
|
||||||
|
<input type="file" name="ee-restore-file" class="custom-file-input" id="ee-restore-file" accept=".ee.json"
|
||||||
|
required />
|
||||||
|
<label class="custom-file-label" for="ee-restore-file">EEPROM-Backup auswählen</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<div class="col text-center">
|
||||||
|
<button name="submit" type="submit" class="btn btn-outline-primary">Restore starten</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</p>
|
||||||
|
<hr />
|
||||||
|
<p>
|
||||||
<h4>Firmware-Update</h4>
|
<h4>Firmware-Update</h4>
|
||||||
<form method='POST' action='doUpdate' enctype='multipart/form-data'>
|
<form method='POST' action='doUpdate' enctype='multipart/form-data'>
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
@ -539,10 +586,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
|
<div class="col text-center">
|
||||||
<button name="submit" type="submit" class="btn btn-outline-primary">Update starten</button>
|
<button name="submit" type="submit" class="btn btn-outline-primary">Update starten</button>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</p>
|
</p>
|
||||||
|
<hr />
|
||||||
</div>
|
</div>
|
||||||
<!-- Div Tab Firmware Update-->
|
<!-- Div Tab Firmware Update-->
|
||||||
</div>
|
</div>
|
||||||
@ -575,6 +625,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<p class="dtc-desc">DTC Description</p>
|
<p class="dtc-desc">DTC Description</p>
|
||||||
|
<p class="dtc-debugval">DTC DebugVal</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Close</button>
|
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Close</button>
|
||||||
@ -606,10 +657,12 @@
|
|||||||
$('#dtcModal').on('show.bs.modal', function (event) {
|
$('#dtcModal').on('show.bs.modal', function (event) {
|
||||||
var dtctr = $(event.relatedTarget)
|
var dtctr = $(event.relatedTarget)
|
||||||
var dtc = dtctr.data('dtc')
|
var dtc = dtctr.data('dtc')
|
||||||
|
var debugval = dtctr.data('debugval')
|
||||||
var modal = $(this)
|
var modal = $(this)
|
||||||
$.getJSON('static/tt_dtc/dtc_' + dtc + '.json', function (data) {
|
$.getJSON('static/tt_dtc/dtc_' + dtc + '.json', function (data) {
|
||||||
modal.find('.modal-title').text(data.title)
|
modal.find('.modal-title').text(data.title)
|
||||||
modal.find('.dtc-desc').text(data.description)
|
modal.find('.dtc-desc').text(data.description)
|
||||||
|
modal.find('.dtc-debugval').text(debugval)
|
||||||
}).fail(function () {
|
}).fail(function () {
|
||||||
console.log("An error has occurred.");
|
console.log("An error has occurred.");
|
||||||
modal.find('.modal-title').text("Fehler")
|
modal.find('.modal-title').text("Fehler")
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
body {
|
body {
|
||||||
padding-top: 70px;
|
padding-top: 70px;
|
||||||
margin-bottom: 56px;
|
margin-bottom: 70px;
|
||||||
}
|
}
|
||||||
|
|
||||||
hr {
|
hr {
|
||||||
|
4
Software/data_src/static/tt_dtc/dtc_13.json
Normal file
4
Software/data_src/static/tt_dtc/dtc_13.json
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"title": "Config-Validierung",
|
||||||
|
"description": "Ein oder mehrer Einstellungswerte sind ausserhalb plausibler Werte. Prüfen Sie Ihre Einstellungen"
|
||||||
|
}
|
@ -1 +1 @@
|
|||||||
1.2
|
1.3
|
@ -59,3 +59,4 @@ lib_deps =
|
|||||||
robtillaart/I2C_EEPROM @ ^1.5.2
|
robtillaart/I2C_EEPROM @ ^1.5.2
|
||||||
mikalhart/TinyGPSPlus @ ^1.0.3
|
mikalhart/TinyGPSPlus @ ^1.0.3
|
||||||
me-no-dev/ESP Async WebServer @ ^1.2.3
|
me-no-dev/ESP Async WebServer @ ^1.2.3
|
||||||
|
bblanchon/ArduinoJson @ ^6.19.4
|
@ -26,9 +26,8 @@
|
|||||||
#define HOST_NAME "ChainLube_%06X" // Use printf-Formatting - Chip-ID (uin32_t) will be added
|
#define HOST_NAME "ChainLube_%06X" // Use printf-Formatting - Chip-ID (uin32_t) will be added
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SW_VERSION 1.2
|
#define SW_VERSION 1.3
|
||||||
|
#define FLASH_FS_VERSION 1.3
|
||||||
#define FLASH_FS_VERSION 1.2
|
|
||||||
|
|
||||||
#ifndef OTA_DELAY
|
#ifndef OTA_DELAY
|
||||||
#define OTA_DELAY 50 // ticks -> 10ms / tick
|
#define OTA_DELAY 50 // ticks -> 10ms / tick
|
||||||
|
@ -25,37 +25,45 @@ void EEPROM_Process()
|
|||||||
case EE_CFG_SAVE:
|
case EE_CFG_SAVE:
|
||||||
StoreConfig_EEPROM();
|
StoreConfig_EEPROM();
|
||||||
globals.requestEEAction = EE_IDLE;
|
globals.requestEEAction = EE_IDLE;
|
||||||
|
Serial.println("Stored EEPROM CFG");
|
||||||
break;
|
break;
|
||||||
case EE_CFG_LOAD:
|
case EE_CFG_LOAD:
|
||||||
GetConfig_EEPROM();
|
GetConfig_EEPROM();
|
||||||
globals.requestEEAction = EE_IDLE;
|
globals.requestEEAction = EE_IDLE;
|
||||||
|
Serial.println("Loaded EEPROM CFG");
|
||||||
break;
|
break;
|
||||||
case EE_CFG_FORMAT:
|
case EE_CFG_FORMAT:
|
||||||
FormatConfig_EEPROM();
|
FormatConfig_EEPROM();
|
||||||
globals.requestEEAction = EE_IDLE;
|
globals.requestEEAction = EE_IDLE;
|
||||||
globals.systemStatus = sysStat_Shutdown;
|
globals.systemStatus = sysStat_Shutdown;
|
||||||
|
Serial.println("Formated EEPROM CFG");
|
||||||
break;
|
break;
|
||||||
case EE_PDS_SAVE:
|
case EE_PDS_SAVE:
|
||||||
StorePersistence_EEPROM();
|
StorePersistence_EEPROM();
|
||||||
globals.requestEEAction = EE_IDLE;
|
globals.requestEEAction = EE_IDLE;
|
||||||
|
Serial.println("Stored EEPROM PDS");
|
||||||
break;
|
break;
|
||||||
case EE_PDS_LOAD:
|
case EE_PDS_LOAD:
|
||||||
GetPersistence_EEPROM();
|
GetPersistence_EEPROM();
|
||||||
globals.requestEEAction = EE_IDLE;
|
globals.requestEEAction = EE_IDLE;
|
||||||
|
Serial.println("Loaded EEPROM PDS");
|
||||||
break;
|
break;
|
||||||
case EE_PDS_FORMAT:
|
case EE_PDS_FORMAT:
|
||||||
FormatPersistence_EEPROM();
|
FormatPersistence_EEPROM();
|
||||||
globals.requestEEAction = EE_IDLE;
|
globals.requestEEAction = EE_IDLE;
|
||||||
|
Serial.println("Formated EEPROM PDS");
|
||||||
break;
|
break;
|
||||||
case EE_FORMAT_ALL:
|
case EE_FORMAT_ALL:
|
||||||
FormatConfig_EEPROM();
|
FormatConfig_EEPROM();
|
||||||
FormatPersistence_EEPROM();
|
FormatPersistence_EEPROM();
|
||||||
globals.requestEEAction = EE_IDLE;
|
globals.requestEEAction = EE_IDLE;
|
||||||
|
Serial.println("Formated EEPROM ALL");
|
||||||
break;
|
break;
|
||||||
case EE_ALL_SAVE:
|
case EE_ALL_SAVE:
|
||||||
StorePersistence_EEPROM();
|
StorePersistence_EEPROM();
|
||||||
StoreConfig_EEPROM();
|
StoreConfig_EEPROM();
|
||||||
globals.requestEEAction = EE_IDLE;
|
globals.requestEEAction = EE_IDLE;
|
||||||
|
Serial.println("Stored EEPROM ALL");
|
||||||
break;
|
break;
|
||||||
case EE_IDLE:
|
case EE_IDLE:
|
||||||
default:
|
default:
|
||||||
@ -88,6 +96,14 @@ void GetConfig_EEPROM()
|
|||||||
MaintainDTC(DTC_EEPROM_CFG_BAD, DTC_CRITICAL, true);
|
MaintainDTC(DTC_EEPROM_CFG_BAD, DTC_CRITICAL, true);
|
||||||
}
|
}
|
||||||
LubeConfig.checksum = checksum;
|
LubeConfig.checksum = checksum;
|
||||||
|
|
||||||
|
uint32_t ConfigSanityCheckResult = ConfigSanityCheck(false);
|
||||||
|
|
||||||
|
if (ConfigSanityCheckResult > 0)
|
||||||
|
{
|
||||||
|
MaintainDTC(DTC_EEPROM_CFG_SANITY, DTC_WARN, true, ConfigSanityCheckResult);
|
||||||
|
globals.requestEEAction = EE_CFG_SAVE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void StorePersistence_EEPROM()
|
void StorePersistence_EEPROM()
|
||||||
@ -231,3 +247,111 @@ boolean checkEEPROMavailable()
|
|||||||
MaintainDTC(DTC_NO_EEPROM_FOUND, DTC_CRITICAL, false);
|
MaintainDTC(DTC_NO_EEPROM_FOUND, DTC_CRITICAL, false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t ConfigSanityCheck(bool autocorrect)
|
||||||
|
{
|
||||||
|
uint32_t setting_reset_bits = 0;
|
||||||
|
|
||||||
|
if (!(LubeConfig.DistancePerLube_Default > 0) || !(LubeConfig.DistancePerLube_Default < 50000))
|
||||||
|
{
|
||||||
|
setting_reset_bits = setting_reset_bits | (1 << 0);
|
||||||
|
if (autocorrect)
|
||||||
|
LubeConfig.DistancePerLube_Default = LubeConfig_defaults.DistancePerLube_Default;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(LubeConfig.DistancePerLube_Rain > 0) || !(LubeConfig.DistancePerLube_Rain < 50000))
|
||||||
|
{
|
||||||
|
setting_reset_bits = setting_reset_bits | (1 << 1);
|
||||||
|
if (autocorrect)
|
||||||
|
LubeConfig.DistancePerLube_Rain = LubeConfig_defaults.DistancePerLube_Rain;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(LubeConfig.tankCapacity_ml > 0) || !(LubeConfig.tankCapacity_ml < 5000))
|
||||||
|
{
|
||||||
|
setting_reset_bits = setting_reset_bits | (1 << 2);
|
||||||
|
if (autocorrect)
|
||||||
|
LubeConfig.tankCapacity_ml = LubeConfig_defaults.tankCapacity_ml;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(LubeConfig.amountPerDose_µl > 0) || !(LubeConfig.amountPerDose_µl < 100))
|
||||||
|
{
|
||||||
|
setting_reset_bits = setting_reset_bits | (1 << 3);
|
||||||
|
if (autocorrect)
|
||||||
|
LubeConfig.amountPerDose_µl = LubeConfig_defaults.amountPerDose_µl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(LubeConfig.TankRemindAtPercentage >= 0) || !(LubeConfig.TankRemindAtPercentage <= 100))
|
||||||
|
{
|
||||||
|
setting_reset_bits = setting_reset_bits | (1 << 4);
|
||||||
|
if (autocorrect)
|
||||||
|
LubeConfig.TankRemindAtPercentage = LubeConfig_defaults.TankRemindAtPercentage;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(LubeConfig.PulsePerRevolution > 0) || !(LubeConfig.PulsePerRevolution < 1000))
|
||||||
|
{
|
||||||
|
setting_reset_bits = setting_reset_bits | (1 << 5);
|
||||||
|
if (autocorrect)
|
||||||
|
LubeConfig.PulsePerRevolution = LubeConfig_defaults.PulsePerRevolution;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(LubeConfig.TireWidth_mm > 0) || !(LubeConfig.TireWidth_mm < 500))
|
||||||
|
{
|
||||||
|
setting_reset_bits = setting_reset_bits | (1 << 6);
|
||||||
|
if (autocorrect)
|
||||||
|
LubeConfig.TireWidth_mm = LubeConfig_defaults.TireWidth_mm;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(LubeConfig.TireWidthHeight_Ratio > 0) || !(LubeConfig.TireWidthHeight_Ratio < 150))
|
||||||
|
{
|
||||||
|
setting_reset_bits = setting_reset_bits | (1 << 7);
|
||||||
|
if (autocorrect)
|
||||||
|
LubeConfig.TireWidthHeight_Ratio = LubeConfig_defaults.TireWidthHeight_Ratio;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(LubeConfig.RimDiameter_Inch > 0) || !(LubeConfig.RimDiameter_Inch < 30))
|
||||||
|
{
|
||||||
|
setting_reset_bits = setting_reset_bits | (1 << 8);
|
||||||
|
if (autocorrect)
|
||||||
|
LubeConfig.RimDiameter_Inch = LubeConfig_defaults.RimDiameter_Inch;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(LubeConfig.DistancePerRevolution_mm > 0) || !(LubeConfig.DistancePerRevolution_mm < 10000))
|
||||||
|
{
|
||||||
|
setting_reset_bits = setting_reset_bits | (1 << 9);
|
||||||
|
if (autocorrect)
|
||||||
|
LubeConfig.DistancePerRevolution_mm = LubeConfig_defaults.DistancePerRevolution_mm;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(LubeConfig.BleedingPulses > 0) || !(LubeConfig.BleedingPulses < 1001))
|
||||||
|
{
|
||||||
|
setting_reset_bits = setting_reset_bits | (1 << 10);
|
||||||
|
if (autocorrect)
|
||||||
|
LubeConfig.BleedingPulses = LubeConfig_defaults.BleedingPulses;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(LubeConfig.SpeedSource >= 0) || !(LubeConfig.SpeedSource < SpeedSourceString_Elements))
|
||||||
|
{
|
||||||
|
setting_reset_bits = setting_reset_bits | (1 << 11);
|
||||||
|
if (autocorrect)
|
||||||
|
LubeConfig.SpeedSource = LubeConfig_defaults.SpeedSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef FEATURE_ENABLE_GPS
|
||||||
|
if (!(LubeConfig.GPSBaudRate >= 0) || !(LubeConfig.GPSBaudRate < GPSBaudRateString_Elements))
|
||||||
|
{
|
||||||
|
setting_reset_bits = setting_reset_bits | (1 << 12);
|
||||||
|
if (autocorrect)
|
||||||
|
LubeConfig.GPSBaudRate = LubeConfig_defaults.GPSBaudRate;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef FEATURE_ENABLE_CAN
|
||||||
|
if (!(LubeConfig.CANSource >= 0) || !(LubeConfig.CANSource < CANSourceString_Elements))
|
||||||
|
{
|
||||||
|
setting_reset_bits = setting_reset_bits | (1 << 13);
|
||||||
|
if (autocorrect)
|
||||||
|
LubeConfig.CANSource = LubeConfig_defaults.CANSource;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return setting_reset_bits;
|
||||||
|
}
|
@ -116,6 +116,7 @@ void FormatPersistence_EEPROM();
|
|||||||
uint32_t Checksum_EEPROM(uint8_t const *data, size_t len);
|
uint32_t Checksum_EEPROM(uint8_t const *data, size_t len);
|
||||||
void dumpEEPROM(uint16_t memoryAddress, uint16_t length);
|
void dumpEEPROM(uint16_t memoryAddress, uint16_t length);
|
||||||
void MovePersistencePage_EEPROM(boolean reset);
|
void MovePersistencePage_EEPROM(boolean reset);
|
||||||
|
uint32_t ConfigSanityCheck(bool autocorrect = false);
|
||||||
|
|
||||||
extern LubeConfig_t LubeConfig;
|
extern LubeConfig_t LubeConfig;
|
||||||
extern persistenceData_t PersistenceData;
|
extern persistenceData_t PersistenceData;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
DTCEntry_s DTCStorage[MAX_DTC_STORAGE];
|
DTCEntry_s DTCStorage[MAX_DTC_STORAGE];
|
||||||
|
|
||||||
void MaintainDTC(DTCNums_t DTC_no, DTCSeverity_t DTC_severity, boolean active)
|
void MaintainDTC(DTCNums_t DTC_no, DTCSeverity_t DTC_severity, boolean active, uint32_t DebugValue)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < MAX_DTC_STORAGE; i++)
|
for (int i = 0; i < MAX_DTC_STORAGE; i++)
|
||||||
{
|
{
|
||||||
@ -10,10 +10,11 @@ void MaintainDTC(DTCNums_t DTC_no, DTCSeverity_t DTC_severity, boolean active)
|
|||||||
{
|
{
|
||||||
if (active && DTCStorage[i].active != DTC_ACTIVE)
|
if (active && DTCStorage[i].active != DTC_ACTIVE)
|
||||||
{
|
{
|
||||||
Serial.printf("DTC gone active: %d\n", DTC_no);
|
Serial.printf("DTC gone active: %d, DebugVal: %d\n", DTC_no, DebugValue);
|
||||||
DTCStorage[i].timestamp = millis();
|
DTCStorage[i].timestamp = millis();
|
||||||
DTCStorage[i].active = DTC_ACTIVE;
|
DTCStorage[i].active = DTC_ACTIVE;
|
||||||
DTCStorage[i].severity = DTC_severity;
|
DTCStorage[i].severity = DTC_severity;
|
||||||
|
DTCStorage[i].debugVal = DebugValue;
|
||||||
}
|
}
|
||||||
if (!active && DTCStorage[i].active == DTC_ACTIVE)
|
if (!active && DTCStorage[i].active == DTC_ACTIVE)
|
||||||
{
|
{
|
||||||
@ -32,10 +33,11 @@ void MaintainDTC(DTCNums_t DTC_no, DTCSeverity_t DTC_severity, boolean active)
|
|||||||
{
|
{
|
||||||
if (DTCStorage[i].Number == DTC_LAST_DTC)
|
if (DTCStorage[i].Number == DTC_LAST_DTC)
|
||||||
{
|
{
|
||||||
Serial.printf("new DTC registered: %d\n", DTC_no);
|
Serial.printf("new DTC registered: %d, DebugVal: %d\n", DTC_no, DebugValue);
|
||||||
DTCStorage[i].Number = DTC_no;
|
DTCStorage[i].Number = DTC_no;
|
||||||
DTCStorage[i].timestamp = millis();
|
DTCStorage[i].timestamp = millis();
|
||||||
DTCStorage[i].active = DTC_ACTIVE;
|
DTCStorage[i].active = DTC_ACTIVE;
|
||||||
|
DTCStorage[i].debugVal = DebugValue;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ typedef enum DTCNums_e
|
|||||||
DTC_CAN_TRANSCEIVER_FAILED,
|
DTC_CAN_TRANSCEIVER_FAILED,
|
||||||
DTC_NO_CAN_SIGNAL,
|
DTC_NO_CAN_SIGNAL,
|
||||||
#endif
|
#endif
|
||||||
|
DTC_EEPROM_CFG_SANITY,
|
||||||
DTC_LAST_DTC
|
DTC_LAST_DTC
|
||||||
} DTCNums_t;
|
} DTCNums_t;
|
||||||
|
|
||||||
@ -46,9 +47,10 @@ typedef struct DTCEntry_s
|
|||||||
uint32_t timestamp;
|
uint32_t timestamp;
|
||||||
DTCActive_t active;
|
DTCActive_t active;
|
||||||
DTCSeverity_t severity;
|
DTCSeverity_t severity;
|
||||||
|
uint32_t debugVal;
|
||||||
} DTCEntry_t;
|
} DTCEntry_t;
|
||||||
|
|
||||||
void MaintainDTC(DTCNums_t DTC_no, DTCSeverity_t DTC_severity, boolean active);
|
void MaintainDTC(DTCNums_t DTC_no, DTCSeverity_t DTC_severity, boolean active, uint32_t DebugValue = 0);
|
||||||
void ClearDTC(DTCNums_t DTC_no);
|
void ClearDTC(DTCNums_t DTC_no);
|
||||||
void ClearAllDTC();
|
void ClearAllDTC();
|
||||||
DTCNums_t getlastDTC(boolean only_active);
|
DTCNums_t getlastDTC(boolean only_active);
|
||||||
|
@ -9,6 +9,8 @@ void WebserverPOST_Callback(AsyncWebServerRequest *request);
|
|||||||
void WebserverNotFound_Callback(AsyncWebServerRequest *request);
|
void WebserverNotFound_Callback(AsyncWebServerRequest *request);
|
||||||
void Webserver_Callback(AsyncWebServerRequest *request);
|
void Webserver_Callback(AsyncWebServerRequest *request);
|
||||||
void WebserverFirmwareUpdate_Callback(AsyncWebServerRequest *request, const String &filename, size_t index, uint8_t *data, size_t len, bool final);
|
void WebserverFirmwareUpdate_Callback(AsyncWebServerRequest *request, const String &filename, size_t index, uint8_t *data, size_t len, bool final);
|
||||||
|
void WebserverEERestore_Callback(AsyncWebServerRequest *request, const String &filename, size_t index, uint8_t *data, size_t len, bool final);
|
||||||
|
void WebServerEEJSON_Callback(AsyncWebServerRequest *request);
|
||||||
void GetFlashVersion(char *buff, size_t buff_size);
|
void GetFlashVersion(char *buff, size_t buff_size);
|
||||||
|
|
||||||
void initWebUI()
|
void initWebUI()
|
||||||
@ -37,8 +39,11 @@ void initWebUI()
|
|||||||
webServer.onNotFound(WebserverNotFound_Callback);
|
webServer.onNotFound(WebserverNotFound_Callback);
|
||||||
webServer.on("/index.htm", HTTP_GET, Webserver_Callback);
|
webServer.on("/index.htm", HTTP_GET, Webserver_Callback);
|
||||||
webServer.on("/post.htm", HTTP_POST, WebserverPOST_Callback);
|
webServer.on("/post.htm", HTTP_POST, WebserverPOST_Callback);
|
||||||
|
webServer.on("/eejson", HTTP_GET, WebServerEEJSON_Callback);
|
||||||
webServer.on(
|
webServer.on(
|
||||||
"/doUpdate", HTTP_POST, [](AsyncWebServerRequest *request) {}, WebserverFirmwareUpdate_Callback);
|
"/doUpdate", HTTP_POST, [](AsyncWebServerRequest *request) {}, WebserverFirmwareUpdate_Callback);
|
||||||
|
webServer.on(
|
||||||
|
"/eeRestore", HTTP_POST, [](AsyncWebServerRequest *request) {}, WebserverEERestore_Callback);
|
||||||
|
|
||||||
webServer.begin();
|
webServer.begin();
|
||||||
}
|
}
|
||||||
@ -140,7 +145,8 @@ String processor(const String &var)
|
|||||||
DTCStorage[i].timestamp / 1000 % 60, // Seconds
|
DTCStorage[i].timestamp / 1000 % 60, // Seconds
|
||||||
DTCStorage[i].timestamp % 1000); // milliseconds
|
DTCStorage[i].timestamp % 1000); // milliseconds
|
||||||
|
|
||||||
temp = temp + "<tr data-dtc=" + String(DTCStorage[i].Number) + "><td>" + String(buff_timestamp);
|
temp = temp + "<tr data-dtc=" + String(DTCStorage[i].Number);
|
||||||
|
temp = temp + " data-debugval=" + String(DTCStorage[i].debugVal) + "><td>" + String(buff_timestamp);
|
||||||
temp = temp + "</td><td>" + String(DTCStorage[i].Number) + "</td><td>";
|
temp = temp + "</td><td>" + String(DTCStorage[i].Number) + "</td><td>";
|
||||||
temp = temp + "<img src=static/img/";
|
temp = temp + "<img src=static/img/";
|
||||||
switch (DTCStorage[i].severity)
|
switch (DTCStorage[i].severity)
|
||||||
@ -326,6 +332,10 @@ void WebserverPOST_Callback(AsyncWebServerRequest *request)
|
|||||||
globals.systemStatus = sysStat_Purge;
|
globals.systemStatus = sysStat_Purge;
|
||||||
globals.purgePulses = LubeConfig.BleedingPulses;
|
globals.purgePulses = LubeConfig.BleedingPulses;
|
||||||
}
|
}
|
||||||
|
if(p->name() == "reboot")
|
||||||
|
{
|
||||||
|
globals.systemStatus = sysStat_Shutdown;
|
||||||
|
}
|
||||||
// end: POST Form Maintenance
|
// end: POST Form Maintenance
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -394,3 +404,100 @@ void WebserverFirmwareUpdate_Callback(AsyncWebServerRequest *request, const Stri
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WebserverEERestore_Callback(AsyncWebServerRequest *request, const String &filename, size_t index, uint8_t *data, size_t len, bool final)
|
||||||
|
{
|
||||||
|
|
||||||
|
bool ee_done = false;
|
||||||
|
bool validext = false;
|
||||||
|
|
||||||
|
if (!index)
|
||||||
|
{
|
||||||
|
Serial.println("EEPROM restore");
|
||||||
|
size_t content_len = request->contentLength();
|
||||||
|
validext = (filename.indexOf(".ee.json") > -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (validext)
|
||||||
|
{
|
||||||
|
Serial.println("Restoring EEPROM-Stuff");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (final)
|
||||||
|
{
|
||||||
|
AsyncWebServerResponse *response = request->beginResponse(302, "text/plain", "Please wait while the device reboots");
|
||||||
|
response->addHeader("Refresh", "20");
|
||||||
|
response->addHeader("Location", "/");
|
||||||
|
request->send(response);
|
||||||
|
if (ee_done)
|
||||||
|
{
|
||||||
|
Serial.println("Update complete");
|
||||||
|
Serial.flush();
|
||||||
|
globals.systemStatus = sysStat_Shutdown;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void WebServerEEJSON_Callback(AsyncWebServerRequest *request)
|
||||||
|
{
|
||||||
|
AsyncResponseStream *response = request->beginResponseStream("application/json");
|
||||||
|
DynamicJsonDocument json(1024);
|
||||||
|
JsonObject fwinfo = json.createNestedObject("info");
|
||||||
|
|
||||||
|
char buffer[16];
|
||||||
|
|
||||||
|
fwinfo["DeviceName"] = globals.DeviceName;
|
||||||
|
fwinfo["FW-Version"] = QUOTE(SW_VERSION);
|
||||||
|
fwinfo["FS-Version"] = globals.FlashVersion;
|
||||||
|
|
||||||
|
JsonObject config = json.createNestedObject("config");
|
||||||
|
|
||||||
|
config["EEPROM_Version"] = LubeConfig.EEPROM_Version;
|
||||||
|
config["DistancePerLube_Default"] = LubeConfig.DistancePerLube_Default;
|
||||||
|
config["DistancePerLube_Rain"] = LubeConfig.DistancePerLube_Rain;
|
||||||
|
config["tankCapacity_ml"] = LubeConfig.tankCapacity_ml;
|
||||||
|
config["amountPerDose_µl"] = LubeConfig.amountPerDose_µl;
|
||||||
|
config["TankRemindAtPercentage"] = LubeConfig.TankRemindAtPercentage;
|
||||||
|
config["PulsePerRevolution"] = LubeConfig.PulsePerRevolution;
|
||||||
|
config["TireWidth_mm"] = LubeConfig.TireWidth_mm;
|
||||||
|
config["TireWidthHeight_Ratio"] = LubeConfig.TireWidthHeight_Ratio;
|
||||||
|
config["RimDiameter_Inch"] = LubeConfig.RimDiameter_Inch;
|
||||||
|
config["DistancePerRevolution_mm"] = LubeConfig.DistancePerRevolution_mm;
|
||||||
|
config["BleedingPulses"] = LubeConfig.BleedingPulses;
|
||||||
|
config["SpeedSource"] = LubeConfig.SpeedSource;
|
||||||
|
config["SpeedSource_Str"] = SpeedSourceString[LubeConfig.SpeedSource];
|
||||||
|
#ifdef FEATURE_ENABLE_GPS
|
||||||
|
config["GPSBaudRate"] = LubeConfig.GPSBaudRate;
|
||||||
|
config["GPSBaudRate_Str"] = GPSBaudRateString[LubeConfig.GPSBaudRate];
|
||||||
|
#endif
|
||||||
|
#ifdef FEATURE_ENABLE_CAN
|
||||||
|
config["CANSource"] = LubeConfig.CANSource;
|
||||||
|
config["CANSource_Str"] = CANSourceString[LubeConfig.CANSource];
|
||||||
|
#endif
|
||||||
|
sprintf(buffer, "0x%08X", LubeConfig.checksum);
|
||||||
|
config["checksum"] = buffer;
|
||||||
|
|
||||||
|
JsonObject eepart = json.createNestedObject("eepart");
|
||||||
|
|
||||||
|
sprintf(buffer, "0x%04X", globals.eePersistanceAdress);
|
||||||
|
eepart["PersistanceAddress"] = buffer;
|
||||||
|
|
||||||
|
JsonObject persis = json.createNestedObject("persis");
|
||||||
|
|
||||||
|
persis["writeCycleCounter"] = PersistenceData.writeCycleCounter;
|
||||||
|
persis["tankRemain_µl"] = PersistenceData.tankRemain_µl;
|
||||||
|
persis["TravelDistance_highRes_mm"] = PersistenceData.TravelDistance_highRes_mm;
|
||||||
|
persis["odometer_mm"] = PersistenceData.odometer_mm;
|
||||||
|
persis["odometer"] = PersistenceData.odometer;
|
||||||
|
sprintf(buffer, "0x%08X", PersistenceData.checksum);
|
||||||
|
persis["checksum"] = buffer;
|
||||||
|
|
||||||
|
serializeJsonPretty(json, *response);
|
||||||
|
|
||||||
|
response->addHeader("Content-disposition", "attachment; filename=backup.ee.json");
|
||||||
|
|
||||||
|
request->send(response);
|
||||||
|
}
|
@ -8,6 +8,8 @@
|
|||||||
#include <ESPAsyncWebServer.h>
|
#include <ESPAsyncWebServer.h>
|
||||||
#include <Updater.h>
|
#include <Updater.h>
|
||||||
#include <ESP8266mDNS.h>
|
#include <ESP8266mDNS.h>
|
||||||
|
#include <AsyncJson.h>
|
||||||
|
#include <ArduinoJson.h>
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user