Register / Login  |  Desktop view  |  Jump to bottom of page

tcMenu Arduinio library » Many fast interrupts

Author: zemens
30/05/2022 16:59:25
Hello! I hope for your advice. I set out making a controller for robertsonics WavTrigger sampler over serial based around tcMenu. Foolishly i chose a NodeMCU as a controller and now i am kind of deep and don't want to swap it. I already made another one using an arduino uno and it went easy. but with this one i am stuck. The catch is that it needs to send serial commands very rapidly and sometimes in very long bursts. I have a i2s oled using u8g2 library, a rotary encoder and an extra back button that i added using "switches". those work fine. then i tried adding a trigger using direct interrupts, switches.. no matter what i try, either the response is too slow or the controller crashes shouting wdt reset when i run those long bursts. would you please help me understand how to approach this?

Author: davetcc
31/05/2022 06:23:56
This is a little outside the scope of the forum but I’ll do my best. The watchdog timer is to ensure that your code yields to the Wi-Fi library every few milliseconds. If you’re not using Wi-Fi one option would be to turn it off.

However, that aside you may need to transfer the serial data in smaller batches yielding between each batch. Maybe you could use a raw (not marshalled) interrupt and fill a circular buffer (SimpleCollections) in the interrupt with the data. Then have either a frequently running task or event that reads the circular buffer and sends data in batches. There’s no magic wand for these cases, but you’ll probably need to check if serial is going to block before calling write using availableForWrite.

Also if you’re using tcMenu with the u8g2 library over i2c ensure the low latency option is ticked.




Register / Login  |  Desktop view  |  Jump to top of page