Home › Forums › Mayfly Data Logger › Minor Glitch Reading Maxbotix MB7389 with Mayfly › Reply To: Minor Glitch Reading Maxbotix MB7389 with Mayfly
2018-07-25 at 12:38 PM
#12329
I have an update. I think the problem comes from the reading the sensor with SoftwareSerial_ExInts. There is data left in the read buffer after the read. I’m not sure if this is a real fix, but
I have an update. I think the problem comes from the reading the sensor with SoftwareSerial_ExInts. There is data left in the read buffer after the read. I’m not sure if this is a real fix, but it seems to work. There is a section of code in MaxBotixSonar.cpp that reads the six header lines from the sensor, after the power is turned on. I changed it to read 20 lines. This means that it reads everything left in the buffer and you are getting new data.
MS_DBG(F(“Parsing Header Lines from MaxBotix on “), getSensorLocation(), ‘\n’);
for(int i = 0; i < 20; i++)
{
String headerLine = _stream->readStringUntil(‘\r’);
delay(20)
MS_DBG(i, F(” – “), headerLine, F(“\n”));
}