In reset_communication function() a \x03 has to be moved into from reset() function, to be send after flush, reseting input and output buffer.
In reset_communication function() a \x03 has to be moved into from reset() function, to be send after flush, reseting input and output buffer.