Web: show RX metrics before TX in Packets HUD card

For a mesh repeater, a packet must be received before it can be
retransmitted, so RX metrics are the primary signal. Reorder the
Packets card to reflect this:

- Swap meter order: RX Flood Share before TX Flood Share
- Swap metric order: Recv before Sent, RX Direct before TX Direct
- Reorder floodTx/directTx declarations to match the new order
Этот коммит содержится в:
Valentin V. Bartenev
2026-05-09 20:12:03 +03:00
родитель b64d57f6a4
Коммит 55f21997aa
+6 -6
Просмотреть файл
@@ -1543,27 +1543,27 @@ const char kWebPanelAppHtml[] PROGMEM = R"HTML(
</section>`; </section>`;
} }
function renderPacketsCard(packets) { function renderPacketsCard(packets) {
const sent = packets.sent || 0;
const recv = packets.recv || 0; const recv = packets.recv || 0;
const floodTx = packets.flood_tx || 0; const sent = packets.sent || 0;
const directTx = packets.direct_tx || 0;
const floodRx = packets.flood_rx || 0; const floodRx = packets.flood_rx || 0;
const directRx = packets.direct_rx || 0; const directRx = packets.direct_rx || 0;
const recvErrors = packets.recv_errors || 0; const recvErrors = packets.recv_errors || 0;
const totalAttempts = recv + recvErrors; const totalAttempts = recv + recvErrors;
const errorRatePct = pctRatio(recvErrors, totalAttempts); const errorRatePct = pctRatio(recvErrors, totalAttempts);
const floodTx = packets.flood_tx || 0;
const directTx = packets.direct_tx || 0;
return `<section class="hud-card"> return `<section class="hud-card">
<h3>Packets</h3> <h3>Packets</h3>
<div style="display:grid;grid-template-columns:1fr 1fr;gap:0.5rem;min-width:0"> <div style="display:grid;grid-template-columns:1fr 1fr;gap:0.5rem;min-width:0">
${renderMeter("TX Flood Share", Math.round(pctRatio(floodTx, sent)) + "%", pctRatio(floodTx, sent), "", false)}
${renderMeter("RX Flood Share", Math.round(pctRatio(floodRx, recv)) + "%", pctRatio(floodRx, recv), "", false)} ${renderMeter("RX Flood Share", Math.round(pctRatio(floodRx, recv)) + "%", pctRatio(floodRx, recv), "", false)}
${renderMeter("TX Flood Share", Math.round(pctRatio(floodTx, sent)) + "%", pctRatio(floodTx, sent), "", false)}
</div> </div>
${renderMeter("RX Error Rate", Math.round(errorRatePct) + "%", errorRatePct, recvErrors + " errors / " + totalAttempts + " attempts", false)} ${renderMeter("RX Error Rate", Math.round(errorRatePct) + "%", errorRatePct, recvErrors + " errors / " + totalAttempts + " attempts", false)}
<div class="metric-grid"> <div class="metric-grid">
${renderMetric("Sent", sent)}
${renderMetric("Recv", recv)} ${renderMetric("Recv", recv)}
${renderMetric("TX Direct", directTx)} ${renderMetric("Sent", sent)}
${renderMetric("RX Direct", directRx)} ${renderMetric("RX Direct", directRx)}
${renderMetric("TX Direct", directTx)}
${renderMetric("Recv Errors", packets.recv_errors || 0)} ${renderMetric("Recv Errors", packets.recv_errors || 0)}
${renderMetric("Balance", recv - sent)} ${renderMetric("Balance", recv - sent)}
</div> </div>