EnviroDIY / Arduino-SDI-12

An Arduino library for SDI-12 communication with a wide variety of environmental sensors. This library provides a general software solution, without requiring any additional hardware.
https://github.com/EnviroDIY/Arduino-SDI-12/wiki
BSD 3-Clause "New" or "Revised" License
164 stars 100 forks source link

Buffer size of 64 is too small for a complete response. #63

Open peterj43 opened 4 years ago

peterj43 commented 4 years ago

I have been using the example code (h_SDI-12_slave and f_basic-data request) and find if I issue a "aC!" command followed by a "aD0" I do not receive all the character in the response. As the maximum length of the values is 75 long

+ + + I would expect the max buffer size to be at least 79 chars long. I have tested increasing the buffer and I now receive the full response. I am performing e2e test on an Arduino MKRWifi1010 and ESP32.

Kevin-M-Smith commented 4 years ago

Good point, according to the latest specification, section 4.4, the response to a "Continuous Measurements and Request CRC" command is:

a<values><CRC><CR><LF>

where:

suggesting the buffer should accommodate 81 characters.

Kevin-M-Smith commented 4 years ago

I believe the current value of 64 bytes for the buffer was merely for consistency with the hardware serial buffer limit on the Arduino Uno - I think it should just work to increase it.

Looking forward to the results of your end-to-end tests.

SRGDamia1 commented 4 years ago

PR merged. I'm leaving this open until I add the if's that I want around it.