Show the fixed radio pins as read-only in the web UI

On the integrated-radio board the firmware replaces any radio pins a client
saves with the board's wiring, yet the web UI let the user edit them and
reported success. The radio settings now carry fixedPins (wire key fx),
sent only where the radio is wired to the board. The web UI disables the six
pin selects, shows "Radio wiring is fixed on this board." and skips the pin
duplicate and boot-pin checks for them. Generic builds do not send the
field, so their behaviour is unchanged, and applyBoardPins() stays as the
safety net for old configs and imports.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
R. Sid Shaytay 2026-11-14 18:41:27 -08:00
parent 31eda550b9
commit 2b3d556729
No known key found for this signature in database
13 changed files with 109 additions and 15 deletions

View file

@ -71,9 +71,40 @@ test('the radio section as the panel binds it, and back', () => {
assert.equal(save.frequency, 433.42);
// Only shown, never saved.
assert.equal('radioInit' in save, false);
assert.equal('fixedPins' in save, false);
assert.equal('type' in save, false);
});
function fakeDocument() {
const els = {};
for (const id of ProtoViews.RADIO_PIN_SELECTS) els[id] = { disabled: false };
els[ProtoViews.RADIO_PINS_NOTE] = { style: { display: 'none' } };
return { els, getElementById: (id) => els[id] || null };
}
test('the radio pins are fixed only where the device says so', () => {
assert.equal(ProtoViews.radio(schema, { bitLength: 80 }).fixedPins, false);
assert.equal(ProtoViews.radio(schema, { bitLength: 80, fixedPins: true }).fixedPins, true);
const fixed = fakeDocument();
ProtoViews.showRadioPins(fixed, ProtoViews.radio(schema, { fixedPins: true }).fixedPins);
assert.equal(ProtoViews.RADIO_PIN_SELECTS.length, 6);
for (const id of ProtoViews.RADIO_PIN_SELECTS) assert.equal(fixed.els[id].disabled, true, id);
assert.equal(fixed.els[ProtoViews.RADIO_PINS_NOTE].style.display, '');
// Without the flag they are editable, and a page that was fixed becomes editable again.
const free = fakeDocument();
ProtoViews.showRadioPins(free, true);
ProtoViews.showRadioPins(free, ProtoViews.radio(schema, {}).fixedPins);
for (const id of ProtoViews.RADIO_PIN_SELECTS) assert.equal(free.els[id].disabled, false, id);
assert.equal(free.els[ProtoViews.RADIO_PINS_NOTE].style.display, 'none');
});
test('every pin select and the note are in the page', () => {
const html = require('node:fs').readFileSync(require('node:path').join(__dirname, '../../data-src/index.html'), 'utf8');
for (const id of ProtoViews.RADIO_PIN_SELECTS.concat(ProtoViews.RADIO_PINS_NOTE)) assert.ok(html.includes(`id="${id}"`), id);
});
test('an op refusal for the error box, with a shade validation code', () => {
assert.deepEqual(ProtoViews.opError('saveShade', { code: 'badRequest', desc: 'Pin in use', data: { validation: -10 } }),
{ htmlError: 'badRequest', service: 'saveShade', desc: 'Pin in use', code: -10 });