mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-13 11:29:58 +03:00
opticalflow mt sensor added (#14038)
* opticalflow mt sensor added * set the processedFlow to raw when no rotation * use sin and cos approximations Co-authored-by: Petr Ledvina <ledvinap@gmail.com> * Update src/main/sensors/opticalflow.c Co-authored-by: Petr Ledvina <ledvinap@gmail.com> * refactoring * not needed anymore * update * Update src/main/sensors/opticalflow.c Co-authored-by: Petr Ledvina <ledvinap@gmail.com> * Update src/main/sensors/opticalflow.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> * update * rm prototype * clean up * Update src/main/drivers/opticalflow/opticalflow.h Co-authored-by: Petr Ledvina <ledvinap@gmail.com> * Update src/main/drivers/opticalflow/opticalflow.h Co-authored-by: Mark Haslinghuis <mark@numloq.nl> * update flip_y * Update src/main/drivers/opticalflow/opticalflow.h Co-authored-by: Petr Ledvina <ledvinap@gmail.com> * Update src/main/drivers/rangefinder/rangefinder_lidarmt.c Co-authored-by: Petr Ledvina <ledvinap@gmail.com> * Update src/main/drivers/rangefinder/rangefinder_lidarmt.h Co-authored-by: Petr Ledvina <ledvinap@gmail.com> * Update src/main/sensors/opticalflow.c Co-authored-by: Petr Ledvina <ledvinap@gmail.com> * Update src/main/sensors/opticalflow.c Co-authored-by: Petr Ledvina <ledvinap@gmail.com> * Update src/main/sensors/opticalflow.c Co-authored-by: Mark Haslinghuis <mark@numloq.nl> * rm casting * update op rotation --------- Co-authored-by: Petr Ledvina <ledvinap@gmail.com> Co-authored-by: Mark Haslinghuis <mark@numloq.nl>
This commit is contained in:
parent
2f21754a69
commit
d244239f39
21 changed files with 490 additions and 21 deletions
|
@ -149,6 +149,7 @@
|
|||
#include "sensors/gyro.h"
|
||||
#include "sensors/gyro_init.h"
|
||||
#include "sensors/rangefinder.h"
|
||||
#include "sensors/opticalflow.h"
|
||||
|
||||
#include "telemetry/msp_shared.h"
|
||||
#include "telemetry/telemetry.h"
|
||||
|
@ -2054,7 +2055,7 @@ case MSP_NAME:
|
|||
break;
|
||||
|
||||
case MSP_SENSOR_CONFIG:
|
||||
// use sensorIndex_e index: 0:GyroHardware, 1:AccHardware, 2:BaroHardware, 3:MagHardware, 4:RangefinderHardware
|
||||
// use sensorIndex_e index: 0:GyroHardware, 1:AccHardware, 2:BaroHardware, 3:MagHardware, 4:RangefinderHardware 5:OpticalflowHardware
|
||||
#if defined(USE_ACC)
|
||||
sbufWriteU8(dst, accelerometerConfig()->acc_hardware);
|
||||
#else
|
||||
|
@ -2076,6 +2077,12 @@ case MSP_NAME:
|
|||
#else
|
||||
sbufWriteU8(dst, RANGEFINDER_NONE);
|
||||
#endif
|
||||
|
||||
#ifdef USE_OPTICALFLOW
|
||||
sbufWriteU8(dst, opticalflowConfig()->opticalflow_hardware);
|
||||
#else
|
||||
sbufWriteU8(dst, OPTICALFLOW_NONE);
|
||||
#endif
|
||||
break;
|
||||
|
||||
// Added in MSP API 1.46
|
||||
|
@ -2107,6 +2114,11 @@ case MSP_NAME:
|
|||
sbufWriteU8(dst, detectedSensors[SENSOR_INDEX_RANGEFINDER]);
|
||||
#else
|
||||
sbufWriteU8(dst, SENSOR_NOT_AVAILABLE);
|
||||
#endif
|
||||
#ifdef USE_OPTICAL_FLOW
|
||||
sbufWriteU8(dst, detectedSensors[SENSOR_INDEX_OPTICALFLOW]);
|
||||
#else
|
||||
sbufWriteU8(dst, SENSOR_NOT_AVAILABLE);
|
||||
#endif
|
||||
break;
|
||||
|
||||
|
@ -3301,7 +3313,13 @@ static mspResult_e mspProcessInCommand(mspDescriptor_t srcDesc, int16_t cmdMSP,
|
|||
#ifdef USE_RANGEFINDER
|
||||
rangefinderConfigMutable()->rangefinder_hardware = sbufReadU8(src);
|
||||
#else
|
||||
sbufReadU8(src); // rangefinder hardware
|
||||
sbufReadU8(src);
|
||||
#endif
|
||||
|
||||
#ifdef USE_OPTICALFLOW
|
||||
opticalflowConfigMutable()->opticalflow_hardware = sbufReadU8(src);
|
||||
#else
|
||||
sbufReadU8(src);
|
||||
#endif
|
||||
break;
|
||||
#ifdef USE_ACC
|
||||
|
@ -3658,7 +3676,12 @@ static mspResult_e mspProcessInCommand(mspDescriptor_t srcDesc, int16_t cmdMSP,
|
|||
case MSP2_SENSOR_RANGEFINDER_LIDARMT:
|
||||
mtRangefinderReceiveNewData(sbufPtr(src));
|
||||
break;
|
||||
|
||||
case MSP2_SENSOR_OPTICALFLOW_MT:
|
||||
mtOpticalflowReceiveNewData(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