Normalize primary communication around UART
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
<main>
|
||||
<header>
|
||||
<h1>Xterra Dashboard</h1>
|
||||
<div id="statusLine">RS-485: -- | WiFi: --</div>
|
||||
<div id="statusLine">UART: -- | WiFi: --</div>
|
||||
</header>
|
||||
|
||||
<section id="dashboard" class="screen active">
|
||||
@@ -82,7 +82,7 @@
|
||||
<section id="system" class="screen">
|
||||
<h2>System</h2>
|
||||
<div class="detail-list">
|
||||
<div>RS-485 <strong id="sysRs485">--</strong></div>
|
||||
<div>UART <strong id="sysUart">--</strong></div>
|
||||
<div>WiFi <strong id="sysWifi">--</strong></div>
|
||||
<div>WiFi Override <strong id="sysWifiOverride">--</strong></div>
|
||||
<div>Ignition <strong id="sysIgnition">--</strong></div>
|
||||
@@ -101,8 +101,8 @@
|
||||
<div>Packet Loss <strong id="commsPacketLoss">--</strong></div>
|
||||
</div>
|
||||
|
||||
<button onclick="disconnectRs485()">Disconnect RS-485</button>
|
||||
<button onclick="restoreRs485()">Restore RS-485</button>
|
||||
<button onclick="disconnectUart()">Disconnect UART</button>
|
||||
<button onclick="restoreUart()">Restore UART</button>
|
||||
|
||||
<div class="settings-list">
|
||||
<label>
|
||||
@@ -235,7 +235,7 @@ function checkAlarms(data) {
|
||||
const warnings = [];
|
||||
|
||||
if (data.network.communication_lost) {
|
||||
warnings.push('Communication lost: RS-485 disconnected');
|
||||
warnings.push('Communication lost: UART disconnected');
|
||||
}
|
||||
|
||||
for (const [name, healthy] of Object.entries(data.sensor_health || {})) {
|
||||
@@ -347,7 +347,7 @@ async function loadStatus() {
|
||||
relayState = data.relays;
|
||||
|
||||
document.getElementById('statusLine').textContent =
|
||||
`RS-485: ${data.network.rs485_connected ? 'Connected' : 'Lost'} | WiFi: ${data.network.wifi_enabled ? 'Enabled' : 'Disabled'}`;
|
||||
`UART: ${data.network.uart_connected ? 'Connected' : 'Lost'} | WiFi: ${data.network.wifi_enabled ? 'Enabled' : 'Disabled'}`;
|
||||
|
||||
if (data.network.communication_lost) {
|
||||
document.body.classList.add('comms-lost');
|
||||
@@ -393,12 +393,12 @@ async function loadStatus() {
|
||||
document.getElementById('starlinkBtn').textContent = `Starlink: ${onOff(data.relays.starlink)}`;
|
||||
document.getElementById('fridgeBtn').textContent = `Fridge: ${onOff(data.relays.fridge)}`;
|
||||
|
||||
document.getElementById('sysRs485').textContent = data.network.rs485_connected ? 'Connected' : 'Disconnected';
|
||||
document.getElementById('sysUart').textContent = data.network.uart_connected ? 'Connected' : 'Disconnected';
|
||||
document.getElementById('sysWifi').textContent = data.network.wifi_enabled ? 'Enabled' : 'Disabled';
|
||||
document.getElementById('sysWifiOverride').textContent = data.network.wifi_override_active ? 'Active' : 'Inactive';
|
||||
document.getElementById('sysIgnition').textContent = data.vehicle?.ignition_on ? 'ON' : 'OFF';
|
||||
|
||||
document.getElementById('commsPrimary').textContent = data.network.rs485_connected ? 'RS-485' : 'RS-485 LOST';
|
||||
document.getElementById('commsPrimary').textContent = data.network.uart_connected ? 'UART' : 'UART LOST';
|
||||
document.getElementById('commsBackup').textContent = 'WiFi';
|
||||
document.getElementById('commsSent').textContent = data.network.messages_sent ?? '--';
|
||||
document.getElementById('commsReceived').textContent = data.network.messages_received ?? '--';
|
||||
@@ -466,8 +466,8 @@ async function toggleIgnition() {
|
||||
loadStatus();
|
||||
}
|
||||
|
||||
async function disconnectRs485() {
|
||||
await fetch('/comms/rs485/disconnect', {
|
||||
async function disconnectUart() {
|
||||
await fetch('/comms/uart/disconnect', {
|
||||
method: 'POST',
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
body: JSON.stringify({})
|
||||
@@ -476,8 +476,8 @@ async function disconnectRs485() {
|
||||
loadStatus();
|
||||
}
|
||||
|
||||
async function restoreRs485() {
|
||||
await fetch('/comms/rs485/restore', {
|
||||
async function restoreUart() {
|
||||
await fetch('/comms/uart/restore', {
|
||||
method: 'POST',
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
body: JSON.stringify({})
|
||||
|
||||
Reference in New Issue
Block a user