debug: trace onSerialData setter

This commit is contained in:
David Montero 2026-05-26 16:57:37 +02:00
parent c8d06c9b90
commit 1663236184
1 changed files with 7 additions and 1 deletions

View File

@ -301,7 +301,13 @@ export class AVRSimulator {
private scheduledPinChanges: Array<{ cycle: number; pin: number; state: boolean }> = [];
/** Serial output buffer — subscribers receive each byte or line */
public onSerialData: ((char: string) => void) | null = null;
private _onSerialData: ((char: string) => void) | null = null;
public get onSerialData(): ((char: string) => void) | null { return this._onSerialData; }
public set onSerialData(v: ((char: string) => void) | null) {
const who = new Error().stack?.split('\n').slice(1, 6).join(' | ');
console.log('[AVR-DBG] onSerialData SET (fn?', typeof v === 'function', ') from', who);
this._onSerialData = v;
}
/** Fires whenever the sketch changes Serial baud rate (Serial.begin) */
public onBaudRateChange: ((baudRate: number) => void) | null = null;
/**