call receiveNumber in onDataReceived to flush queue if needed (startup race)
fixed simulator issue when event onDataReceived gets raised
This commit is contained in:
@ -517,6 +517,7 @@ namespace pxsim.radio {
|
||||
|
||||
export function onDataReceived(handler: RefAction): void {
|
||||
pxt.registerWithDal(DAL.MICROBIT_ID_RADIO, DAL.MICROBIT_RADIO_EVT_DATAGRAM, handler);
|
||||
radio.receiveNumber();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -72,10 +72,9 @@ namespace pxsim {
|
||||
}
|
||||
|
||||
queue(packet: PacketBuffer) {
|
||||
if (this.datagram.length < 5) {
|
||||
if (this.datagram.length < 4)
|
||||
this.datagram.push(packet);
|
||||
(<Board>runtime.board).bus.queue(DAL.MICROBIT_ID_RADIO, DAL.MICROBIT_RADIO_EVT_DATAGRAM);
|
||||
}
|
||||
(<Board>runtime.board).bus.queue(DAL.MICROBIT_ID_RADIO, DAL.MICROBIT_RADIO_EVT_DATAGRAM);
|
||||
}
|
||||
|
||||
send(buffer: number[] | string) {
|
||||
|
Reference in New Issue
Block a user