Arduino-SDI-12 icon indicating copy to clipboard operation
Arduino-SDI-12 copied to clipboard

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

Open peterj43 opened this issue 5 years ago • 3 comments

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

+ <CRC> + <CR> + <LF> 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.

peterj43 avatar May 07 '20 13:05 peterj43

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:

  • a is a single character
  • values has a maximum value of 75 characters.
  • CRC is 3 characters
  • CR is a single character
  • LF is a single character

suggesting the buffer should accommodate 81 characters.

Kevin-M-Smith avatar May 07 '20 13:05 Kevin-M-Smith

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.

Kevin-M-Smith avatar May 07 '20 13:05 Kevin-M-Smith

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

SRGDamia1 avatar May 09 '20 00:05 SRGDamia1