jasoneflood / jaymarine

An Open Alternative To Marine Solutions
Apache License 2.0
1 stars 0 forks source link

Timers Delays and Interrupts #8

Open markdeegan opened 3 days ago

markdeegan commented 3 days ago

I don’t like using the delay() function if I can avoid it. Particularly not in something networked, that might have its’ own timeout behaviours. So, I’m going to look at anywhere that is used and seek to replace the actions (usually switching an LED on or off, or changing colours) to interrupt-driven so that the delay() does not actually delay the main loop or any other methods it might6 call.

jasoneflood commented 2 days ago

Keep in mind I think the main loop needs a delay on sockets etc - otherwise it just hammers webservices with requests at a faster rate than the chip can potentially send them. So you may need a semiphore or something - or you could end up stacking the requests in your interupt. Regardless I'd be interested to see how that investigation on interupts plays out. Could be a powerful addition to the workflow.

markdeegan commented 23 hours ago

Sure. I undertand that timing for networtking is important. I don't want to add to the timing issues with trvialities like flashing LEDs etc. I'd rather one or other, both even, if appropriate, of those functions is pushed to interrupt-driven as opposed to polling and potentially blocking things wiht a delay() call.

markdeegan commented 23 hours ago

I have previously written timing stuff that uses either traditional delay() functions, or is completely interrupt-driven. The latter can be very useful.