Skip to content

Commit ebf5036

Browse files
author
gabrielsan
authored
minor fixes when using softserial
wrong comparison on init fixed default cases when using transfer control pin fix
1 parent 8321f2d commit ebf5036

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

ModbusRtu.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,7 @@ int8_t Modbus::poll( uint16_t *regs, uint8_t u8size )
821821
void Modbus::init(uint8_t u8id, uint8_t u8serno, uint8_t u8txenpin)
822822
{
823823
this->u8id = u8id;
824-
this->u8serno = (u8serno > 3) ? 0 : u8serno;
824+
this->u8serno = u8serno;
825825
this->u8txenpin = u8txenpin;
826826
this->u16timeOut = 1000;
827827
}
@@ -920,9 +920,10 @@ void Modbus::sendTxBuffer()
920920
break;
921921
#endif
922922
case 0:
923-
default:
924923
UCSR0A=UCSR0A |(1 << TXC0);
925924
break;
925+
default:
926+
break;
926927
}
927928
digitalWrite( u8txenpin, HIGH );
928929
}
@@ -956,9 +957,10 @@ void Modbus::sendTxBuffer()
956957
break;
957958
#endif
958959
case 0:
959-
default:
960960
while (!(UCSR0A & (1 << TXC0)));
961961
break;
962+
default:
963+
break;
962964
}
963965

964966
// return RS485 transceiver to receive mode

0 commit comments

Comments
 (0)