From eaa9c09c2e9ca3a3eb83dcaafdf18af1335359f6 Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Thu, 25 May 2017 07:10:02 -0700 Subject: [PATCH] fix serial number of simulator radio messages --- sim/state/radio.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sim/state/radio.ts b/sim/state/radio.ts index 1d928f6e..2b13ab4a 100644 --- a/sim/state/radio.ts +++ b/sim/state/radio.ts @@ -21,11 +21,12 @@ namespace pxsim { } send(payload: SimulatorRadioPacketPayload) { + const b = board(); Runtime.postMessage({ type: "radiopacket", - rssi: 0, // Not yet supported - serial: board().radioState.bus.transmitSerialNumber ? board().radioState.bus.serial : 0, - time: 0, // Not yet supported + rssi: 70, // Not yet supported + serial: b.radioState.bus.transmitSerialNumber ? pxsim.control.deviceSerialNumber() : 0, + time: new Date().getTime(), payload }) } @@ -49,13 +50,11 @@ namespace pxsim { export class RadioBus { // uint8_t radioDefaultGroup = MICROBIT_RADIO_DEFAULT_GROUP; power = 0; - serial = 0; transmitSerialNumber = false; datagram: RadioDatagram; constructor(private runtime: Runtime) { this.datagram = new RadioDatagram(runtime); - this.serial = Math.floor(Math.random() * Math.pow(2, 32)) - Math.pow(2, 31); // 32 bit signed integer } setTransmitPower(power: number) {