Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7b324f8ab8 | ||
|
|
ad0f83ce71 | ||
|
|
928c1a1d4e | ||
|
|
24cb96e9a9 | ||
|
|
e2f765de8a |
@@ -1,5 +1,28 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"version": "1.4.6",
|
||||
"date": "2026-03-17",
|
||||
"changes": {
|
||||
"features": [
|
||||
"Page Admin: comparaison RTC vs heure du navigateur (au lieu de system time)",
|
||||
"Page Admin: ajout champ Browser time (UTC) dans l'onglet Clock",
|
||||
"Page Admin: bloquer update firmware en mode hotspot avec message explicatif",
|
||||
"Page Admin: liens Gitea pour mise a jour hors-ligne (releases + main.zip)"
|
||||
],
|
||||
"improvements": [
|
||||
"Page Admin: RTC time mis en evidence (label bold, input large, bordure bleue)",
|
||||
"Page Admin: System time replie dans un details/summary (non utilise par le capteur)",
|
||||
"Page Admin: descriptions ajoutees pour System time, RTC time et Synchroniser le RTC"
|
||||
],
|
||||
"fixes": [
|
||||
"Fix forget_wifi scan: delai 5s + rescan explicite pour remplir wifi_list.csv",
|
||||
"Fix blocage navigateur: revert optimisations fetch qui saturaient la limite 6 connexions/domaine"
|
||||
],
|
||||
"compatibility": []
|
||||
},
|
||||
"notes": "L'onglet Clock compare maintenant le RTC a l'heure du navigateur, plus fiable que le system time Linux (non utilise par le capteur). L'update firmware est bloque en mode hotspot avec un message explicatif. La mise a jour hors-ligne via upload .zip reste disponible."
|
||||
},
|
||||
{
|
||||
"version": "1.4.5",
|
||||
"date": "2026-03-17",
|
||||
|
||||
@@ -211,24 +211,38 @@
|
||||
<h3 class="mt-4">Clock</h3>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="sys_local_time" class="form-label">System time (local)</label>
|
||||
<input type="text" class="form-control" id="sys_local_time" disabled>
|
||||
<label for="RTC_utc_time" class="form-label fw-bold fs-5">RTC time (UTC)</label>
|
||||
<input type="text" class="form-control form-control-lg border-primary" id="RTC_utc_time" disabled>
|
||||
<small class="text-muted">Module DS3231 avec pile de sauvegarde. Garde l'heure meme hors tension. Horloge de reference du capteur.</small>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="sys_UTC_time" class="form-label">System time (UTC)</label>
|
||||
<input type="text" class="form-control" id="sys_UTC_time" disabled>
|
||||
<label for="browser_utc_time" class="form-label">Browser time (UTC)</label>
|
||||
<input type="text" class="form-control" id="browser_utc_time" disabled>
|
||||
<small class="text-muted">Heure de votre appareil (PC/Mac/tablette). Reference pour verifier le RTC.</small>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="RTC_utc_time" class="form-label">RTC time (UTC)</label>
|
||||
<input type="text" class="form-control" id="RTC_utc_time" disabled>
|
||||
</div>
|
||||
<hr>
|
||||
<details class="mb-3">
|
||||
<summary class="text-muted" style="cursor:pointer;">System time (non utilise par le capteur)</summary>
|
||||
<div class="mt-2">
|
||||
<div class="mb-3">
|
||||
<label for="sys_local_time" class="form-label">System time (local)</label>
|
||||
<input type="text" class="form-control form-control-sm" id="sys_local_time" disabled>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="sys_UTC_time" class="form-label">System time (UTC)</label>
|
||||
<input type="text" class="form-control form-control-sm" id="sys_UTC_time" disabled>
|
||||
</div>
|
||||
<small class="text-muted">Horloge Linux du Raspberry Pi. Se synchronise via internet (NTP). Non utilisee par le capteur.</small>
|
||||
</div>
|
||||
</details>
|
||||
|
||||
|
||||
<div id="alert_container"></div>
|
||||
|
||||
<h5 class="mt-4">Set RTC</h5>
|
||||
<h5 class="mt-4">Synchroniser le RTC</h5>
|
||||
<small class="text-muted d-block mb-2">Met a jour l'horloge RTC pour qu'elle reste precise sans internet.</small>
|
||||
|
||||
<button type="submit" class="btn btn-primary mb-1" onclick="set_RTC_withNTP()">WiFi (NTP) </button>
|
||||
<button type="submit" class="btn btn-primary mb-1" onclick="set_RTC_withBrowser()">Browser time </button>
|
||||
@@ -585,29 +599,39 @@ window.onload = function() {
|
||||
document.getElementById("sys_UTC_time").value = response.system_utc_time;
|
||||
document.getElementById("RTC_utc_time").value = response.rtc_module_time;
|
||||
|
||||
// Get the time difference
|
||||
const timeDiff = response.time_difference_seconds;
|
||||
// Display browser time in UTC
|
||||
const browserDate = new Date();
|
||||
const browserUTC = browserDate.getUTCFullYear() + '-' +
|
||||
String(browserDate.getUTCMonth() + 1).padStart(2, '0') + '-' +
|
||||
String(browserDate.getUTCDate()).padStart(2, '0') + ' ' +
|
||||
String(browserDate.getUTCHours()).padStart(2, '0') + ':' +
|
||||
String(browserDate.getUTCMinutes()).padStart(2, '0') + ':' +
|
||||
String(browserDate.getUTCSeconds()).padStart(2, '0');
|
||||
document.getElementById("browser_utc_time").value = browserUTC;
|
||||
|
||||
// Reference to the alert container
|
||||
// Compare RTC time with browser time
|
||||
const alertContainer = document.getElementById("alert_container");
|
||||
|
||||
// Remove any previous alert
|
||||
alertContainer.innerHTML = "";
|
||||
|
||||
// Add an alert based on time difference
|
||||
if (typeof timeDiff === "number") {
|
||||
if (timeDiff >= 0 && timeDiff <= 10) {
|
||||
if (response.rtc_module_time) {
|
||||
const rtcDate = new Date(response.rtc_module_time + ' UTC');
|
||||
const timeDiff = Math.abs(Math.round((browserDate - rtcDate) / 1000));
|
||||
|
||||
if (timeDiff <= 30) {
|
||||
alertContainer.innerHTML = `
|
||||
<div class="alert alert-success" role="alert">
|
||||
RTC and system time are in sync (Difference: ${timeDiff} sec).
|
||||
RTC synchronise avec l'heure du navigateur (ecart: ${timeDiff} sec).
|
||||
</div>`;
|
||||
} else if (timeDiff > 10) {
|
||||
} else {
|
||||
const minutes = Math.floor(timeDiff / 60);
|
||||
const label = minutes > 0 ? `${minutes} min ${timeDiff % 60} sec` : `${timeDiff} sec`;
|
||||
alertContainer.innerHTML = `
|
||||
<div class="alert alert-danger" role="alert">
|
||||
RTC time is out of sync! (Difference: ${timeDiff} sec).
|
||||
RTC desynchronise ! Ecart avec le navigateur: ${label}.
|
||||
Utilisez "Synchroniser le RTC" ci-dessous.
|
||||
</div>`;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('AJAX request failed:', status, error);
|
||||
|
||||
Reference in New Issue
Block a user