ulanding radar: update driver for new 2nd gen hardware (#11035)

This commit is contained in:
Dave Royer
2019-01-18 11:06:34 -06:00
committed by Daniel Agar
parent 658d734068
commit f537c98ca2

View File

@@ -360,8 +360,11 @@ bool Radar::read_and_parse(uint8_t *buf, int len, float *range)
if (is_header_byte(_buf[index])) {
if (no_header_counter >= BUF_LEN / 3 - 1) {
if (ULANDING_VERSION == 1) {
if (((_buf[index + 1] + _buf[index + 2] + _buf[index + 3] + _buf[index + 4])) != (_buf[index + 5])
|| (_buf[index + 1] <= 0)) {
bool checksum_passed = (((_buf[index + 1] + _buf[index + 2] + _buf[index + 3] + _buf[index + 4]) & 0xFF) == _buf[index +
5]);
if (!checksum_passed) {
// checksum failed
ret = false;
break;
}