|
|
@@ -10,7 +10,6 @@ static const char OTA_HTML[] PROGMEM = R"HTML(
|
|
|
<link rel="icon" type="image/x-icon" href="/favicon.ico">
|
|
|
<link rel="stylesheet" href="yeti-bootstrap.min.css">
|
|
|
<link rel="stylesheet" href="font-awesome.min.css">
|
|
|
-
|
|
|
<title>Modulos DSP - Firmware Update</title>
|
|
|
<style>
|
|
|
body { padding-top: 40px; }
|
|
|
@@ -21,10 +20,8 @@ static const char OTA_HTML[] PROGMEM = R"HTML(
|
|
|
</head>
|
|
|
<body>
|
|
|
<div class="container ota-card">
|
|
|
-
|
|
|
<h4 class="mb-1"><i class="fa fa-upload"></i> Firmware Update</h4>
|
|
|
<p class="text-muted small mb-3">Device: <strong>{{IP}}</strong></p>
|
|
|
-
|
|
|
<form id="otaForm" action="/ota_do" method="POST" enctype="multipart/form-data">
|
|
|
<div class="mb-3">
|
|
|
<label class="form-label fw-semibold">Firmware binary (.bin)</label>
|
|
|
@@ -35,7 +32,6 @@ static const char OTA_HTML[] PROGMEM = R"HTML(
|
|
|
<i class="fa fa-upload"></i> Flash Firmware
|
|
|
</button>
|
|
|
</form>
|
|
|
-
|
|
|
<div id="progressWrap">
|
|
|
<div class="progress" style="height:22px">
|
|
|
<div class="progress-bar progress-bar-striped progress-bar-animated bg-warning"
|
|
|
@@ -48,27 +44,21 @@ static const char OTA_HTML[] PROGMEM = R"HTML(
|
|
|
Do not power off the device.
|
|
|
</p>
|
|
|
</div>
|
|
|
-
|
|
|
<div id="resultBox" class="alert" role="alert"></div>
|
|
|
-
|
|
|
<hr class="mt-4">
|
|
|
<a href="/" class="text-muted small"><i class="fa fa-arrow-left"></i> Back to Device Management</a>
|
|
|
</div>
|
|
|
-
|
|
|
<script>
|
|
|
document.getElementById('otaForm').addEventListener('submit', function(e) {
|
|
|
e.preventDefault();
|
|
|
var file = document.getElementById('fwFile').files[0];
|
|
|
if (!file) return;
|
|
|
-
|
|
|
document.getElementById('flashBtn').disabled = true;
|
|
|
document.getElementById('progressWrap').style.display = 'block';
|
|
|
document.getElementById('resultBox').style.display = 'none';
|
|
|
-
|
|
|
var fd = new FormData(this);
|
|
|
var xhr = new XMLHttpRequest();
|
|
|
xhr.open('POST', '/ota_do', true);
|
|
|
-
|
|
|
xhr.onload = function() {
|
|
|
document.getElementById('progressWrap').style.display = 'none';
|
|
|
var box = document.getElementById('resultBox');
|
|
|
@@ -84,7 +74,6 @@ document.getElementById('otaForm').addEventListener('submit', function(e) {
|
|
|
document.getElementById('flashBtn').disabled = false;
|
|
|
}
|
|
|
};
|
|
|
-
|
|
|
xhr.onerror = function() {
|
|
|
document.getElementById('progressWrap').style.display = 'none';
|
|
|
var box = document.getElementById('resultBox');
|
|
|
@@ -93,7 +82,6 @@ document.getElementById('otaForm').addEventListener('submit', function(e) {
|
|
|
box.innerHTML = '<i class="fa fa-times-circle"></i> Upload error — check Serial log.';
|
|
|
document.getElementById('flashBtn').disabled = false;
|
|
|
};
|
|
|
-
|
|
|
xhr.send(fd);
|
|
|
});
|
|
|
</script>
|