mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-13 11:29:58 +03:00
MSP Range finder added (#13980)
* MSP Range Finder added (configured and tested on the MTF-01P Lidar) * MSP Range Finder added (configured and tested on the MTF-01P Lidar) * fix the license of the added files from INAV * Update src/main/drivers/rangefinder/rangefinder_virtual.c Co-authored-by: Mark Haslinghuis <mark@numloq.nl> * Update src/main/msp/msp.c Co-authored-by: Mark Haslinghuis <mark@numloq.nl> * Update src/main/io/rangefinder.h Co-authored-by: Mark Haslinghuis <mark@numloq.nl> * Update src/main/msp/msp.c Co-authored-by: Mark Haslinghuis <mark@numloq.nl> * refactored the code of INAV for the MSP rangefinder, to be extendable to other MSP rangefinder and more specific about the parameters of the supported ones * Update src/main/drivers/rangefinder/rangefinder_lidarmt.c Co-authored-by: Petr Ledvina <ledvinap@gmail.com> * Update src/main/drivers/rangefinder/rangefinder_lidarmt.c Co-authored-by: Petr Ledvina <ledvinap@gmail.com> * refactored the code for readability * mt lidar msp address * us the delay MS from the dev directly * todo * MT device type datatype * refactored the code for readability * spacing * refactoring Co-authored-by: Petr Ledvina <ledvinap@gmail.com> * refactoring Co-authored-by: Petr Ledvina <ledvinap@gmail.com> * refactoring Co-authored-by: Petr Ledvina <ledvinap@gmail.com> * refactoring Co-authored-by: Petr Ledvina <ledvinap@gmail.com> * refactoring Co-authored-by: Petr Ledvina <ledvinap@gmail.com> * refactoring Co-authored-by: Petr Ledvina <ledvinap@gmail.com> * refactoring Co-authored-by: Petr Ledvina <ledvinap@gmail.com> * refactoring Co-authored-by: Petr Ledvina <ledvinap@gmail.com> * after the edits fix * rm idx * typo fixed * i think this shouldn't be here * spacing * Update src/main/drivers/rangefinder/rangefinder_lidarmt.c Co-authored-by: Petr Ledvina <ledvinap@gmail.com> * fix mt models ranges * remove mt01p model, it doesn't map * rm "MT01P", it doesn't support map * rm mt01p, it doesn't support msp * Update rangefinder_lidarmt.h * update mt lidar deadzone * Update rangefinder_lidarmt.c * Update rangefinder_lidarmt.c * rm unused variable mtfConnected --------- Co-authored-by: Mark Haslinghuis <mark@numloq.nl> Co-authored-by: Petr Ledvina <ledvinap@gmail.com>
This commit is contained in:
parent
778f93f119
commit
b70e98ed5a
8 changed files with 177 additions and 2 deletions
|
@ -71,6 +71,7 @@
|
|||
#include "drivers/usb_msc.h"
|
||||
#include "drivers/vtx_common.h"
|
||||
#include "drivers/vtx_table.h"
|
||||
#include "drivers/rangefinder/rangefinder_lidarmt.h"
|
||||
|
||||
#include "fc/board_info.h"
|
||||
#include "fc/controlrate_profile.h"
|
||||
|
@ -3294,8 +3295,13 @@ static mspResult_e mspProcessInCommand(mspDescriptor_t srcDesc, int16_t cmdMSP,
|
|||
#else
|
||||
sbufReadU8(src);
|
||||
#endif
|
||||
break;
|
||||
|
||||
#ifdef USE_RANGEFINDER
|
||||
rangefinderConfigMutable()->rangefinder_hardware = sbufReadU8(src);
|
||||
#else
|
||||
sbufReadU8(src); // rangefinder hardware
|
||||
#endif
|
||||
break;
|
||||
#ifdef USE_ACC
|
||||
case MSP_ACC_CALIBRATION:
|
||||
if (!ARMING_FLAG(ARMED))
|
||||
|
@ -3646,6 +3652,11 @@ static mspResult_e mspProcessInCommand(mspDescriptor_t srcDesc, int16_t cmdMSP,
|
|||
break;
|
||||
#endif
|
||||
|
||||
#if defined(USE_RANGEFINDER_MT)
|
||||
case MSP2_SENSOR_RANGEFINDER_LIDARMT:
|
||||
mtRangefinderReceiveNewData(sbufPtr(src));
|
||||
break;
|
||||
#endif
|
||||
#ifdef USE_GPS
|
||||
case MSP2_SENSOR_GPS:
|
||||
(void)sbufReadU8(src); // instance
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue