exposing serial number block.

This commit is contained in:
Peli de Halleux
2016-04-28 10:46:03 -07:00
parent cdb23fffb6
commit db0c5d9f9f
5 changed files with 63 additions and 5 deletions

View File

@ -233,6 +233,13 @@ namespace pxsim.control {
? b.id.slice(0, 4)
: 'abcd';
}
export function deviceSerialNumber(): number {
let b = board();
return parseInt(b && b.id
? b.id.slice(1)
: '42');
}
export function onEvent(id: number, evid: number, handler: RefAction) {
pxt.registerWithDal(id, evid, handler)

View File

@ -511,7 +511,7 @@ namespace pxsim {
constructor() {
super()
this.id = "b" + Math.random().toString().slice(1);
this.id = "b" +Math_.random(2147483647);
this.animationQ = new AnimationQueue(runtime);
this.bus = new EventBus(runtime);
this.radio = new RadioBus(runtime);