mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-13 19:40:27 +03:00
Merge pull request #10405 from error414/change-gimbal-sensitivity-from-programming-framework
Change gimbal sensitivity from programming framework
This commit is contained in:
commit
fb319527c5
6 changed files with 23 additions and 1 deletions
|
@ -101,6 +101,7 @@ IPF can be edited using INAV Configurator user interface, or via CLI. To use COn
|
||||||
| 52 | LED Pin PWM | Value `Operand A` from [`0` : `100`] starts PWM generation on LED Pin. See [LED pin PWM](LED%20pin%20PWM.md). Any other value stops PWM generation (stop to allow ws2812 LEDs updates in shared modes). |
|
| 52 | LED Pin PWM | Value `Operand A` from [`0` : `100`] starts PWM generation on LED Pin. See [LED pin PWM](LED%20pin%20PWM.md). Any other value stops PWM generation (stop to allow ws2812 LEDs updates in shared modes). |
|
||||||
| 53 | Disable GPS Sensor Fix | Disables the GNSS sensor fix. For testing GNSS failure. |
|
| 53 | Disable GPS Sensor Fix | Disables the GNSS sensor fix. For testing GNSS failure. |
|
||||||
| 54 | Mag calibration | Trigger a magnetometer calibration. |
|
| 54 | Mag calibration | Trigger a magnetometer calibration. |
|
||||||
|
| 55 | Set Gimbal Sensitivity | Scales `Operand A` from [`-16` : `15`]
|
||||||
|
|
||||||
### Operands
|
### Operands
|
||||||
|
|
||||||
|
|
|
@ -89,6 +89,11 @@ bool gimbalCommonIsReady(gimbalDevice_t *gimbalDevice)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setGimbalSensitivity(int16_t sensitivity)
|
||||||
|
{
|
||||||
|
gimbalConfigMutable()->sensitivity = sensitivity;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef GIMBAL_UNIT_TEST
|
#ifdef GIMBAL_UNIT_TEST
|
||||||
void taskUpdateGimbal(timeUs_t currentTimeUs)
|
void taskUpdateGimbal(timeUs_t currentTimeUs)
|
||||||
{
|
{
|
||||||
|
|
|
@ -96,6 +96,7 @@ bool gimbalCommonIsEnabled(void);
|
||||||
bool gimbalCommonHtrkIsEnabled(void);
|
bool gimbalCommonHtrkIsEnabled(void);
|
||||||
|
|
||||||
int16_t gimbalCommonGetPanPwm(const gimbalDevice_t *gimbalDevice);
|
int16_t gimbalCommonGetPanPwm(const gimbalDevice_t *gimbalDevice);
|
||||||
|
void setGimbalSensitivity(int16_t sensitivity);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -4319,18 +4319,21 @@ groups:
|
||||||
field: sensitivity
|
field: sensitivity
|
||||||
min: -16
|
min: -16
|
||||||
max: 15
|
max: 15
|
||||||
|
type: int8_t
|
||||||
- name: gimbal_pan_trim
|
- name: gimbal_pan_trim
|
||||||
field: panTrim
|
field: panTrim
|
||||||
description: "Trim gimbal pan center position."
|
description: "Trim gimbal pan center position."
|
||||||
default_value: 0
|
default_value: 0
|
||||||
min: -500
|
min: -500
|
||||||
max: 500
|
max: 500
|
||||||
|
type: int16_t
|
||||||
- name: gimbal_tilt_trim
|
- name: gimbal_tilt_trim
|
||||||
field: tiltTrim
|
field: tiltTrim
|
||||||
description: "Trim gimbal tilt center position."
|
description: "Trim gimbal tilt center position."
|
||||||
default_value: 0
|
default_value: 0
|
||||||
min: -500
|
min: -500
|
||||||
max: 500
|
max: 500
|
||||||
|
type: int16_t
|
||||||
- name: gimbal_roll_trim
|
- name: gimbal_roll_trim
|
||||||
field: rollTrim
|
field: rollTrim
|
||||||
description: "Trim gimbal roll center position."
|
description: "Trim gimbal roll center position."
|
||||||
|
|
|
@ -48,6 +48,7 @@
|
||||||
#include "flight/pid.h"
|
#include "flight/pid.h"
|
||||||
#include "flight/mixer_profile.h"
|
#include "flight/mixer_profile.h"
|
||||||
#include "drivers/io_port_expander.h"
|
#include "drivers/io_port_expander.h"
|
||||||
|
#include "drivers/gimbal_common.h"
|
||||||
#include "io/osd_common.h"
|
#include "io/osd_common.h"
|
||||||
#include "sensors/diagnostics.h"
|
#include "sensors/diagnostics.h"
|
||||||
|
|
||||||
|
@ -342,6 +343,16 @@ static int logicConditionCompute(
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
case LOGIC_CONDITION_SET_GIMBAL_SENSITIVITY:
|
||||||
|
#ifdef USE_SERIAL_GIMBAL
|
||||||
|
setGimbalSensitivity(constrain(operandA, SETTING_GIMBAL_SENSITIVITY_MIN, SETTING_GIMBAL_SENSITIVITY_MAX));
|
||||||
|
return true;
|
||||||
|
break;
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
|
||||||
case LOGIC_CONDITION_INVERT_ROLL:
|
case LOGIC_CONDITION_INVERT_ROLL:
|
||||||
LOGIC_CONDITION_GLOBAL_FLAG_ENABLE(LOGIC_CONDITION_GLOBAL_FLAG_OVERRIDE_INVERT_ROLL);
|
LOGIC_CONDITION_GLOBAL_FLAG_ENABLE(LOGIC_CONDITION_GLOBAL_FLAG_OVERRIDE_INVERT_ROLL);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -84,7 +84,8 @@ typedef enum {
|
||||||
LOGIC_CONDITION_LED_PIN_PWM = 52,
|
LOGIC_CONDITION_LED_PIN_PWM = 52,
|
||||||
LOGIC_CONDITION_DISABLE_GPS_FIX = 53,
|
LOGIC_CONDITION_DISABLE_GPS_FIX = 53,
|
||||||
LOGIC_CONDITION_RESET_MAG_CALIBRATION = 54,
|
LOGIC_CONDITION_RESET_MAG_CALIBRATION = 54,
|
||||||
LOGIC_CONDITION_LAST = 55,
|
LOGIC_CONDITION_SET_GIMBAL_SENSITIVITY = 55,
|
||||||
|
LOGIC_CONDITION_LAST = 56,
|
||||||
} logicOperation_e;
|
} logicOperation_e;
|
||||||
|
|
||||||
typedef enum logicOperandType_s {
|
typedef enum logicOperandType_s {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue