I am building a product which reads from and sends commands to Control Unit board via RS485 bus.
The Control Unit boards each control up to 16 actuators/sensors and can be daisy chained. I envisage maximum of 3 Control Boards on the RS485 bus.
Due to the way the Control Unit board controller works, simple reading of the status of actuators/sensors can take 400mSec. I am trying to be as responsive as possible to a change in sensor value. Currently I check the sensors values every second from the application loop(). However, this is causing problems with other things such as recognising button presses (read from a GPIO expander) with only 1 CU board.
I am wondering what the best solution is. I have already spun out control of addressable LED strip to a co-MCU controlled via I2C. I did this because controlling the LEDs to flash resulted in very uneven timing. One option might be to do the same for the control/reading status of the CU boards. I not so keen on this having just gone through design on the board for this. Another might be to use a specific thread for the RS485 comms and decouple the application thread. Has anyone got any advice about how best to setup the thread or examples I could study of solutions doing the same?
I already have one separate thread running the PublishQueueAsyncRK library and not a lot of spare RAM.