Send want_config_id on connect to trigger initial sync (#6)
CI / build + unit (push) Successful in 39s
CI / build + unit (push) Successful in 39s
Send want_config_id on connect to trigger initial sync (#6) Firmware only streams myInfo/channels/configComplete after receiving a ToRadio with want_config_id — the service previously wrote nothing on connect, so /api/channels stayed [] and myNodeNum null. v0.1.4.
This commit was merged in pull request #6.
This commit is contained in:
@@ -9,8 +9,10 @@ import * as net from 'node:net';
|
||||
import {
|
||||
PORT_TEXT_MESSAGE_APP,
|
||||
buildTextToRadio,
|
||||
buildWantConfigToRadio,
|
||||
decodeFromRadio,
|
||||
extractFrames,
|
||||
frame,
|
||||
} from './codec.js';
|
||||
|
||||
@Injectable()
|
||||
@@ -94,6 +96,13 @@ export class MeshService implements OnModuleInit, OnModuleDestroy {
|
||||
// fresh sync on every (re)connect — drop stale channels from the old session
|
||||
this.channelMap = new Map();
|
||||
this.logger.log(`bridge connected ${this.host}:${this.port}`);
|
||||
const nonce = Math.floor(Math.random() * 0xffffffff) || 1;
|
||||
buildWantConfigToRadio(nonce)
|
||||
.then((bytes) => socket.write(frame(bytes)))
|
||||
.catch((err: unknown) =>
|
||||
this.logger.error(`want_config failed: ${String(err)}`),
|
||||
);
|
||||
this.logger.log(`requested initial sync (want_config_id=${nonce})`);
|
||||
});
|
||||
socket.on('data', (chunk) => {
|
||||
const merged = new Uint8Array(this.buffer.length + chunk.length);
|
||||
|
||||
Reference in New Issue
Block a user