docs: show preset builder until configured
This commit is contained in:
1 parent
54eb0bd5b3
commit
653578c818
4 files changed
+87
-59
No files matched your search
@@ -131,6 +131,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
function hasPresetParameters(search) {
|
||||
const params = new URLSearchParams(search || "");
|
||||
return Object.keys(DEFAULTS).some(function (key) {
|
||||
return params.has(key);
|
||||
});
|
||||
}
|
||||
|
||||
function supportedTimeZones(selectedTimeZone) {
|
||||
const zones = new Set(["UTC"]);
|
||||
if (typeof Intl.supportedValuesOf === "function") {
|
||||
@@ -723,52 +730,63 @@
|
||||
}
|
||||
|
||||
function init(root) {
|
||||
const search = global.location ? global.location.search : "";
|
||||
let showTest = hasPresetParameters(search);
|
||||
let config;
|
||||
try {
|
||||
config = configFromSearch(
|
||||
global.location ? global.location.search : "",
|
||||
search,
|
||||
browserTimeZone()
|
||||
);
|
||||
} catch (error) {
|
||||
const box = root.querySelector('[data-role="config-error"]');
|
||||
box.hidden = false;
|
||||
box.textContent = "Invalid test URL: " + error.message;
|
||||
root.querySelector('[data-role="content"]').hidden = true;
|
||||
return;
|
||||
config = configFromSearch("", browserTimeZone());
|
||||
showTest = false;
|
||||
}
|
||||
|
||||
setPageText('[data-role="preset-test-page-title"]', presetPageTitle(config));
|
||||
setPageText('[data-role="preset-test-page-summary"]', presetPageSummary(config));
|
||||
setText(root, '[data-role="preset-test-eyebrow"]', presetEyebrow(config));
|
||||
setText(root, '[data-field="freq-display"]', config.freq.toFixed(3));
|
||||
setText(root, '[data-field="bw-display"]', config.bwText);
|
||||
setText(root, '[data-field="sf"]', String(config.sf));
|
||||
setText(root, '[data-field="cr"]', String(config.cr));
|
||||
setText(root, '[data-role="start-zoned"]', formatZoned(config.startMs, config.tz));
|
||||
setText(root, '[data-role="end-zoned"]', formatZoned(config.endMs, config.tz));
|
||||
setText(root, '[data-role="display-zone"]', config.tz);
|
||||
setText(
|
||||
root,
|
||||
'[data-role="epoch-range"]',
|
||||
config.startEpoch + " → " + config.endEpoch
|
||||
);
|
||||
setText(
|
||||
root,
|
||||
'[data-role="window-summary"]',
|
||||
"A " + formatCountdown(config.endMs - config.startMs) +
|
||||
" window. Saved primary settings return automatically at the end."
|
||||
);
|
||||
const testContent = root.querySelector('[data-role="test-content"]');
|
||||
if (testContent) testContent.hidden = !showTest;
|
||||
const testFooter = root.querySelector('[data-role="test-content-footer"]');
|
||||
if (testFooter) testFooter.hidden = !showTest;
|
||||
const builderDisclosure = root.querySelector('[data-role="url-builder-disclosure"]');
|
||||
if (builderDisclosure) builderDisclosure.open = !showTest;
|
||||
|
||||
const staticCommands = commandsFor(config, config.startMs);
|
||||
setCommand(root, "primary-scheduled", staticCommands.primaryScheduled);
|
||||
setCommand(root, "companion-scheduled", staticCommands.companionScheduled);
|
||||
setCommand(root, "stock-cancel-during", staticCommands.stockCancelDuring);
|
||||
setCommand(root, "stock-leave-30", staticCommands.stockLeaveIn30);
|
||||
setCommand(root, "primary-cancel", staticCommands.primaryCancel);
|
||||
setCommand(root, "companion-cancel-before", staticCommands.companionCancelBefore);
|
||||
setCommand(root, "companion-cancel-during", staticCommands.companionCancelDuring);
|
||||
setCommand(root, "companion-leave-30", staticCommands.companionLeaveIn30);
|
||||
setCommand(root, "reset-clock", CLOCK_RESET_COMMAND);
|
||||
if (showTest) {
|
||||
setPageText('[data-role="preset-test-page-title"]', presetPageTitle(config));
|
||||
setPageText('[data-role="preset-test-page-summary"]', presetPageSummary(config));
|
||||
setText(root, '[data-role="preset-test-eyebrow"]', presetEyebrow(config));
|
||||
setText(root, '[data-field="freq-display"]', config.freq.toFixed(3));
|
||||
setText(root, '[data-field="bw-display"]', config.bwText);
|
||||
setText(root, '[data-field="sf"]', String(config.sf));
|
||||
setText(root, '[data-field="cr"]', String(config.cr));
|
||||
setText(root, '[data-role="start-zoned"]', formatZoned(config.startMs, config.tz));
|
||||
setText(root, '[data-role="end-zoned"]', formatZoned(config.endMs, config.tz));
|
||||
setText(root, '[data-role="display-zone"]', config.tz);
|
||||
setText(
|
||||
root,
|
||||
'[data-role="epoch-range"]',
|
||||
config.startEpoch + " → " + config.endEpoch
|
||||
);
|
||||
setText(
|
||||
root,
|
||||
'[data-role="window-summary"]',
|
||||
"A " + formatCountdown(config.endMs - config.startMs) +
|
||||
" window. Saved primary settings return automatically at the end."
|
||||
);
|
||||
|
||||
const staticCommands = commandsFor(config, config.startMs);
|
||||
setCommand(root, "primary-scheduled", staticCommands.primaryScheduled);
|
||||
setCommand(root, "companion-scheduled", staticCommands.companionScheduled);
|
||||
setCommand(root, "stock-cancel-during", staticCommands.stockCancelDuring);
|
||||
setCommand(root, "stock-leave-30", staticCommands.stockLeaveIn30);
|
||||
setCommand(root, "primary-cancel", staticCommands.primaryCancel);
|
||||
setCommand(root, "companion-cancel-before", staticCommands.companionCancelBefore);
|
||||
setCommand(root, "companion-cancel-during", staticCommands.companionCancelDuring);
|
||||
setCommand(root, "companion-leave-30", staticCommands.companionLeaveIn30);
|
||||
setCommand(root, "reset-clock", CLOCK_RESET_COMMAND);
|
||||
}
|
||||
|
||||
const generator = root.querySelector('[data-role="url-generator"]');
|
||||
if (generator) {
|
||||
@@ -846,6 +864,8 @@
|
||||
});
|
||||
});
|
||||
|
||||
if (!showTest) return;
|
||||
|
||||
function render() {
|
||||
const nowMs = Date.now();
|
||||
const phase = phaseAt(config, nowMs);
|
||||
@@ -956,6 +976,7 @@
|
||||
presetEyebrow: presetEyebrow,
|
||||
validateTimeZone: validateTimeZone,
|
||||
browserTimeZone: browserTimeZone,
|
||||
hasPresetParameters: hasPresetParameters,
|
||||
supportedTimeZones: supportedTimeZones,
|
||||
phaseAt: phaseAt,
|
||||
remainingMinutes: remainingMinutes,
|
||||
|
||||
+21
-19
@@ -1,19 +1,15 @@
|
||||
# <span data-role="preset-test-page-title">Default temporary radio test · 910.1 MHz · September 21–23, 2026</span>
|
||||
# <span data-role="preset-test-page-title">Temporary radio test builder</span>
|
||||
|
||||
Use this page to join the shared temporary radio test without overwriting the
|
||||
node's saved primary radio settings. <span data-role="preset-test-page-summary">The
|
||||
default window is <strong>Monday, September 21, 2026 at 5:00 PM through
|
||||
Wednesday, September 23 at 5:00 PM Pacific time</strong> (48 hours), using
|
||||
<strong>910.1 MHz, 500 kHz, SF8, CR7</strong>.</span>
|
||||
<span data-role="preset-test-page-summary">Choose a window and radio tuple to
|
||||
create a shareable temporary-radio test URL.</span>
|
||||
|
||||
The page reads the complete test definition from its URL. Change the query
|
||||
parameters to reuse it for a different window, display time zone, or radio
|
||||
tuple; no source edit is required.
|
||||
Open a generated URL to see that test's status, instructions, and commands.
|
||||
|
||||
<div class="preset-test" data-preset-test>
|
||||
<div class="preset-test-error" data-role="config-error" role="alert" hidden></div>
|
||||
|
||||
<div data-role="content">
|
||||
<div data-role="test-content" hidden>
|
||||
<section class="preset-test-hero" aria-labelledby="preset-test-title">
|
||||
<p class="preset-test-eyebrow" data-role="preset-test-eyebrow">MeshCore · default 48-hour temporary preset test</p>
|
||||
<div class="preset-test-hero-row">
|
||||
@@ -288,10 +284,12 @@ clock</code></pre>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
<section aria-labelledby="share-title">
|
||||
<details class="preset-test-generator-disclosure">
|
||||
<details class="preset-test-generator-disclosure" data-role="url-builder-disclosure" open>
|
||||
<summary>
|
||||
<h2 id="share-title">Build a link for another test</h2>
|
||||
<h2 id="share-title">Build a temporary radio test URL</h2>
|
||||
</summary>
|
||||
<div class="preset-test-generator-disclosure-body">
|
||||
<p>
|
||||
@@ -412,13 +410,17 @@ clock</code></pre>
|
||||
</div>
|
||||
</details>
|
||||
</section>
|
||||
|
||||
<div data-role="test-content-footer" hidden>
|
||||
<p>
|
||||
Primary <code>tempradioat</code> scheduling is implemented by the Simple
|
||||
Repeater role; room-server and sensor roles use their immediate
|
||||
<code>tempradio</code> command during the setup window. The Companion
|
||||
scheduling commands require current full-parser firmware, and
|
||||
<code>tempradio2</code> and <code>tempradioat2</code> require a build with
|
||||
dual-radio-profile support. If a node reports an unknown command, use only
|
||||
a method that its installed firmware documents.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Primary <code>tempradioat</code> scheduling is implemented by the Simple Repeater
|
||||
role; room-server and sensor roles use their immediate <code>tempradio</code>
|
||||
command during the setup window. The Companion scheduling commands require
|
||||
current full-parser firmware, and
|
||||
<code>tempradio2</code> and <code>tempradioat2</code> require a build with
|
||||
dual-radio-profile support. If a node reports an unknown command, use only a
|
||||
method that its installed firmware documents.
|
||||
+1
-1
@@ -30,4 +30,4 @@ extra_javascript:
|
||||
- _javascript/telemetry_decoder.js
|
||||
- _javascript/management_decoder.js
|
||||
- _javascript/filter_tool.js
|
||||
- _javascript/preset_test.js?v=20260921-1
|
||||
- _javascript/preset_test.js?v=20260921-2
|
||||
@@ -11,11 +11,9 @@ assert.match(pageSource, /data-role="preset-test-eyebrow"/);
|
||||
assert.match(pageSource, /data-role="timezone-map"/);
|
||||
assert.match(pageSource, /type="hidden" name="tz"/);
|
||||
assert.doesNotMatch(pageSource, /<select name="tz"/);
|
||||
assert.match(pageSource, /<details class="preset-test-generator-disclosure">/);
|
||||
assert.doesNotMatch(
|
||||
pageSource,
|
||||
/<details class="preset-test-generator-disclosure"\s+open/
|
||||
);
|
||||
assert.match(pageSource, /data-role="test-content" hidden/);
|
||||
assert.match(pageSource, /data-role="test-content-footer" hidden/);
|
||||
assert.match(pageSource, /data-role="url-builder-disclosure" open/);
|
||||
assert.match(pageSource, /data-command="primary-scheduled"/);
|
||||
assert.match(pageSource, /data-command="primary-cancel"/);
|
||||
assert.match(pageSource, /Simple Repeater primary radio/);
|
||||
@@ -30,6 +28,13 @@ const query =
|
||||
const config = tool.configFromSearch(query);
|
||||
const defaults = tool.configFromSearch("", "America/Los_Angeles");
|
||||
|
||||
assert.strictEqual(tool.hasPresetParameters(""), false);
|
||||
assert.strictEqual(tool.hasPresetParameters("?"), false);
|
||||
assert.strictEqual(tool.hasPresetParameters("?utm_source=example"), false);
|
||||
assert.strictEqual(tool.hasPresetParameters("?freq=911.3"), true);
|
||||
assert.strictEqual(tool.hasPresetParameters("?tz=UTC"), true);
|
||||
assert.strictEqual(tool.hasPresetParameters("?start=bad"), true);
|
||||
|
||||
assert.strictEqual(config.startEpoch, 1790035200);
|
||||
assert.strictEqual(config.endEpoch, 1790208000);
|
||||
assert.strictEqual(config.endEpoch - config.startEpoch, 48 * 60 * 60);
|
||||
|
||||
Reference in new issue
Block a user