From d86043193bab3b6715e74ea011188bb0b0c9d92e Mon Sep 17 00:00:00 2001 From: archipelago Date: Wed, 22 Jul 2026 17:35:55 -0400 Subject: [PATCH] feat(mock): mesh.probe-device + manage_radio for the hot-swap modal demo Co-Authored-By: Claude Fable 5 --- neode-ui/mock-backend.js | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/neode-ui/mock-backend.js b/neode-ui/mock-backend.js index 0a3779b0..57433959 100755 --- a/neode-ui/mock-backend.js +++ b/neode-ui/mock-backend.js @@ -2971,6 +2971,7 @@ app.post('/rpc/v1', (req, res) => { region: mc.enabled ? mc.lora_region : null, announce_block_headers: globalThis.__meshHeaders.announce_block_headers, receive_block_headers: globalThis.__meshHeaders.receive_block_headers, + manage_radio: mc.manage_radio !== false, }, }) } @@ -3088,7 +3089,32 @@ app.post('/rpc/v1', (req, res) => { if (params && typeof params.device_kind === 'string') cfg.device_kind = params.device_kind === 'auto' ? null : params.device_kind if (params && typeof params.channel_name === 'string') cfg.channel_name = params.channel_name if (params && typeof params.advert_name === 'string') cfg.advert_name = params.advert_name - return res.json({ result: { configured: true, enabled: cfg.enabled, lora_region: cfg.lora_region, device_kind: cfg.device_kind, ...globalThis.__meshHeaders } }) + // Hot-swap "keep as is" (2026-07-22): false = never write config to the radio. + if (params && typeof params.manage_radio === 'boolean') cfg.manage_radio = params.manage_radio + return res.json({ result: { configured: true, enabled: cfg.enabled, lora_region: cfg.lora_region, device_kind: cfg.device_kind, manage_radio: cfg.manage_radio !== false, ...globalThis.__meshHeaders } }) + } + + // Read-only firmware probe backing the hot-swap device modal's + // current-details card (2026-07-22). Real backend opens the serial + // port; the demo answers instantly with what's "flashed" on the + // Heltec that mesh.status advertises. + case 'mesh.probe-device': { + // 900ms delay lets the modal's "Reading what's on the radio…" spinner show. + setTimeout(() => res.json({ + result: { + path: params?.path || '/dev/ttyUSB0', + kind: 'meshcore', + firmware_version: 'MeshCore v2.3.1', + node_id: 42, + advert_name: 'archy-228', + region: null, + modem_preset: null, + primary_channel: null, + secondary_channel: null, + max_contacts: 100, + }, + }), 900) + return } case 'mesh.send-invoice': {