Closed StephenCatsamas closed 1 month ago
A more elegant fix for this should be to immediately set the line to listen immediately after the command processing is done as it does not utilize another whole cycle before the mcu process the command. I'm currently working on a more compliant end node support but i haven't finished yet. Still in the testing phase, the following is a snippet which precludes another process cycle.
if (charReceived == '!') {
// eliminate the chance of getting anything else after the '!'
slaveSDI12.forceHold();
// Command string is completed; do something with it
parseSdi12Cmd(commandReceived, dValues);
slaveSDI12.forceListen(); // Immediately release line after parsing
// Clear command string to reset for next command
commandReceived = "";
// '!' should be the last available character anyway, but exit the "for"
// loop just in case there are any stray characters
slaveSDI12.clearBuffer();
break;
} else {
This pull request fixes an issue in example: h_SDI-12_slave_implementation.ino
Previously sending some commands (eg: 5!) would lead to a call of forceHold() without a call to forceListen(). This would send the slave into an unresponsive state.