I'm sorry that I auto-formatted ModbusRtu.h and as a result the differences between two versions cannot be spotted easily... I didn't mean to...
So the changes are listed as followed.
1) "port->flush();" changed into "while(port->read() >= 0);"
Since Serial.flush() (port->flush(); in ModbusRtu.h line 287, 337, & 827) no longer empties incoming buffer on 1.6 (Arduino.cc : flush() "Waits for the transmission of outgoing serial data to complete. Prior to Arduino 1.0, this instead removed any buffered incoming serial data.), use "while(port->read() >= 0);" instead.
2) software serial compatible
New constructor Modbus::Modbus(uint8_t u8id) and method void Modbus::begin(SoftwareSerial *sPort, long u32speed) that makes using software serial possible.
Also a new method void init(uint8_t u8id); and a few changes that makes old methods compatible with software serial.
I'm sorry that I auto-formatted ModbusRtu.h and as a result the differences between two versions cannot be spotted easily... I didn't mean to... So the changes are listed as followed.
1) "port->flush();" changed into "while(port->read() >= 0);"
Since Serial.flush() (port->flush(); in ModbusRtu.h line 287, 337, & 827) no longer empties incoming buffer on 1.6 (Arduino.cc : flush() "Waits for the transmission of outgoing serial data to complete. Prior to Arduino 1.0, this instead removed any buffered incoming serial data.), use "while(port->read() >= 0);" instead.
2) software serial compatible
New constructor Modbus::Modbus(uint8_t u8id) and method void Modbus::begin(SoftwareSerial *sPort, long u32speed) that makes using software serial possible. Also a new method void init(uint8_t u8id); and a few changes that makes old methods compatible with software serial.