Skip to content

Commit

Permalink
ulanding radar: update driver for new 2nd gen hardware (#11035)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidaroyer authored and dagar committed Jan 18, 2019
1 parent 658d734 commit f537c98
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/drivers/distance_sensor/ulanding/ulanding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit f537c98

Please sign in to comment.