Closed seikosantana closed 6 months ago
mb.cbDisable();
mb.Hreg(REV, VALUE);
mb.cbEnable();
Or safer variant
bool saved_state = mb.cbEnable(false);
mb.Hreg(REV, VALUE);
mb.cbEnable(saved_state);
Is it safe to call those in a callback itself (inside an onSet)?
Sure.
Thanks a lot for your response and effort on the library 😀
Hi, is there a way to update register value without triggering the onSetCoil / onSetHreg? I am trying to integrate modbus into existing working program so that it can interface with modbus, but the problem is when I use onSetCoil/onSetHreg to handle incoming requests, and have my program to update the registers to represent the current state, it fires the callbacks too, causing recursive calls or long loops.
Do you have any tips or workarounds for this kind of situation? Thanks in advance