Skip to content

Commit 2b057f4

Browse files
committed
chore: change console.debug to console.log to ensure visibility in browser devtools
1 parent dd2c835 commit 2b057f4

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

src/services/fskDecoder.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ export async function startReceiver(onStatus: RxStatusCallback): Promise<() => v
236236
}
237237
}
238238

239-
console.debug(`[RX][SYNC] Offset ${offset}: [${votedPattern.join(',')}]`);
239+
console.log(`[RX][SYNC] Offset ${offset}: [${votedPattern.join(',')}]`);
240240

241241
if (match) return offset;
242242
}
@@ -268,7 +268,7 @@ export async function startReceiver(onStatus: RxStatusCallback): Promise<() => v
268268
phase = 'WAITING_B';
269269
handshakeADetectedAt = Date.now();
270270
handshakeAHoldStart = 0;
271-
console.debug('[RX] Handshake A confirmed (900 Hz). Waiting for B...');
271+
console.log('[RX] Handshake A confirmed (900 Hz). Waiting for B...');
272272
onStatus({ type: 'syncing' });
273273
}
274274
} else {
@@ -285,10 +285,10 @@ export async function startReceiver(onStatus: RxStatusCallback): Promise<() => v
285285
rawPolls.length = 0;
286286
voteBucket.length = 0;
287287
allTrits.length = 0;
288-
console.debug('[RX] Handshake B detected. Scanning for sync preamble (multi-offset)...');
288+
console.log('[RX] Handshake B detected. Scanning for sync preamble (multi-offset)...');
289289
onStatus({ type: 'receiving', chunk: 0, totalChunks: 0 });
290290
} else if (elapsed > windowMs) {
291-
console.debug(`[RX] Handshake B timeout after ${elapsed}ms. Resetting.`);
291+
console.log(`[RX] Handshake B timeout after ${elapsed}ms. Resetting.`);
292292
phase = 'WAITING_A';
293293
onStatus({ type: 'listening' });
294294
}
@@ -302,7 +302,7 @@ export async function startReceiver(onStatus: RxStatusCallback): Promise<() => v
302302
if (rawPolls.length > 0 && rawPolls.length % pollsPerSymbol === 0) {
303303
// Debug: log the rolling raw buffer
304304
const recentRaw = rawPolls.slice(-pollsPerSymbol * 4).map(t => t >= 0 ? t : '.').join('');
305-
console.debug(`[RX][SYNC] Buffer (${rawPolls.length} polls). Recent raw: [${recentRaw}]`);
305+
console.log(`[RX][SYNC] Buffer (${rawPolls.length} polls). Recent raw: [${recentRaw}]`);
306306

307307
const offset = findPreambleOffset();
308308
if (offset >= 0) {
@@ -317,14 +317,14 @@ export async function startReceiver(onStatus: RxStatusCallback): Promise<() => v
317317
// are already the start of data — but since we check every
318318
// pollsPerSymbol polls, there are typically 0 leftover.
319319

320-
console.debug(`[RX] ✅ Preamble found! Phase offset=${offset}, rawPolls=${rawPolls.length}. Data collection aligned.`);
320+
console.log(`[RX] ✅ Preamble found! Phase offset=${offset}, rawPolls=${rawPolls.length}. Data collection aligned.`);
321321
rawPolls.length = 0; // Free memory
322322
}
323323
}
324324

325325
// Timeout: give up and reset.
326326
if (Date.now() - syncStartedAt > SYNC_TIMEOUT_MS) {
327-
console.debug('[RX] Sync preamble timeout. Resetting.');
327+
console.log('[RX] Sync preamble timeout. Resetting.');
328328
phase = 'WAITING_A';
329329
rawPolls.length = 0;
330330
allTrits.length = 0;
@@ -339,7 +339,7 @@ export async function startReceiver(onStatus: RxStatusCallback): Promise<() => v
339339
const winner = commitSymbol();
340340
if (winner >= 0) {
341341
allTrits.push(winner);
342-
console.debug(`[RX] Symbol: trit=${winner}, total=${allTrits.length}`);
342+
console.log(`[RX] Symbol: trit=${winner}, total=${allTrits.length}`);
343343
}
344344

345345
// Minimum trits for smallest possible packet.
@@ -367,7 +367,7 @@ export async function startReceiver(onStatus: RxStatusCallback): Promise<() => v
367367
const packet = parsePacket(raw);
368368

369369
if (packet && packet.crcValid) {
370-
console.debug(`[RX] ✅ Valid packet at offset ${offset}: chunk ${packet.chunkIndex + 1}/${packet.totalChunks}, ${packet.payload.length}B`);
370+
console.log(`[RX] ✅ Valid packet at offset ${offset}: chunk ${packet.chunkIndex + 1}/${packet.totalChunks}, ${packet.payload.length}B`);
371371

372372
if (!receivedPackets.has(packet.chunkIndex)) {
373373
totalExpectedChunks = packet.totalChunks;
@@ -389,7 +389,7 @@ export async function startReceiver(onStatus: RxStatusCallback): Promise<() => v
389389
phase = 'DONE';
390390
const reconstructed = reassemble(receivedPackets, totalExpectedChunks);
391391
const text = bytesToText(reconstructed);
392-
console.debug(`[RX] ✅ Complete! Decoded: "${text}"`);
392+
console.log(`[RX] ✅ Complete! Decoded: "${text}"`);
393393
onStatus({ type: 'complete', text });
394394
stop();
395395
}
@@ -398,7 +398,7 @@ export async function startReceiver(onStatus: RxStatusCallback): Promise<() => v
398398
}
399399

400400
if (!foundPacket && allTrits.length > maxTritsPerPacket * 2) {
401-
console.debug(`[RX] Buffer overflow (${allTrits.length} trits), dropping 1.`);
401+
console.log(`[RX] Buffer overflow (${allTrits.length} trits), dropping 1.`);
402402
allTrits.shift();
403403
}
404404
}

0 commit comments

Comments
 (0)