AP_RangeFinder_MaxsonarI2CXL: resolve shadowed variable compiler warning
This commit is contained in:
parent
fddfb0b1a3
commit
f68523b39b
@ -23,6 +23,7 @@
|
||||
|
||||
// AVR LibC Includes
|
||||
#include <AP_Common.h>
|
||||
#include <I2C.h> // Arduino I2C lib
|
||||
#include "AP_RangeFinder_MaxsonarI2CXL.h"
|
||||
|
||||
// Constructor //////////////////////////////////////////////////////////////
|
||||
@ -55,16 +56,16 @@ bool AP_RangeFinder_MaxsonarI2CXL::take_reading()
|
||||
int AP_RangeFinder_MaxsonarI2CXL::read()
|
||||
{
|
||||
uint8_t buff[2];
|
||||
int16_t distance = 0;
|
||||
int16_t ret_value = 0;
|
||||
|
||||
// take range reading and read back results
|
||||
if (I2c.read(_addr, 2, buff) != 0) {
|
||||
healthy = false;
|
||||
}else{
|
||||
// combine results into distance
|
||||
distance = buff[0] << 8 | buff[1];
|
||||
ret_value = buff[0] << 8 | buff[1];
|
||||
healthy = true;
|
||||
}
|
||||
|
||||
return distance;
|
||||
return ret_value;
|
||||
}
|
@ -1,10 +1,9 @@
|
||||
#ifndef RangeFinder_h
|
||||
#define RangeFinder_h
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <inttypes.h>
|
||||
#include "../AP_AnalogSource/AP_AnalogSource.h"
|
||||
#include "../Filter/Filter.h" // Filter library
|
||||
#include <AP_Common.h>
|
||||
#include <AP_AnalogSource.h>
|
||||
#include <Filter.h> // Filter library
|
||||
|
||||
/*
|
||||
* #define AP_RANGEFINDER_ORIENTATION_FRONT 0, 10, 0
|
||||
|
Loading…
Reference in New Issue
Block a user