Compare commits

...

6 Commits

29 changed files with 18793 additions and 188 deletions

1
Software/.gitignore vendored
View File

@ -1,3 +1,4 @@
data/
.pio
.vscode/.browse.c_cpp.db*
.vscode/c_cpp_properties.json

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
kbd{border:1px solid #333}.btn-default:focus,.btn-default:active,.btn-default.active,.open .dropdown-toggle.btn-default{background-color:#6a6a6a;border-color:#636363}.btn-default:hover{background-color:#6a6a6a}.btn-primary:hover{background-color:#404040}.btn-success:hover{background-color:#3d8b3d}.btn-info:hover{background-color:#28a1c5}.btn-danger:hover{background-color:#b52b27}.btn-warning:hover{background-color:#df8a13}.navbar-default .navbar-nav>li.active>a:hover{background-color:#222}.navbar-inverse .navbar-nav>li.active>a:hover{background-color:#444}.table{color:#fff}.table .primary,.table .info,.table .success,.table .warning,.table .danger{color:#fff}.table-hover tr:hover{cursor:pointer}.input-group-addon{color:#fff}.nav>li>a:hover{color:#fff}.pager>li>a:hover{color:#fff}a:focus{outline:0}a.list-group-item.active:hover{background-color:#4d4d4d}a.list-group-item-success,a.list-group-item-info,a.list-group-item-warning,a.list-group-item-danger,a.list-group-item-success:hover,a.list-group-item-info:hover,a.list-group-item-warning:hover,a.list-group-item-danger:hover{color:#fff}a.active.list-group-item-success,a.active.list-group-item-info,a.active.list-group-item-warning,a.active.list-group-item-danger,a.active.list-group-item-success:hover,a.active.list-group-item-info:hover,a.active.list-group-item-warning:hover,a.active.list-group-item-danger:hover{border-color:#666}a.active.list-group-item-success:hover{background-color:#3d8b3d}a.active.list-group-item-info:hover{background-color:#28a1c5}a.active.list-group-item-warning:hover{background-color:#df8a13}a.active.list-group-item-danger:hover{background-color:#b52b27}.list-group-item-success,.list-group-item-info,.list-group-item-warning,.list-group-item-danger{color:#fff}.alert-info,.alert-primary,.alert-warning,.alert-danger,.alert-success{color:#fff}.alert-info .alert-link,.alert-primary .alert-link,.alert-warning .alert-link,.alert-danger .alert-link,.alert-success .alert-link{color:#fff}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -7,6 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="static/css/bootstrap.min.css">
<link rel="stylesheet" href="static/css/custom.css">
<link rel="stylesheet" href="static/css/tweaks.css">
<script src="static/js/jquery.min.js"></script>
<script src="static/js/bootstrap.min.js"></script>
<link rel="apple-touch-icon" sizes="180x180" href="static/img/apple-touch-icon.png">
@ -17,32 +18,27 @@
<body>
<nav class="navbar navbar-expand-md navbar-default fixed-top">
<div class="navbar-header">
<a class="navbar-brand" href="#">
<img src="static/img/logo.png" width="30" height="30" class="d-inline-block align-top" alt="">
KTM CAN ChainLube
</a>
<button type="button" data-target="#navbarCollapse" data-toggle="collapse" class="navbar-toggle">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<nav class="navbar fixed-top navbar-dark bg-primary" id="navbar1">
<a class="navbar-brand" href="#">
<img src="static/img/logo.png" width="30" height="30" class="d-inline-block align-top" alt="">
KTM CAN ChainLube
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsingNavbar"
aria-controls="collapsingNavbar" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="collapsingNavbar">
<ul class="navbar-nav nav mr-auto mt-2 mt-lg-0">
<li class="nav-item"><a class="nav-link active" role="tab" data-toggle="tab" href="#tab_home">Home</a></li>
<li class="nav-item"><a class="nav-link" role="tab" data-toggle="tab" href="#tab_source">Wegstrecke</a></li>
<li class="nav-item"><a class="nav-link" role="tab" data-toggle="tab" href="#tab_lube">Schmierung</a></li>
<li class="nav-item"><a class="nav-link" role="tab" data-toggle="tab" href="#tab_maintenance">Wartung</a></li>
<li class="nav-item"><a class="nav-link" role="tab" data-toggle="tab" href="#tab_sysinfo">Systeminfo</a></li>
<li class="nav-item"><a class="nav-link" role="tab" data-toggle="tab" href="#tab_fwupdate">Update</a></li>
<!-- Collection of nav links, forms, and other content for toggling -->
<div id="navbarCollapse" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class="active"><a data-toggle="tab" href="#tab_home">Home</a></li>
<li><a data-toggle="tab" href="#tab_source">Wegstrecke</a></li>
<li><a data-toggle="tab" href="#tab_lube">Schmierung</a></li>
<li><a data-toggle="tab" href="#tab_tank">Öltank</a></li>
<li><a data-toggle="tab" href="#tab_maintenance">Wartung</a></li>
<li><a data-toggle="tab" href="#tab_sysinfo">Systeminfo</a></li>
<li><a data-toggle="tab" href="#tab_fwupdate">Update</a></li>
</ul>
</div>
</nav>
@ -51,15 +47,14 @@
<!-- Tabs Content -->
<div class="tab-content">
<!-- Div Tab Home-->
<div id="tab_home" class="tab-pane fade in active">
<div id="tab_home" class="tab-pane fade show active" role="tabpanel">
<div class="col text-center">
<div class="jumbotron">
<img src="static/img/logo.png" width="120" height="120" class="img-fluid" alt="">
<h3>KTM CAN Chain Lube</h3>
</div>
</div>
<hr />
<p>
<h4>Tankinhalt verbleibend</h4>
<div class="progress">
@ -68,9 +63,15 @@
%TANK_REMAIN_CAPACITY%&#37;
</div>
</div>
</p>
<hr />
<p>
<h4>aktueller Modus</h4>
<input class="form-control" type="text" placeholder="%SYSTEM_STATUS%" readonly>
</p>
<hr />
<div %SHOW_DTC_TABLE%>
<p>
<h4>Fehlercodes</h4>
<table class="table">
<tbody>
@ -94,74 +95,85 @@
<embed type="text/html" src="static/dtc.txt" width="100&#37;">
</div>
</div>
</p>
<hr />
</div>
</p>
</div>
<!-- Div Tab Home-->
<!-- Div Tab Source Settings-->
<div id="tab_source" class="tab-pane fade">
<div id="tab_source" class="tab-pane fade" role="tabpanel">
<h3>Erfassung Wegstrecke</h3>
<hr>
<hr />
<p>
<h4>Signalquelle</h4>
<form action="\post.htm" method="POST" class="form-horizontal">
<div class="form-group">
<label for="sourceselect" class="control-label col-xs-5">Wegstrecke Quelle</label>
<div class="col-xs-7">
<div class="form-group row">
<label for="sourceselect" class="control-label col-4">Wegstrecke Quelle</label>
<div class="col-8">
<select id="sourceselect" name="sourceselect" class="select form-control">
%SOURCE_SELECT_OPTIONS%
</select>
</div>
</div>
<div class="form-group row">
<div class="col-xs-offset-5 col-xs-7">
<div class="offset-4 col-8">
<button name="sourcesave" type="submit" class="btn btn-primary">&Uuml;bernehmen</button>
</div>
</div>
</form>
</p>
<div class="alert alert-warning">
<strong>Achtung!</strong><br>
Bei Änderung der Wegstrecken-Quelle wird der CAN-Oiler neu gestartet.
Dadurch wird die WiFi-Verbindung getrennt und muss neu aufgebaut werden.
</div>
</p>
<!-- Div Source:Impulse Settings-->
<div %SHOW_IMPULSE_SETTINGS%>
<h4>Einstellungen Impuls</h4>
<hr />
<p>
<h4>Einstellungen Impuls</h4>
<form action="\post.htm" method="POST" class="form-horizontal">
<div class="form-group">
<label for="tirewidth" class="control-label col-xs-5">Reifenbreite</label>
<div class="col-xs-7">
<div class="form-group row">
<label for="tirewidth" class="control-label col-4">Reifenbreite</label>
<div class="col-8">
<div class="input-group">
<input id="tirewidth" name="tirewidth" type="text" required="required" class="form-control"
value="%TIRE_WIDTH_MM%">
<div class="input-group-addon">mm</div>
<div class="input-group-append">
<span class="input-group-text">mm</span>
</div>
</div>
</div>
</div>
<div class="form-group">
<label for="tireratio" class="control-label col-xs-5">Höhe/Breite-Verhältniss</label>
<div class="col-xs-7">
<div class="form-group row">
<label for="tireratio" class="control-label col-4">Höhe/Breite-Verhältniss</label>
<div class="col-8">
<div class="input-group">
<input id="tireratio" name="tireratio" type="text" required="required" class="form-control"
value="%TIRE_RATIO%">
<div class="input-group-addon"></div>
<div class="input-group-append">
<span class="input-group-text">mm</span>
</div>
</div>
</div>
</div>
<div class="form-group">
<label for="tiredia" class="control-label col-xs-5">Felgendurchmesser</label>
<div class="col-xs-7">
<div class="form-group row">
<label for="tiredia" class="control-label col-4">Felgendurchmesser</label>
<div class="col-8">
<div class="input-group">
<input id="tiredia" name="tiredia" type="text" required="required" class="form-control"
value="%RIM_DIAMETER%">
<div class="input-group-addon">"</div>
<div class="input-group-append">
<span class="input-group-text">"</span>
</div>
</div>
</div>
</div>
<div class="form-group">
<label for="pulserev" class="control-label col-xs-5">Pulse pro Umdrehung</label>
<div class="col-xs-7">
<div class="form-group row">
<label for="pulserev" class="control-label col-4">Pulse pro Umdrehung</label>
<div class="col-8">
<div class="input-group">
<input id="pulserev" name="pulserev" type="text" required="required" class="form-control"
value="%PULSE_PER_REV%">
@ -170,7 +182,7 @@
</div>
</div>
<div class="form-group row">
<div class="col-xs-offset-5 col-xs-7">
<div class="offset-4 col-8">
<button name="pulsesave" type="submit" class="btn btn-primary">Speichern</button>
</div>
</div>
@ -180,19 +192,20 @@
<!-- Div Source:Impulse Settings-->
<!-- Div Source:CAN Settings-->
<div %SHOW_CAN_SETTINGS%>
<h4>Einstellungen CAN-Bus</h4>
<hr />
<p>
<h4>Einstellungen CAN-Bus</h4>
<form action="\post.htm" method="POST" class="form-horizontal">
<div class="form-group">
<label for="cansource" class="control-label col-xs-5">Model</label>
<div class="col-xs-7">
<div class="form-group row">
<label for="cansource" class="control-label col-4">Model</label>
<div class="col-8">
<select id="cansource" name="cansource" class="select form-control">
%CANSOURCE_SELECT_OPTIONS%
</select>
</div>
</div>
<div class="form-group row">
<div class="col-xs-offset-5 col-xs-7">
<div class="offset-4 col-8">
<button name="cansave" type="submit" class="btn btn-primary">Speichern</button>
</div>
</div>
@ -202,19 +215,20 @@
<!-- Div Source:CAN Settings-->
<!-- Div Source:GPS Settings-->
<div %SHOW_GPS_SETTINGS%>
<h4>Einstellungen GPS</h4>
<hr />
<p>
<h4>Einstellungen GPS</h4>
<form action="\post.htm" method="POST" class="form-horizontal">
<div class="form-group">
<label for="gpsbaud" class="control-label col-xs-5">Baudrate</label>
<div class="col-xs-7">
<div class="form-group row">
<label for="gpsbaud" class="control-label col-4">Baudrate</label>
<div class="col-8">
<select id="gpsbaud" name="gpsbaud" class="select form-control">
%GPSBAUD_SELECT_OPTIONS%
</select>
</div>
</div>
<div class="form-group row">
<div class="col-xs-offset-5 col-xs-7">
<div class="offset-4 col-8">
<button name="gpssave" type="submit" class="btn btn-primary">Speichern</button>
</div>
</div>
@ -225,50 +239,92 @@
</div>
<!-- Div Tab Source Settings-->
<!-- Div Tab Lube -->
<div id="tab_lube" class="tab-pane fade">
<div id="tab_lube" class="tab-pane fade" role="tabpanel">
<h3>Schmierung</h3>
<hr>
<hr />
<h4>Dosierung</h4>
<p>
<form action="\post.htm" method="POST" class="form-horizontal">
<div class="form-group">
<label for="lubedistancenormal" class="control-label col-xs-5">Modus:normal</label>
<div class="col-xs-7">
<form action="post.htm" method="POST" class="form-horizontal">
<div class="form-group row">
<label for="lubedistancenormal" class="control-label col-4">Modus:normal</label>
<div class="col-8">
<div class="input-group">
<input id="lubedistancenormal" name="lubedistancenormal" value="%LUBE_DISTANCE_NORMAL%" type="text"
class="form-control" required="required">
<div class="input-group-addon">m</div>
</div>
</div>
</div>
<div class="form-group">
<label for="lubedistancerain" class="control-label col-xs-5">Modus:rain</label>
<div class="col-xs-7">
<div class="input-group">
<input id="lubedistancerain" name="lubedistancerain" value="%LUBE_DISTANCE_RAIN%" type="text"
class="form-control" required="required">
<div class="input-group-addon">m</div>
<div class="input-group-append">
<span class="input-group-text">m</span>
</div>
</div>
</div>
</div>
<div class="form-group row">
<div class="col-xs-offset-5 col-xs-7">
<label for="lubedistancerain" class="control-label col-4">Modus:rain</label>
<div class="col-8">
<div class="input-group">
<input id="lubedistancerain" name="lubedistancerain" value="%LUBE_DISTANCE_RAIN%" type="text"
class="form-control" required="required">
<div class="input-group-append">
<span class="input-group-text">m</span>
</div>
</div>
</div>
</div>
<div class="form-group row">
<div class="offset-4 col-8">
<button name="oilsave" type="submit" class="btn btn-primary">Speichern</button>
</div>
</div>
</form>
</p>
<hr />
</div>
<!-- Div Tab Lube -->
<!-- Div Tab Maintenance -->
<div id="tab_maintenance" class="tab-pane fade">
<div id="tab_maintenance" class="tab-pane fade" role="tabpanel">
<h3>Wartung</h3>
<hr>
<hr />
<p>
<h4>&Ouml;lvorrat</h4>
<form action="\post.htm" method="POST" class="form-horizontal">
<div class="form-group">
<label for="tankremain_maint" class="control-label col-xs-5">Tankinhalt verbleibend</label>
<div class="col-xs-7">
<div class="form-group row">
<label for="tankcap" class="control-label col-4">Tankkapazität</label>
<div class="col-8">
<div class="input-group">
<input id="tankcap" name="tankcap" value="%TANK_CAPACITY%" type="text" class="form-control"
required="required">
<div class="input-group-append">
<span class="input-group-text">ml</span>
</div>
</div>
</div>
</div>
<div class="form-group row">
<label for="tankwarn" class="control-label col-4">Leer-Warnung</label>
<div class="col-8">
<div class="input-group">
<input id="tankwarn" name="tankwarn" value="%TANK_REMIND%" type="text" class="form-control"
required="required">
<div class="input-group-append">
<span class="input-group-text">&#37;</span>
</div>
</div>
</div>
</div>
<div class="form-group row">
<label for="pumppulse" class="control-label col-4">Menge pro Puls</label>
<div class="col-8">
<div class="input-group">
<input id="pumppulse" name="pumppulse" value="%AMOUNT_PER_DOSE%" type="text" class="form-control"
required="required">
<div class="input-group-append">
<span class="input-group-text">µl</span>
</div>
</div>
</div>
</div>
<div class="form-group row">
<label for="tankremain_maint" class="control-label col-4">Tankinhalt verbleibend</label>
<div class="col-8">
<div class="progress">
<div id="tankremain_maint" class="progress-bar" role="progressbar"
aria-valuenow="%TANK_REMAIN_CAPACITY%" aria-valuemin="0" aria-valuemax="100"
@ -279,110 +335,78 @@
</div>
</div>
<div class="form-group row">
<div class="col-xs-offset-5 col-xs-7">
<div class="offset-4 col-8 row">
<button name="oilsave" type="submit" class="btn btn-primary">Speichern</button>
<button name="resettank" type="submit" class="btn btn-primary">Tank zurücksetzen</button>
</div>
</div>
</form>
</p>
<hr>
<hr />
<p>
<h4>Entl&uuml;ftung</h4>
<form action="\post.htm" method="POST" class="form-horizontal">
<div class="form-group">
<label for="purgepulse" class="control-label col-xs-5">Entl&uuml;ftung Dosierung</label>
<div class="col-xs-7">
<div class="form-group row">
<label for="purgepulse" class="control-label col-4">Entl&uuml;ftung Dosierung</label>
<div class="col-8">
<div class="input-group">
<input id="purgepulse" name="purgepulse" value="%BLEEDING_PULSES%" type="text" class="form-control">
<div class="input-group-addon">Pulse</div>
<div class="input-group-append">
<span class="input-group-text">Pulse</span>
</div>
</div>
</div>
</div>
<div class="form-group row">
<div class="col-xs-offset-5 col-xs-7">
<div class="offset-4 col-8 row">
<button name="maintsave" type="submit" class="btn btn-primary">Speichern</button>
<button name="purgenow" type="submit" class="btn btn-primary">Entlüftung starten</button>
</div>
</div>
</form>
</p>
<hr>
<h4>EEPROM</h4>
<hr />
<h4>EEPROM formatieren</h4>
<p>
<form action="\post.htm" method="POST" class="form-horizontal">
<div class="form-group">
<div class="col-xs-offset-5 col-xs-7">
<div class="alert alert-warning">
<strong>Achtung!</strong><br>
Das Formatieren der EEPROM-Bereiche sollte nur ausgeführt werden wenn es unbedingt erforderlich ist!
Hierdurch werden alle Einstellungen zurück gesetzt bzw. alle Betriebsdaten gehen verloren.
Folgende Situationen erfordern unter anderem eine Formatierung:
- Erstinitialisierung (bei neu aufgebautem Gerät)
- Firmware-Update (nur wenn es die Release-Notes fordern)
</div>
<form action="post.htm" method="POST" class="form-horizontal">
<div class="form-group row">
<div class="offset-4 col-8">
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="reset_ee_cfg">
<input class="form-check-input" type="checkbox" name="reset_ee_pds" id="reset_ee_cfg">
<label class="form-check-label" for="reset_ee_cfg">
JA, EEPROM-Bereich "CFG" formatieren und Konfiguration zurück setzen
Bereich "CFG"
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="reset_ee_pds">
<input class="form-check-input" type="checkbox" name="reset_ee_pds" id="reset_ee_pds">
<label class="form-check-label" for="reset_ee_pds">
JA, EEPROM-Bereich "PDS" formatieren und Betriebsdaten zurück setzen
Bereich "PDS"
</label>
</div>
</div>
</div>
<div class="form-group row">
<div class="col-xs-offset-5 col-xs-7">
<div class="offset-4 col-8">
<button name="reset_ee_btn" type="submit" class="btn btn-primary">EEPROM formatieren</button>
</div>
</div>
</form>
</p>
<hr />
</div>
<!-- Div Tab Maintenance -->
<!-- Div Tank Settings-->
<div id="tab_tank" class="tab-pane fade">
<h3>Öltank</h3>
<hr>
<p>
<form action="\post.htm" method="POST" class="form-horizontal">
<div class="form-group">
<label for="tankcap" class="control-label col-xs-5">Tankkapazität</label>
<div class="col-xs-7">
<div class="input-group">
<input id="tankcap" name="tankcap" value="%TANK_CAPACITY%" type="text" class="form-control"
required="required">
<div class="input-group-addon">ml</div>
</div>
</div>
</div>
<div class="form-group">
<label for="tankwarn" class="control-label col-xs-5">Leer-Warnung</label>
<div class="col-xs-7">
<div class="input-group">
<input id="tankwarn" name="tankwarn" value="%TANK_REMIND%" type="text" class="form-control"
required="required">
<div class="input-group-addon">&#37;</div>
</div>
</div>
</div>
<div class="form-group">
<label for="pumppulse" class="control-label col-xs-5">Menge pro Puls</label>
<div class="col-xs-7">
<div class="input-group">
<input id="pumppulse" name="pumppulse" value="%AMOUNT_PER_DOSE%" type="text" class="form-control"
required="required">
<div class="input-group-addon">µl</div>
</div>
</div>
</div>
<div class="form-group row">
<div class="col-xs-offset-5 col-xs-7">
<button name="oilsave" type="submit" class="btn btn-primary">Speichern</button>
</div>
</div>
</form>
</p>
</div>
<!-- Div Tank Settings-->
<!-- Div Tab SystemInfo -->
<div id="tab_sysinfo" class="tab-pane fade">
<div id="tab_sysinfo" class="tab-pane fade" role="tabpanel">
<h3>Systeminfo</h3>
<hr>
<hr />
<h4>Einstellungen</h4>
<p>
<table class="table">
@ -491,9 +515,10 @@
</div>
<!-- Div Tab SystemInfo -->
<!-- Div Tab Firmware Update-->
<div id="tab_fwupdate" class="tab-pane fade">
<h3>Firmware Update</h3>
<hr>
<div id="tab_fwupdate" class="tab-pane fade" role="tabpanel">
<h3>Firmware</h3>
<hr />
<p>
<h4>Version-Info</h4>
<table class="table">
<tbody>
@ -506,24 +531,32 @@
<td>%FS_VERSION%</td>
</tr>
</table>
<hr>
</p>
<hr />
<p>
<h4>Firmware-Update</h4>
<form method='POST' action='/doUpdate' enctype='multipart/form-data'>
<div class="form-group">
<label for="fw-update-file" class="col-sm-2 col-form-label">Firmware-File</label>
<div class="col-xs-7">
<div class="input-group">
<input id="fw-update-file" name="fw-update-file" type="file" class="form-control-file"
required="required">
</div>
<div class="form-group row">
<div class="col-xs-offset-5 col-xs-7">
<button name="fw-update" type="submit" class="btn btn-primary">Aktualisieren</button>
</div>
</div>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text" id="inputGroupFileAddon01">Upload</span>
</div>
<div class="custom-file">
<input type="file" class="custom-file-input" id="fw-update-file" aria-describedby="inputGroupFileAddon01">
<label class="custom-file-label" for="fw-update-file">Choose file</label>
</div>
</div>
</form>
</p>
</div>
<!-- Div Tab Firmware Update-->
</div>
@ -543,6 +576,12 @@
</footer>
<!-- Footer -->
<script>
$('.navbar-nav>li>a').on('click', function () {
$('.navbar-collapse').collapse('hide');
});
</script>
</body>
</html>

View File

@ -14,7 +14,7 @@
<link rel="icon" type="image/png" sizes="32x32" href="static/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="static/img/favicon-16x16.png">
<link rel="manifest" href="static/img/site.webmanifest">
<meta http-equiv="refresh" content="3; url='/index.htm'" />
<meta http-equiv="refresh" content="3; url='index.htm'" />
</head>
<body>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,10 @@
body {
padding-top: 70px;
}
hr {
height: 2px;
border-width: 0;
color: gray;
background-color: gray
}

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 39 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 7.9 KiB

After

Width:  |  Height:  |  Size: 7.9 KiB

View File

Before

Width:  |  Height:  |  Size: 545 B

After

Width:  |  Height:  |  Size: 545 B

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

View File

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -31,17 +31,18 @@ build_flags =
-DADMIN_PASSWORD=${wifi_cred.admin_password}
-DWIFI_AP_PASSWORD=${wifi_cred.wifi_ap_password}
-DWIFI_AP_IP_GW=10,0,0,1
;-DFEATURE_ENABLE_WIFI_CLIENT
;-DFEATURE_ENABLE_REMOTE_DEBUG
;-DFEATURE_ENABLE_OLED
;-DFEATURE_ENABLE_CAN
;-DFEATURE_ENABLE_GPS
-DPCB_REV=2
-DFEATURE_ENABLE_WIFI_CLIENT
-DFEATURE_ENABLE_REMOTE_DEBUG
-DFEATURE_ENABLE_OLED
-DFEATURE_ENABLE_CAN
-DFEATURE_ENABLE_GPS
-DPCB_REV=4
-DNO_MODE_FLASH
;build_type = debug
board_build.filesystem = littlefs
extra_scripts = post:prepare_littlefs.py
monitor_filters = esp8266_exception_decoder
monitor_speed = 115200

View File

@ -0,0 +1,106 @@
# SCRIPT TO GZIP CRITICAL FILES FOR ACCELERATED WEBSERVING
# see also https://community.platformio.org/t/question-esp32-compress-files-in-data-to-gzip-before-upload-possible-to-spiffs/6274/10
import glob
import shutil
import gzip
import os
Import("env")
Import("projenv")
def gzip_file(src_path, dst_path):
with open(src_path, 'rb') as src, gzip.open(dst_path, 'wb') as dst:
for chunk in iter(lambda: src.read(4096), b""):
dst.write(chunk)
def getListOfFiles(dirName):
# create a list of file and sub directories
# names in the given directory
listOfFile = os.listdir(dirName)
allFiles = list()
# Iterate over all the entries
for entry in listOfFile:
# Create full path
fullPath = os.path.join(dirName, entry)
# If entry is a directory then get the list of files in this directory
if os.path.isdir(fullPath):
allFiles = allFiles + getListOfFiles(fullPath)
else:
allFiles.append(fullPath)
return allFiles
def remove_prefix(text, prefix):
if text.startswith(prefix):
return text[len(prefix):]
return text # or whatever
# Compress files from 'data_src/' to 'data/'
def gzip_webfiles(source, target, env):
# Filetypes to compress
filetypes_to_gzip = ['.css', '.png', '.js', '.ico']
print('\nGZIP: Starting gzip-Process for LittleFS-Image...\n')
data_src_dir_path = os.path.join(env.get('PROJECT_DIR'), 'data_src')
data_dir_path = env.get('PROJECT_DATA_DIR')
# check if data and datasrc exist. If the first exists and not the second, it renames it
if(os.path.exists(data_dir_path) and not os.path.exists(data_src_dir_path)):
print('GZIP: Directory "'+data_dir_path +
'" exists, "'+data_src_dir_path+'" is not found.')
print('GZIP: Renaming "' + data_dir_path +
'" to "' + data_src_dir_path + '"')
os.rename(data_dir_path, data_src_dir_path)
# Delete the 'data' directory
if(os.path.exists(data_dir_path)):
print('GZIP: Deleting the "data" directory ' + data_dir_path)
shutil.rmtree(data_dir_path)
# Recreate empty 'data' directory
print('GZIP: Re-creating an empty data directory ' + data_dir_path)
os.mkdir(data_dir_path)
# Determine the files to compress
files_to_copy = []
files_to_gzip = []
all_data_src = getListOfFiles(data_src_dir_path)
for file in all_data_src:
file_name, file_extension = os.path.splitext(file)
print(file_name + " has filetype " + file_extension)
if file_extension in filetypes_to_gzip:
files_to_gzip.append(file)
else:
filename_subdir = remove_prefix(file, data_src_dir_path)
files_to_copy.append(filename_subdir)
for file in files_to_copy:
print('GZIP: Copying file from: ' + data_src_dir_path + file + ' to: ' + data_dir_path + file)
os.makedirs(os.path.dirname(data_dir_path + file), exist_ok=True)
shutil.copy(data_src_dir_path + file, data_dir_path + file)
# Compress and move files
was_error = False
try:
for source_file_path in files_to_gzip:
print('GZIP: compressing... ' + source_file_path)
filename_subdir = remove_prefix(source_file_path, data_src_dir_path)
target_file_path = data_dir_path + filename_subdir
os.makedirs(os.path.dirname(target_file_path), exist_ok=True)
print('GZIP: Compressed... ' + target_file_path)
gzip_file(source_file_path, target_file_path + ".gz")
except IOError as e:
was_error = True
print('GZIP: Failed to compress file: ' + source_file_path)
# print( 'GZIP: EXCEPTION... {}'.format( e ) )
if was_error:
print('GZIP: Failure/Incomplete.\n')
else:
print('GZIP: Compressed correctly.\n')
# IMPORTANT, this needs to be added to call the routine
env.AddPreAction('$BUILD_DIR/littlefs.bin', gzip_webfiles)

View File

@ -22,7 +22,7 @@ void initWebUI()
GetFlashVersion(globals.FlashVersion, sizeof(globals.FlashVersion));
if (!strcmp(globals.FlashVersion, QUOTE(FLASH_FS_VERSION))
if (!strcmp(globals.FlashVersion, QUOTE(FLASH_FS_VERSION)))
{
MaintainDTC(DTC_FLASHFS_VERSION_ERROR, DTC_WARN, true);
}
@ -313,13 +313,13 @@ void WebserverPOST_Callback(AsyncWebServerRequest *request)
if (request->hasParam("reset_ee_pds"))
{
AsyncWebParameter *param = request->getParam("reset_ee_pds");
if (param->value() == "checked")
if (param->value() == "on")
globals.requestEEAction = globals.requestEEAction == EE_CFG_FORMAT ? EE_FORMAT_ALL : EE_PDS_FORMAT;
}
if (request->hasParam("reset_ee_cfg"))
{
AsyncWebParameter *param = request->getParam("reset_ee_cfg");
if (param->value() == "checked")
if (param->value() == "on")
globals.requestEEAction = globals.requestEEAction == EE_PDS_FORMAT ? EE_FORMAT_ALL : EE_CFG_FORMAT;
}
}
@ -343,7 +343,7 @@ void GetFlashVersion(char *buff, size_t buff_size)
if (this_file.available())
{
int bytes_read;
bytes_read = this_file.readBytesUntil('\r', buff, buff_size-1);
bytes_read = this_file.readBytesUntil('\r', buff, buff_size - 1);
buff[bytes_read] = '\0';
}
this_file.close();