microsoft / microcode

Coding "on the go" with the micro:bit (V2)
https://microsoft.github.io/microcode
MIT License
47 stars 18 forks source link

send 2 events for wall / line det3ector? #456

Closed pelikhan closed 11 months ago

pelikhan commented 11 months ago

@tballmsft can the robot send 2 radio messages for events? is it going to be an issue with the interpreter?

tballmsft commented 11 months ago

Don't know - try it out - depends on what Michal does in the runtime.

pelikhan commented 11 months ago

@mmoskal question for you

mmoskal commented 11 months ago

At the Jacdac level it works - two Jacdac packets will be generated. Now, the code for the rule will be triggered twice in quick succession, so you need to make sure there is no race there. In particular you should not be doing async stuff in role dispatcher.

pelikhan commented 11 months ago

I am thinking about reception, what happens when you trigger twice a rule, do you cancel one?


From: Michał Moskal @.> Sent: Wednesday, October 18, 2023 1:00:11 PM To: microsoft/microcode @.> Cc: Author @.>; Comment @.>; Assign @.>; Subscribed @.> Subject: Re: [microsoft/microcode] send 2 events for wall / line det3ector? (Issue #456)

At the Jacdac level it works - two Jacdac packets will be generated. Now, the code for the rule will be triggered twice in quick succession, so you need to make sure there is no race there. In particular you should not be doing async stuff in role dispatcher.

— Reply to this email directly, view it on GitHubhttps://github.com/microsoft/microcode/issues/456#issuecomment-1769231312 or unsubscribehttps://github.com/notifications/unsubscribe-auth/AA73QKPLGQVSUEG3FHGHQG3YAAYMZBFKMF2HI4TJMJ2XIZLTSOBKK5TBNR2WLJDUOJ2WLJDOMFWWLO3UNBZGKYLEL5YGC4TUNFRWS4DBNZ2F6YLDORUXM2LUPGBKK5TBNR2WLJDUOJ2WLJDOMFWWLLTXMF2GG2C7MFRXI2LWNF2HTAVFOZQWY5LFUVUXG43VMWSG4YLNMWVXI2DSMVQWIX3UPFYGLLDTOVRGUZLDORPXI6LQMWWES43TOVSUG33NNVSW45FGORXXA2LDOOJIFJDUPFYGLKTSMVYG643JORXXE6NFOZQWY5LFVEZTEOBXGMZDOMBWQKSHI6LQMWSWS43TOVS2K5TBNR2WLKRRHE2DQNZVGAZTSN5HORZGSZ3HMVZKMY3SMVQXIZI. You are receiving this email because you authored the thread.

Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

mmoskal commented 11 months ago

Rule bodies are emitted as separate procedures. They are invoked with BG_MAX1 meaning if the procedure is already running it is not started again. So the second packet would be ignored.