Add packed noise-floor telemetry history for both radio profiles
This commit is contained in:
1 parent
52a36c89dc
commit
f4ade738df
32 files changed
+2520
-53
No files matched your search
@@ -5,9 +5,16 @@
|
||||
const TYPE_VOLTAGE = 0x12;
|
||||
const TYPE_GPS = 0x13;
|
||||
const TYPE_EXTERNAL_VOLTAGE = 0x14;
|
||||
const TYPE_NOISE = 0x15;
|
||||
const TYPE_NOISE_SECONDARY = 0x16;
|
||||
const BINARY_TEMPERATURE_MAGIC = "TTB1";
|
||||
const BINARY_VOLTAGE_MAGIC = "TVB1";
|
||||
const BINARY_EXTERNAL_VOLTAGE_MAGIC = "IVB1";
|
||||
const BINARY_NOISE_MAGIC = "N1B1";
|
||||
const BINARY_NOISE_SECONDARY_MAGIC = "N2B1";
|
||||
const NOISE_BITS = 5;
|
||||
const NOISE_CLI_MAX_SAMPLES = 176;
|
||||
const NOISE_BINARY_MAX_SAMPLES = 255;
|
||||
const BINARY_HEADER_SIZE = 19;
|
||||
const BINARY_MAX_SAMPLES = 165;
|
||||
const BINARY_EXTERNAL_HEADER_SIZE = 20;
|
||||
@@ -25,6 +32,8 @@
|
||||
<button type="button" data-telemetry-example="packetVoltage">Voltage packet</button>
|
||||
<button type="button" data-telemetry-example="packetExternalVoltage">I2C voltage packet</button>
|
||||
<button type="button" data-telemetry-example="externalVoltage">I2C voltage CLI page</button>
|
||||
<button type="button" data-telemetry-example="packetNoise">Radio1 noise packet</button>
|
||||
<button type="button" data-telemetry-example="noiseSecondary">Radio2 noise CLI page</button>
|
||||
</div>
|
||||
|
||||
<label for="telemetry-reply-input">Raw packet or payload hex</label>
|
||||
@@ -60,6 +69,7 @@
|
||||
<button type="button" data-role="download">Download CSV</button>
|
||||
</div>
|
||||
<dl class="telemetry-summary" data-role="summary"></dl>
|
||||
<div class="telemetry-noise-chart" data-role="chart" hidden></div>
|
||||
<div class="telemetry-warnings" data-role="warnings" hidden>
|
||||
<strong>Decode notes</strong>
|
||||
<ul data-role="warning-list"></ul>
|
||||
@@ -87,6 +97,16 @@
|
||||
reply:
|
||||
"3E00495642311122334455667788800092651E00020800000004019026927109C427107FFF",
|
||||
}),
|
||||
packetNoise: Object.freeze({
|
||||
label: "Analyzer radio1 noise-floor packet",
|
||||
command: "send telemetry.tx now",
|
||||
reply: "3E004E3142311122334455667788800092650F00080044CB77DF",
|
||||
}),
|
||||
noiseSecondary: Object.freeze({
|
||||
label: "Radio2 noise-floor CLI page",
|
||||
command: "get telemetry.noise2",
|
||||
reply: "> FoAAkmUPCABEy3ff",
|
||||
}),
|
||||
temperature: Object.freeze({
|
||||
label: "Temperature example",
|
||||
command: "get telemetry.temp",
|
||||
@@ -120,6 +140,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
function stripBase64ReplyPrefix(line) {
|
||||
return line.trim().replace(/^[^|\r\n]{2}\|\s*/, "").replace(/^>\s*/, "");
|
||||
}
|
||||
|
||||
function isBase64ReplyLine(line) {
|
||||
return /^(?:[^|\r\n]{2}\||>)/.test(line)
|
||||
&& /^[A-Za-z0-9+/]+={0,2}$/.test(stripBase64ReplyPrefix(line));
|
||||
}
|
||||
|
||||
function extractBase64(input) {
|
||||
if (typeof input !== "string" || input.trim() === "") {
|
||||
throw new TelemetryDecodeError("Paste a telemetry reply or Base64 payload first.");
|
||||
@@ -133,15 +162,16 @@
|
||||
const replyLine = text
|
||||
.split(/\r?\n/)
|
||||
.map((line) => line.trim())
|
||||
.find((line) => /^>\s*[A-Za-z0-9+/]+={0,2}$/.test(line));
|
||||
.find(isBase64ReplyLine);
|
||||
|
||||
if (replyLine) {
|
||||
text = replyLine.replace(/^>\s*/, "");
|
||||
text = stripBase64ReplyPrefix(replyLine);
|
||||
} else {
|
||||
text = text
|
||||
.replace(/^```(?:text)?\s*/i, "")
|
||||
.replace(/```\s*$/, "")
|
||||
.trim()
|
||||
.replace(/^[^|\r\n]{2}\|\s*/, "")
|
||||
.replace(/^>\s*/, "")
|
||||
.replace(/\s+/g, "");
|
||||
}
|
||||
@@ -164,8 +194,8 @@
|
||||
const replies = input
|
||||
.split(/\r?\n/)
|
||||
.map((line) => line.trim())
|
||||
.filter((line) => /^>\s*[A-Za-z0-9+/]+={0,2}$/.test(line))
|
||||
.map((line) => line.replace(/^>\s*/, ""));
|
||||
.filter(isBase64ReplyLine)
|
||||
.map(stripBase64ReplyPrefix);
|
||||
return replies.length === 0 ? [extractBase64(input)] : replies;
|
||||
}
|
||||
|
||||
@@ -204,6 +234,19 @@
|
||||
return value;
|
||||
}
|
||||
|
||||
function noiseProfile(type) {
|
||||
if (type === TYPE_NOISE || type === BINARY_NOISE_MAGIC) return 1;
|
||||
if (type === TYPE_NOISE_SECONDARY || type === BINARY_NOISE_SECONDARY_MAGIC) return 2;
|
||||
return null;
|
||||
}
|
||||
|
||||
function binaryMagicSupported(magic) {
|
||||
return magic === BINARY_TEMPERATURE_MAGIC
|
||||
|| magic === BINARY_VOLTAGE_MAGIC
|
||||
|| magic === BINARY_EXTERNAL_VOLTAGE_MAGIC
|
||||
|| noiseProfile(magic) !== null;
|
||||
}
|
||||
|
||||
function extractHexBytes(input) {
|
||||
if (typeof input !== "string" || input.trim() === "") {
|
||||
throw new TelemetryDecodeError("Paste raw packet hex from the analyzer first.");
|
||||
@@ -246,9 +289,7 @@
|
||||
if (firstValid === null) firstValid = bytes;
|
||||
for (let offset = 0; offset <= bytes.length - 4; offset += 1) {
|
||||
const magic = asciiAt(bytes, offset, 4);
|
||||
if (magic === BINARY_TEMPERATURE_MAGIC
|
||||
|| magic === BINARY_VOLTAGE_MAGIC
|
||||
|| magic === BINARY_EXTERNAL_VOLTAGE_MAGIC) {
|
||||
if (binaryMagicSupported(magic)) {
|
||||
return bytes;
|
||||
}
|
||||
}
|
||||
@@ -256,7 +297,7 @@
|
||||
|
||||
if (firstValid) {
|
||||
throw new TelemetryDecodeError(
|
||||
"Hex was found, but it does not contain TTB1, TVB1, or IVB1 telemetry."
|
||||
"Hex was found, but it does not contain TTB1, TVB1, IVB1, N1B1, or N2B1 telemetry."
|
||||
);
|
||||
}
|
||||
throw new TelemetryDecodeError(
|
||||
@@ -360,9 +401,10 @@
|
||||
function decodeBinarySnapshot(bytes, offset) {
|
||||
const magic = asciiAt(bytes, offset, 4);
|
||||
const externalVoltage = magic === BINARY_EXTERNAL_VOLTAGE_MAGIC;
|
||||
const profile = noiseProfile(magic);
|
||||
const headerSize = externalVoltage
|
||||
? BINARY_EXTERNAL_HEADER_SIZE : BINARY_HEADER_SIZE;
|
||||
const maximumSamples = externalVoltage
|
||||
const maximumSamples = profile ? NOISE_BINARY_MAX_SAMPLES : externalVoltage
|
||||
? BINARY_EXTERNAL_MAX_SAMPLES : BINARY_MAX_SAMPLES;
|
||||
if (bytes.length - offset < headerSize) {
|
||||
throw new TelemetryDecodeError("The binary telemetry header is incomplete.");
|
||||
@@ -377,7 +419,7 @@
|
||||
if (intervalMinutes === 0) {
|
||||
throw new TelemetryDecodeError("Binary telemetry sample interval cannot be zero.");
|
||||
}
|
||||
const dataLength = externalVoltage
|
||||
const dataLength = profile ? Math.ceil(count * NOISE_BITS / 8) : externalVoltage
|
||||
? Math.ceil((count * EXTERNAL_VOLTAGE_BITS) / 8) : count;
|
||||
const payloadLength = headerSize + dataLength;
|
||||
if (bytes.length - offset < payloadLength) {
|
||||
@@ -400,6 +442,13 @@
|
||||
packet: decodePacketEnvelope(bytes, offset),
|
||||
channel: externalVoltage ? bytes[offset + 18] : null,
|
||||
};
|
||||
if (profile) {
|
||||
assertLength(bytes, offset + payloadLength, "Noise-floor");
|
||||
if (offset > 0 && (!header.packet || !header.packet.isRawCustom)) {
|
||||
throw new TelemetryDecodeError("Noise-floor telemetry must be a payload or a complete RAW_CUSTOM packet.");
|
||||
}
|
||||
return decodeNoise(bytes, header, offset + headerSize, NOISE_BINARY_MAX_SAMPLES);
|
||||
}
|
||||
const rows = [];
|
||||
for (let index = 0; index < count; index += 1) {
|
||||
const rawCode = externalVoltage
|
||||
@@ -484,9 +533,7 @@
|
||||
let lastError = null;
|
||||
for (let offset = 0; offset <= bytes.length - 4; offset += 1) {
|
||||
const magic = asciiAt(bytes, offset, 4);
|
||||
if (magic !== BINARY_TEMPERATURE_MAGIC
|
||||
&& magic !== BINARY_VOLTAGE_MAGIC
|
||||
&& magic !== BINARY_EXTERNAL_VOLTAGE_MAGIC) continue;
|
||||
if (!binaryMagicSupported(magic)) continue;
|
||||
try {
|
||||
decodedCandidates.push(decodeBinarySnapshot(bytes, offset));
|
||||
} catch (error) {
|
||||
@@ -619,6 +666,45 @@
|
||||
};
|
||||
}
|
||||
|
||||
function decodeNoise(bytes, header, dataOffset = 7,
|
||||
maximumSamples = NOISE_CLI_MAX_SAMPLES) {
|
||||
if (header.intervalMinutes !== 15) {
|
||||
throw new TelemetryDecodeError("Noise-floor telemetry requires a 15-minute sample interval.");
|
||||
}
|
||||
if (header.count < 1 || header.count > maximumSamples) {
|
||||
throw new TelemetryDecodeError(
|
||||
`Noise-floor sample count must be between 1 and ${maximumSamples}.`
|
||||
);
|
||||
}
|
||||
const dataBytes = Math.ceil(header.count * NOISE_BITS / 8);
|
||||
assertLength(bytes, dataOffset + dataBytes, "Noise-floor");
|
||||
const paddingBits = dataBytes * 8 - header.count * NOISE_BITS;
|
||||
if (paddingBits && (bytes[bytes.length - 1] & ((1 << paddingBits) - 1))) {
|
||||
throw new TelemetryDecodeError("Noise-floor padding bits must be zero.");
|
||||
}
|
||||
const profile = noiseProfile(header.typeCode);
|
||||
const rows = [];
|
||||
for (let index = 0; index < header.count; index += 1) {
|
||||
const rawCode = readPackedBits(bytes, dataOffset, index * NOISE_BITS, NOISE_BITS);
|
||||
rows.push({
|
||||
index,
|
||||
epoch: sampleEpoch(header, index),
|
||||
status: rawCode === 30 ? "MAX" : rawCode === 31 ? "Missing" : "Value",
|
||||
rawCode,
|
||||
noiseDbm: rawCode >= 30 ? null
|
||||
: rawCode <= 2 ? -120 + rawCode : -118 + (rawCode - 2) * 2,
|
||||
});
|
||||
}
|
||||
return {
|
||||
...header,
|
||||
profile,
|
||||
kind: "noise",
|
||||
label: `Radio${profile} noise floor`,
|
||||
rows,
|
||||
warnings: [],
|
||||
};
|
||||
}
|
||||
|
||||
function decodeGps(bytes, header) {
|
||||
if (bytes.length < 17) {
|
||||
throw new TelemetryDecodeError("GPS payload is shorter than its 17-byte header.");
|
||||
@@ -754,9 +840,11 @@
|
||||
decoded = decodeGps(bytes, header);
|
||||
} else if (header.typeCode === TYPE_EXTERNAL_VOLTAGE) {
|
||||
decoded = decodeExternalVoltage(bytes, header);
|
||||
} else if (noiseProfile(header.typeCode)) {
|
||||
decoded = decodeNoise(bytes, header);
|
||||
} else {
|
||||
throw new TelemetryDecodeError(
|
||||
`Unsupported telemetry type 0x${header.typeCode.toString(16).padStart(2, "0")}; expected 0x11, 0x12, 0x13, or 0x14.`
|
||||
`Unsupported telemetry type 0x${header.typeCode.toString(16).padStart(2, "0")}; expected 0x11 through 0x16.`
|
||||
);
|
||||
}
|
||||
decoded.encoded = encoded;
|
||||
@@ -769,11 +857,12 @@
|
||||
decodedItems.slice(1).forEach((item) => {
|
||||
const sameSource = (item.sourceId || null) === (first.sourceId || null);
|
||||
const sameChannel = (item.channel || null) === (first.channel || null);
|
||||
const sameProfile = (item.profile || null) === (first.profile || null);
|
||||
if (item.kind !== first.kind || item.typeCode !== first.typeCode
|
||||
|| item.intervalMinutes !== first.intervalMinutes
|
||||
|| !sameSource || !sameChannel) {
|
||||
|| !sameSource || !sameChannel || !sameProfile) {
|
||||
throw new TelemetryDecodeError(
|
||||
"Multiple telemetry replies must use the same type, source, channel, and interval."
|
||||
"Multiple telemetry replies must use the same type, source, channel, and interval, including the radio profile."
|
||||
);
|
||||
}
|
||||
});
|
||||
@@ -812,7 +901,7 @@
|
||||
function decodeTelemetry(input) {
|
||||
const rawLines = typeof input === "string"
|
||||
? input.split(/\r?\n/).filter(
|
||||
(line) => /54544231|54564231|49564231/i.test(line)
|
||||
(line) => /54544231|54564231|49564231|4e314231|4e324231/i.test(line)
|
||||
)
|
||||
: [];
|
||||
if (rawLines.length > 1) {
|
||||
@@ -829,7 +918,7 @@
|
||||
.replace(/^['"]|['",;]$/g, "")
|
||||
: "";
|
||||
if ((/^[0-9a-f]+$/i.test(compactHex) && compactHex.length % 2 === 0)
|
||||
|| /54544231|54564231|49564231/i.test(String(input))) {
|
||||
|| /54544231|54564231|49564231|4e314231|4e324231/i.test(String(input))) {
|
||||
return decodeRawTelemetryHex(input);
|
||||
}
|
||||
return mergeDecodedTelemetry(
|
||||
@@ -857,6 +946,23 @@
|
||||
(Intl.DateTimeFormat().resolvedOptions() || {}).timeZone || "browser local";
|
||||
const timestampHeader = localTime ? `Timestamp (${localZone})` : "Timestamp (UTC)";
|
||||
|
||||
if (decoded.kind === "noise") {
|
||||
return {
|
||||
headers: ["#", timestampHeader, "Status", decoded.label, "Raw code"],
|
||||
csvHeaders: ["sample", localTime ? `timestamp (${localZone})` : "timestamp_utc",
|
||||
"radio_profile", "status", "noise_floor_dbm", "raw_code"],
|
||||
rows: decoded.rows.map((row) => ({
|
||||
muted: row.status === "Missing",
|
||||
values: [row.index + 1, timestampText(row.epoch, localTime), row.status,
|
||||
row.status === "MAX" ? ">-64 dBm"
|
||||
: row.noiseDbm === null ? "—" : `${row.noiseDbm} dBm`, row.rawCode],
|
||||
csvValues: [row.index + 1, timestampText(row.epoch, localTime), decoded.profile,
|
||||
row.status.toLowerCase(), row.noiseDbm === null ? "" : row.noiseDbm,
|
||||
row.rawCode],
|
||||
})),
|
||||
};
|
||||
}
|
||||
|
||||
if (decoded.kind === "temperature") {
|
||||
return {
|
||||
headers: [
|
||||
@@ -977,6 +1083,9 @@
|
||||
if (decoded.channel) {
|
||||
items.splice(1, 0, ["LPP channel", String(decoded.channel)]);
|
||||
}
|
||||
if (decoded.profile) {
|
||||
items.splice(1, 0, ["Radio profile", `radio${decoded.profile}`]);
|
||||
}
|
||||
if (decoded.sourceId) {
|
||||
items.splice(1, 0, ["Source ID", decoded.sourceId]);
|
||||
items.push([
|
||||
@@ -1014,11 +1123,80 @@
|
||||
}
|
||||
|
||||
function modelToCsv(model) {
|
||||
return [model.headers, ...model.rows.map((row) => row.values)]
|
||||
return [model.csvHeaders || model.headers,
|
||||
...model.rows.map((row) => row.csvValues || row.values)]
|
||||
.map((row) => row.map(csvCell).join(","))
|
||||
.join("\r\n");
|
||||
}
|
||||
|
||||
function noiseChartModel(decoded) {
|
||||
if (decoded.kind !== "noise") return null;
|
||||
const first = decoded.rows[0].epoch;
|
||||
const last = decoded.rows[decoded.rows.length - 1].epoch;
|
||||
const span = Math.max(900, last - first);
|
||||
const segments = [];
|
||||
let segment = [];
|
||||
let previousEpoch = null;
|
||||
decoded.rows.forEach((row) => {
|
||||
if (row.noiseDbm === null || (previousEpoch !== null && row.epoch - previousEpoch !== 900)) {
|
||||
if (segment.length) segments.push(segment);
|
||||
segment = [];
|
||||
}
|
||||
if (row.noiseDbm !== null) {
|
||||
segment.push({
|
||||
x: 50 + (row.epoch - first) * 570 / span,
|
||||
y: 150 - (row.noiseDbm + 120) * 130 / 56,
|
||||
label: `${timestampText(row.epoch, false)}: ${row.noiseDbm} dBm`,
|
||||
});
|
||||
}
|
||||
previousEpoch = row.epoch;
|
||||
});
|
||||
if (segment.length) segments.push(segment);
|
||||
return {
|
||||
segments,
|
||||
description: `${decoded.label}. Numeric readings only; MAX and missing samples leave gaps.`,
|
||||
};
|
||||
}
|
||||
|
||||
function renderNoiseChart(container, decoded) {
|
||||
container.replaceChildren();
|
||||
const model = noiseChartModel(decoded);
|
||||
container.hidden = model === null;
|
||||
if (!model) return;
|
||||
const svgElement = (tag, attributes = {}) => {
|
||||
const node = document.createElementNS("http://www.w3.org/2000/svg", tag);
|
||||
Object.entries(attributes).forEach(([name, value]) => node.setAttribute(name, String(value)));
|
||||
return node;
|
||||
};
|
||||
const svg = svgElement("svg", { viewBox: "0 0 640 175", role: "img",
|
||||
"aria-label": model.description });
|
||||
for (const [value, y] of [[-64, 20], [-92, 85], [-120, 150]]) {
|
||||
svg.appendChild(svgElement("line", { x1: 50, x2: 620, y1: y, y2: y,
|
||||
class: "telemetry-chart-grid" }));
|
||||
const label = svgElement("text", { x: 42, y: y + 4, "text-anchor": "end" });
|
||||
label.textContent = `${value}`;
|
||||
svg.appendChild(label);
|
||||
}
|
||||
model.segments.forEach((segment) => {
|
||||
svg.appendChild(svgElement("polyline", {
|
||||
points: segment.map((point) => `${point.x},${point.y}`).join(" "),
|
||||
class: "telemetry-chart-line",
|
||||
}));
|
||||
segment.forEach((point) => {
|
||||
const dot = svgElement("circle", { cx: point.x, cy: point.y, r: 2,
|
||||
class: "telemetry-chart-point" });
|
||||
const title = svgElement("title");
|
||||
title.textContent = point.label;
|
||||
dot.appendChild(title);
|
||||
svg.appendChild(dot);
|
||||
});
|
||||
});
|
||||
container.appendChild(svg);
|
||||
const caption = document.createElement("p");
|
||||
caption.textContent = "Noise floor (dBm), oldest to newest. MAX (>−64 dBm) and missing samples leave gaps.";
|
||||
container.appendChild(caption);
|
||||
}
|
||||
|
||||
function appendCell(row, tagName, value) {
|
||||
const cell = document.createElement(tagName);
|
||||
cell.textContent = String(value);
|
||||
@@ -1041,6 +1219,7 @@
|
||||
const results = root.querySelector("[data-role='results']");
|
||||
const resultTitle = root.querySelector("[data-role='result-title']");
|
||||
const summary = root.querySelector("[data-role='summary']");
|
||||
const chart = root.querySelector("[data-role='chart']");
|
||||
const warningBox = root.querySelector("[data-role='warnings']");
|
||||
const warningList = root.querySelector("[data-role='warning-list']");
|
||||
const table = root.querySelector("[data-role='table']");
|
||||
@@ -1068,6 +1247,7 @@
|
||||
const useLocalTime = localTime.checked;
|
||||
const model = tableModel(current, useLocalTime);
|
||||
resultTitle.textContent = `${current.label} telemetry`;
|
||||
renderNoiseChart(chart, current);
|
||||
|
||||
summary.replaceChildren();
|
||||
summaryItems(current, useLocalTime).forEach(([term, description]) => {
|
||||
@@ -1150,7 +1330,8 @@
|
||||
link.href = url;
|
||||
const sourcePart = current.sourceId ? `${current.sourceId.toLowerCase()}-` : "";
|
||||
const channelPart = current.channel ? `-ch${current.channel}` : "";
|
||||
link.download = `meshcore-telemetry-${sourcePart}${current.kind}${channelPart}.csv`;
|
||||
const profilePart = current.profile ? `-radio${current.profile}` : "";
|
||||
link.download = `meshcore-telemetry-${sourcePart}${current.kind}${channelPart}${profilePart}.csv`;
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
link.remove();
|
||||
@@ -1175,6 +1356,7 @@
|
||||
mergeDecodedTelemetry,
|
||||
tableModel,
|
||||
modelToCsv,
|
||||
noiseChartModel,
|
||||
});
|
||||
|
||||
global.MeshCoreTelemetryDecoder = api;
|
||||
|
||||
@@ -184,6 +184,38 @@
|
||||
border-radius: 0.4rem;
|
||||
}
|
||||
|
||||
.telemetry-noise-chart {
|
||||
margin: 1rem 0;
|
||||
color: var(--md-default-fg-color);
|
||||
}
|
||||
|
||||
.telemetry-noise-chart svg {
|
||||
display: block;
|
||||
width: 100%;
|
||||
max-height: 18rem;
|
||||
font: 12px sans-serif;
|
||||
fill: currentColor;
|
||||
}
|
||||
|
||||
.telemetry-noise-chart p {
|
||||
margin: 0.2rem 0;
|
||||
font-size: 0.78rem;
|
||||
}
|
||||
|
||||
.telemetry-chart-grid {
|
||||
stroke: var(--telemetry-border);
|
||||
}
|
||||
|
||||
.telemetry-chart-line {
|
||||
fill: none;
|
||||
stroke: var(--md-primary-fg-color);
|
||||
stroke-width: 2;
|
||||
}
|
||||
|
||||
.telemetry-chart-point {
|
||||
fill: var(--md-primary-fg-color);
|
||||
}
|
||||
|
||||
.telemetry-tool .telemetry-table {
|
||||
display: table;
|
||||
width: 100%;
|
||||
|
||||
+72
-6
@@ -749,6 +749,11 @@ default; repeaters request a seven-day default at startup. Builds without a GPS
|
||||
provider omit the GPS history commands to conserve flash. All history and any
|
||||
runtime retention change are held in RAM and reset after a reboot.
|
||||
|
||||
Radio noise-floor history is recorded separately every 15 minutes, retaining
|
||||
768 positions (eight rolling days) per profile. It uses idle RSSI calibration
|
||||
estimates rather than received-packet RSSI. Main-radio and radio2 history are
|
||||
kept separate; failed measurements retain a Missing position in the timeline.
|
||||
|
||||
The feature is omitted from flash-constrained STM32 repeater and room images.
|
||||
|
||||
**Usage:**
|
||||
@@ -757,6 +762,8 @@ The feature is omitted from flash-constrained STM32 repeater and room images.
|
||||
- `get telemetry.volt [page]`
|
||||
- `get telemetry.volt.i2c [channel [page]]`
|
||||
- `get telemetry.gps [page]`
|
||||
- `get telemetry.noise [page]`
|
||||
- `get telemetry.noise2 [page]`
|
||||
- `set telemetry.gps <days>`
|
||||
- `get telemetry.tx`
|
||||
- `set telemetry.tx <off|direct|path>`
|
||||
@@ -773,7 +780,9 @@ The feature is omitted from flash-constrained STM32 repeater and room images.
|
||||
- `page`: Page `1` is always newest. Temperature and voltage pages each hold
|
||||
24 hours and accept `1`-`7`. GPS pages each hold 12 hours and accept `1`
|
||||
through twice the current GPS retention in days. Omitting the page selects
|
||||
page `1`.
|
||||
page `1`. Noise pages contain up to 176 quarter-hour positions (44 hours)
|
||||
and accept only pages already collected, up to `1`-`5`. Use `telemetry.noise`
|
||||
for the main profile and `telemetry.noise2` for radio2.
|
||||
- `channel`: Cayenne LPP channel assigned to an external voltage monitor.
|
||||
`get telemetry.volt.i2c` lists channels that have at least one non-zero
|
||||
sample. Supplying a channel returns 48 points (24 hours) per page; pages
|
||||
@@ -803,11 +812,24 @@ voltage monitors, and an already-valid onboard GPS fix. It does not wake GPS,
|
||||
so an off, sleeping, or unfixed GPS produces a missing location sample without
|
||||
changing its power-saving schedule.
|
||||
|
||||
Noise history combines three fresh estimates collected roughly five minutes
|
||||
apart in each UTC-aligned quarter-hour. If any is at or below `-100 dBm`, use
|
||||
the minimum. Otherwise, if any is at or above `-80 dBm`, use the maximum.
|
||||
Otherwise, average all three. Thus a bucket containing both low and high
|
||||
values uses the minimum. Minimums round down, maximums round up, and averages
|
||||
round to the nearest encoded step. Incomplete buckets are Missing. A busy
|
||||
channel can prevent a fresh estimate; old calibration results are not reused
|
||||
as fresh measurements.
|
||||
|
||||
External voltage history allocates 360 bytes for each detected monitor channel
|
||||
(1,080 bytes for all three INA3221 inputs). The allocation reserves all
|
||||
detected inputs so a sensor connected later can start recording, but all-zero
|
||||
inputs are omitted from command replies and LoRa transmission.
|
||||
|
||||
Packed noise history uses 480 bytes per retained profile, plus its collection
|
||||
state. It does not add a 15-minute transmission schedule. USB and administrator
|
||||
LoRa CLI return the same Base64 format in the existing reply buffer.
|
||||
|
||||
Replies contain `> ` followed by standard padded Base64. After decoding, all
|
||||
multi-byte integers are little-endian. Packed fields are written most
|
||||
significant bit first, oldest sample first.
|
||||
@@ -825,7 +847,8 @@ shared path and enables the default `2d` schedule; new configuration should use
|
||||
An automatic run waits until 165 half-hour positions are
|
||||
available, then sends one maximum-size temperature packet, one maximum-size
|
||||
battery-voltage packet, and up to three `IVB1` packets for every populated I2C
|
||||
voltage channel. GPS is never included in this raw transmission. The history
|
||||
voltage channel, plus the collected noise-floor snapshots. GPS is never included
|
||||
in this raw transmission. The history
|
||||
remains boot-local, so the first scheduled run after a reboot needs about 82.5
|
||||
hours to fill. On the default two-day interval, each 82.5-hour temperature or
|
||||
battery packet overlaps its predecessor by 34.5 hours. Packets are paced two
|
||||
@@ -834,14 +857,19 @@ that did not queue; successfully queued packets are not duplicated.
|
||||
|
||||
`send telemetry.tx now` is an administrator-only test action. It queues
|
||||
temperature and battery-voltage snapshots plus the available I2C voltage
|
||||
chunks over the configured path. It uses all currently available base
|
||||
chunks over the configured path. It also queues one main-radio `N1B1` packet
|
||||
once a noise bucket has completed and one `N2B1` packet when radio2 is enabled
|
||||
and has a completed bucket. Missing positions are included; an all-Missing
|
||||
history is still sent. It uses all currently available base
|
||||
positions up to 165 and all available I2C positions up to 192 per populated
|
||||
channel. It works while the schedule is off and does not move the next
|
||||
channel, plus the latest 255 positions per noise profile (63 hours 45 minutes).
|
||||
It works while the schedule is off and does not move the next
|
||||
scheduled send time. RAW_CUSTOM direct packets do not enter the normal
|
||||
encrypted direct-message retry mechanism.
|
||||
|
||||
Full snapshots are 184-byte RAW_CUSTOM payloads. Manual tests can be shorter
|
||||
while history fills. Both formats are binary, not Base64 and not encrypted:
|
||||
Full temperature and battery snapshots are 184-byte RAW_CUSTOM payloads.
|
||||
Manual tests can be shorter while history fills. Both formats are binary,
|
||||
not Base64 and not encrypted:
|
||||
|
||||
| Bytes | Meaning |
|
||||
|---|---|
|
||||
@@ -857,6 +885,14 @@ for above `+77 C`. Codes `3` through `130` represent exact whole degrees from
|
||||
`-50 C` through `+77 C`; decode them as `code - 53`. Voltage codes use the
|
||||
same encoding as the paged voltage payload documented below.
|
||||
|
||||
Noise snapshots reuse this 19-byte telemetry header. Their magic is `N1B1`
|
||||
for the main radio or `N2B1` for radio2; the interval is `15`, the count is
|
||||
`1`-`255`, and data begins at byte `19`. Samples are packed 5-bit codes,
|
||||
oldest first and most significant bit first, with zero padding in the last
|
||||
byte. The payload is `19 + ceil(count * 5 / 8)` bytes: 179 bytes for 255
|
||||
positions. No GPS coordinates are included in a noise packet. Noise packets
|
||||
are additional RAW_CUSTOM telemetry snapshots, not a new MeshCore packet type.
|
||||
|
||||
External voltage snapshots use a separate packed layout. A full four-day
|
||||
channel takes three 140-byte `IVB1` payloads of 64 points each:
|
||||
|
||||
@@ -925,6 +961,36 @@ External I2C voltage payload (`0x14`, 98 bytes):
|
||||
|
||||
The codes have the same `0.02 V` through `655.34 V` meaning as `IVB1`.
|
||||
|
||||
Noise-floor payload (`0x15` main radio, `0x16` radio2; up to 117 bytes):
|
||||
|
||||
| Bytes | Meaning |
|
||||
|---|---|
|
||||
| `0` | Format/type `0x15` or `0x16` |
|
||||
| `1`-`4` | First sample UTC epoch, unsigned 32-bit |
|
||||
| `5` | Sample interval in minutes (`15`) |
|
||||
| `6` | Sample count (`1`-`176`) |
|
||||
| `7` onward | Oldest-to-newest packed 5-bit noise-floor codes |
|
||||
|
||||
The same codes are used by `N1B1` and `N2B1`:
|
||||
|
||||
| Code | Meaning |
|
||||
|---|---|
|
||||
| `0` | `-120 dBm` (also clamps lower values) |
|
||||
| `1` | `-119 dBm` |
|
||||
| `2`-`29` | `-118` through `-64 dBm`, in 2 dB steps |
|
||||
| `30` | MAX: above `-64 dBm` |
|
||||
| `31` | Missing: fewer than three fresh, valid estimates |
|
||||
|
||||
The last byte's unused low bits are zero. A full page encodes as 156 Base64
|
||||
characters, plus the existing `> ` reply prefix. The decoder keeps radio1 and
|
||||
radio2 separate and rejects wrong lengths, intervals, or padding. MAX is a
|
||||
status, not an invented numeric `-62 dBm` reading.
|
||||
|
||||
When a Companion CLI command includes its three-character correlation prefix
|
||||
(for example `01|`), noise replies retain that prefix and omit the `> ` prompt.
|
||||
A full `01|Base64` response then fits in 160 bytes including its terminating
|
||||
NUL. The decoder accepts either reply style.
|
||||
|
||||
GPS payload (`0x13`, 101 bytes):
|
||||
|
||||
| Bytes | Meaning |
|
||||
|
||||
@@ -9,7 +9,7 @@ the instructions but cannot run the decoder's buttons or JavaScript.
|
||||
|
||||
Paste raw hexadecimal packet data copied from the
|
||||
[Let's Mesh packet analyzer](https://analyzer.letsmesh.net/packets) to decode a
|
||||
repeater's scheduled temperature, battery-voltage, or external I2C-voltage
|
||||
repeater's temperature, battery-voltage, external I2C-voltage, or radio noise-floor
|
||||
snapshot. The decoder also accepts the payload hex without its MeshCore packet
|
||||
header and the Base64 pages returned by repeater or room-server CLI commands.
|
||||
Decoding happens entirely in this browser; pasted data is not uploaded or sent
|
||||
@@ -54,6 +54,14 @@ history is entirely zero are treated as disconnected and are not sent. The
|
||||
command requires at least one collected base sample and works even when the
|
||||
automatic schedule is off.
|
||||
|
||||
It also queues a `N1B1` noise-floor packet once the main radio has completed a
|
||||
15-minute history bucket. With radio2 enabled, it queues a separate `N2B1`
|
||||
packet for that profile once it has a completed bucket. Each holds the latest
|
||||
255 positions: up to 63 hours 45 minutes at 15-minute resolution. A position
|
||||
can be Missing; failed measurements do not silently shorten the timeline.
|
||||
The existing automatic transmission cadence is unchanged. Recording a new
|
||||
noise-floor position every 15 minutes does not transmit a packet every 15 minutes.
|
||||
|
||||
Schedule changes are saved transactionally; a failed write does not truncate
|
||||
the previous preferences. A legacy route must be successfully migrated into
|
||||
`data.tx` before its schedule can run. Corrupt, unreadable, or ambiguously
|
||||
@@ -75,8 +83,8 @@ to paste a packet, load an example, or download CSV.
|
||||
## Analyzer hex examples
|
||||
|
||||
The buttons load synthetic, protocol-valid zero-hop RAW_CUSTOM packets. A real
|
||||
scheduled snapshot normally has 165 samples and is much longer. Routed packets
|
||||
also contain path bytes before the `TTB1` or `TVB1` payload magic; the decoder
|
||||
snapshot can contain many more samples. Routed packets
|
||||
also contain path bytes before the telemetry payload magic; the decoder
|
||||
finds and validates the payload automatically.
|
||||
|
||||
### Temperature
|
||||
@@ -97,7 +105,13 @@ finds and validates the payload automatically.
|
||||
3E00495642311122334455667788800092651E00020800000004019026927109C427107FFF
|
||||
```
|
||||
|
||||
All three examples identify the source as `1122334455667788`.
|
||||
### Radio1 noise floor
|
||||
|
||||
```text
|
||||
3E004E3142311122334455667788800092650F00080044CB77DF
|
||||
```
|
||||
|
||||
All four examples identify the source as `1122334455667788`.
|
||||
|
||||
## CLI history pages
|
||||
|
||||
@@ -110,9 +124,12 @@ administrator commands:
|
||||
| Battery voltage | `get telemetry.volt` | `get telemetry.volt 3` | 48 (24 hours) |
|
||||
| I2C voltage | `get telemetry.volt.i2c 2` | `get telemetry.volt.i2c 2 4` | 48 (24 hours) |
|
||||
| GPS position | `get telemetry.gps` | `get telemetry.gps 2` | 24 (12 hours) |
|
||||
| Main-radio noise floor | `get telemetry.noise` | `get telemetry.noise 2` | Up to 176 (44 hours) |
|
||||
| Radio2 noise floor | `get telemetry.noise2` | `get telemetry.noise2 2` | Up to 176 (44 hours) |
|
||||
|
||||
Paste either the complete reply beginning with `> ` or Base64 alone. For
|
||||
example:
|
||||
noise replies, the optional two-character CLI correlation prefix is accepted
|
||||
too (`01|Base64` or `01|> Base64`). For example:
|
||||
|
||||
```text
|
||||
get telemetry.volt 1
|
||||
@@ -124,7 +141,15 @@ channels. For each channel, collect pages `1` through `4`. Paste all four reply
|
||||
lines into the decoder at once; it merges their timestamps into one 192-point,
|
||||
four-day table and downloads them as one CSV. The same merging works for the
|
||||
three `IVB1` analyzer packets from a full channel. Inputs must have the same
|
||||
telemetry type, source, LPP channel, and sample interval.
|
||||
telemetry type, source, LPP channel, radio profile, and sample interval.
|
||||
|
||||
Noise history retains eight days (768 quarter-hour positions) per profile in
|
||||
RAM and resets on reboot. Page `1` is newest; up to five pages are available
|
||||
as history fills. Paste the replies for one radio together to merge them.
|
||||
Main-radio and radio2 pages remain separate. A full noise CLI page is 117
|
||||
decoded bytes or 156 Base64 characters, fitting the current CLI reply buffer
|
||||
over USB and administrator LoRa CLI. Radio2 history is read with
|
||||
`get telemetry.noise2`, including when it is not being transmitted.
|
||||
|
||||
An INA3221 exposes its three enabled hardware inputs as three consecutive LPP
|
||||
channels. When it is the only external sensor these are normally `2`, `3`, and
|
||||
@@ -147,6 +172,12 @@ IDs reported by `get telemetry.volt.i2c` rather than assuming them.
|
||||
missing/disconnected; codes `1` through `32767` cover `0.02 V` through
|
||||
`655.34 V`. The LPP channel remains part of every page and raw chunk so
|
||||
multiple monitor inputs cannot be mixed accidentally.
|
||||
- `N1B1` is main-radio noise history; `N2B1` is radio2 history. The chart and
|
||||
table use dBm. Codes `0`, `1`, and `2` mean `-120`, `-119`, and `-118 dBm`;
|
||||
codes `3` through `29` continue in 2 dB steps through `-64 dBm`. Code `30`
|
||||
is **MAX**, displayed as `>-64 dBm`, and code `31` is **Missing**. CSV uses
|
||||
separate `radio_profile`, `status`, and `noise_floor_dbm` columns. MAX and
|
||||
Missing have an empty numeric field and leave gaps in the chart.
|
||||
- GPS positions are reconstructed from signed 10-meter differentials. A zero
|
||||
differential after the page origin is inherently ambiguous: it can represent
|
||||
an unchanged fix, movement below the encoded resolution, or no fix. The table
|
||||
@@ -154,6 +185,16 @@ IDs reported by `get telemetry.volt.i2c` rather than assuming them.
|
||||
- A GPS clipping warning means at least one movement exceeded the differential
|
||||
range, so positions after that point can be less accurate.
|
||||
|
||||
Each noise position combines three fresh noise-floor estimates collected
|
||||
roughly five minutes apart within its UTC-aligned 15-minute bucket. If any
|
||||
estimate is `-100 dBm` or lower, the minimum wins, including a bucket containing
|
||||
both low and high values. Otherwise, if any estimate is `-80 dBm` or higher,
|
||||
the maximum wins. Otherwise the three estimates are averaged. Minimums round
|
||||
downward, maximums upward, and averages to the nearest encodable value. Values
|
||||
below `-120 dBm` clamp to `-120 dBm`; values above `-64 dBm` become MAX.
|
||||
Fewer than three fresh, valid estimates produce Missing. These are idle RSSI
|
||||
noise estimates, not received-packet RSSI measurements.
|
||||
|
||||
GPS history remains available through the administrator CLI, but `telemetry.tx`
|
||||
never puts GPS in RAW_CUSTOM packets. Location data therefore must come from a
|
||||
CLI Base64 page rather than analyzer hex.
|
||||
|
||||
Reference in new issue
Block a user