debug(dvk): trace the auto-CQ loop into the app log
It keeps 'not repeating' on a network rig and every guess at which guard was tripping proved wrong. Each round now logs play / playing-flag / end / gap, and every exit names its reason.
This commit is contained in:
+13
-3
@@ -1746,19 +1746,29 @@ export default function App() {
|
||||
const gen = ++dvkAutoCqGenRef.current;
|
||||
dvkAutoCqSlotRef.current = slot;
|
||||
const sleep = (ms: number) => new Promise((r) => window.setTimeout(r, ms));
|
||||
// Traced into the app log deliberately: the loop kept 'not repeating' on a
|
||||
// network rig and every guess at which guard was tripping proved wrong.
|
||||
const trace = (m: string) => UILog().catch(() => {});
|
||||
trace();
|
||||
let round = 0;
|
||||
while (dvkAutoCqSlotRef.current === slot && gen === dvkAutoCqGenRef.current && dvkActiveRef.current) {
|
||||
// An EMPTY mode is not a mode change: over the network the rig's mode
|
||||
// read fails transiently and the CAT push blanks the field for a poll or
|
||||
// two — killing the auto-CQ loop mid-run for nothing. Only a known
|
||||
// non-phone mode stops the loop.
|
||||
if (modeRef.current && !isPhoneMode(modeRef.current)) { stopDvkAutoCq(); break; }
|
||||
await DVKPlay(slot).catch(() => {});
|
||||
if (modeRef.current && !isPhoneMode(modeRef.current)) { trace(); stopDvkAutoCq(); break; }
|
||||
round++;
|
||||
trace();
|
||||
await DVKPlay(slot).catch((e: any) => trace());
|
||||
await sleep(300); // let playback flip "playing" true
|
||||
trace();
|
||||
let guard = 0; // then wait for it to finish (cap ~90 s)
|
||||
while (dvkPlayingRef.current && gen === dvkAutoCqGenRef.current && guard < 600) { await sleep(150); guard++; }
|
||||
if (gen !== dvkAutoCqGenRef.current) break;
|
||||
if (gen !== dvkAutoCqGenRef.current) { trace(); break; }
|
||||
trace();
|
||||
await sleep(Math.max(0, dvkAutoCqSecsRef.current) * 1000); // gap before the next CQ
|
||||
}
|
||||
trace();
|
||||
}
|
||||
const dvkPlay = useCallback((slot: number) => {
|
||||
if (!isPhoneMode(modeRef.current)) { setError(t('dvkp.notPhone')); return; }
|
||||
|
||||
Reference in New Issue
Block a user