Added updating shit
All checks were successful
Test compiling project / test (push) Successful in 2m32s
All checks were successful
Test compiling project / test (push) Successful in 2m32s
This commit is contained in:
@@ -32,7 +32,6 @@ function fetchTelemetryData() {
|
||||
|
||||
function fetchWaterData(gauge) {
|
||||
const apiUrl = '/water_data';
|
||||
console.log("FD");
|
||||
// Fetching data from the API
|
||||
fetch(apiUrl)
|
||||
.then(response => response.json())
|
||||
@@ -44,6 +43,25 @@ function fetchWaterData(gauge) {
|
||||
})
|
||||
.catch(error => {
|
||||
console.error("There was an error fetching data from the API", error);
|
||||
});
|
||||
}
|
||||
|
||||
function fetchUpdateData(gauge) {
|
||||
const apiUrl = '/ota_udpate_status';
|
||||
// Fetching data from the API
|
||||
fetch(apiUrl)
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
document.getElementById('current_fw').textContent = data.current_version || 'N/A';
|
||||
document.getElementById('server_fw').textContent = data.new_version || 'N/A';
|
||||
if (data.update_available == "true") {
|
||||
document.getElementById("update_button").style.visibility = 'visible';
|
||||
} else {
|
||||
document.getElementById("update_button").style.visibility = 'hidden';
|
||||
};
|
||||
})
|
||||
.catch(error => {
|
||||
console.error("There was an error fetching data from the API for OTA Data", error);
|
||||
});
|
||||
|
||||
}
|
||||
@@ -112,10 +130,12 @@ window.addEventListener('DOMContentLoaded', (event) => {
|
||||
fetchTelemetryData();
|
||||
fetchElectricData();
|
||||
fetchConnectionData();
|
||||
fetchUpdateData();
|
||||
setInterval(function(){fetchWaterData(gauge);}, 5000);
|
||||
setInterval(fetchTelemetryData, 5000);
|
||||
setInterval(fetchElectricData, 5000);
|
||||
setInterval(fetchConnectionData, 5000);
|
||||
setInterval(fetchUpdateData, 5000);
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -68,6 +68,28 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!--Update card-->
|
||||
<div class="card">
|
||||
<header>
|
||||
<h4>Update Status</h4>
|
||||
</header>
|
||||
<table class="tg">
|
||||
<thead></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Current Version: </td>
|
||||
<td id="current_fw">WAITING</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Newest Version: </td>
|
||||
<td id="server_fw">WAITING</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a class="button outline" href="/run_ota_update" id="update_button">UPDATE NOW</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#define water_level_min_key "water_level_min"
|
||||
#define water_level_max_key "water_level_max"
|
||||
#define water_volume_key "water_volume"
|
||||
#define current_software_version Version{0, 0, 14}
|
||||
#define current_software_version Version{0, 0, 15}
|
||||
#define REQUIRED_SPIFFS_VERSION Version{2, 0, 0}
|
||||
|
||||
#define RESISTOR_VALUE 4
|
||||
Reference in New Issue
Block a user