lancaster-university / microbit-dal

http://lancaster-university.github.io/microbit-docs
Other
254 stars 130 forks source link

Delay microbit_panic for 050 / 051 errors #401

Closed microbit-sam closed 5 years ago

microbit-sam commented 5 years ago

This PR delays the microbit_panic call to the requestUpdate() function

A MicroBitAccelerometer / MicroBitCompass object is created rather than a device specific object, this allows the device to fall back to the default requestUpdate() function which now calls microbit_panic()

This function is only called if the user program requests data from the acc / mag, or sets up a listener for an event on the devices. If the program does not use the devices, the object is created but won't trigger the requestUpdate() / microbit_panic()

I've currently only tested this with a C++ build


@finneyj

jaustin commented 5 years ago

@finneyj do you have any thoughts on this approach before we go much further in testing it? Would be good to get this into a MakeCode testing release now v1 is out.

finneyj commented 5 years ago

done.

@microbit-sam - I'm about to dive into a tunnel of teaching until about 2:00... Any chance you can do a few basic tests on master before i get back, then I can tag for you earlier this afternoon?

I've looked thorugh the commit log, and there's nothing much in there, but checking it compiles cleanly and your RADIO patches are good should do the trick, just to derisk things a bit?

microbit-sam commented 5 years ago

Sure, no probs

microbit-sam commented 5 years ago

Works for me! A tag for /beta would be great 😄