espruino / Espruino

The Espruino JavaScript interpreter - Official Repo
http://www.espruino.com/
Other
2.8k stars 748 forks source link

Stepper/Waveform to use EV_CUSTOM events #2576

Open gfwilliams opened 1 week ago

gfwilliams commented 1 week ago

I just added EV_CUSTOM which allows us to poke stuff into the IO FIFO

Right now for Waveform and Stepper we actually just poll any active waveform/stepper timer tasks on idle, but now we should be able to send events from the timer task directly instead.

Best way to do this would be to add something to build_jswrapper to allow custom JSON to handle a specific EV_CUSTOM enum

But we also have the issue of knowing which Waveform/stepper the event is for. This goes back to https://github.com/espruino/Espruino/issues/1444 where ideally each timer task should have a specific index that doesn't change

gfwilliams commented 1 week ago

EV_CUSTOM event handler now added with 4a028755048c0264462a6bd4fddcf64610bcc281

So now we're just waiting on #1444 to ensure the tasks can have a unique ID

edit: Actually we could just have jstimer push a EVC_TIMER event and then handle that rather than polling in the idle loop?