mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-23 00:05:28 +03:00
MAG_HOLD diff limiting and MAG controller refactoring (#195)
* MAGHOLD constrained to 30 degrees * mag_hold_heading_diff_limit CLI setting added to allow custom MAG_HOLD diff limit * magHeading moved to pid.c and real interface created to inject data into it * mag hold controller with current logic moved to pid.c * 2Hz LPF filter added to magHold error to smoothen controller response * variable name changed to clearly state its purpose * LPF filter in MAG_HOLD controller moved after error limiting * yaw_control_direction passed to pidController as argument, mag_hold_heading_diff_limit moved to pidProfile * yaw_control_direction setting removed * pidMagHold translates directly to rotation rate in dps * pidMagHold refactored to the new principles and limiting * name of filter changed to reflect its purpose * HEADING_LOCK mode can be used only when MAG_HOLD is not enabled * compiler warning supressed * new MAG_HOLD defaults, RATE_LIMIT increased to 80dps, MAG_HOLD P to 60 * mag_rate_limit 90dps
This commit is contained in:
parent
a09f07caf2
commit
dd8a8aead5
12 changed files with 154 additions and 82 deletions
|
@ -664,7 +664,6 @@ const clivalue_t valueTable[] = {
|
|||
|
||||
{ "throttle_tilt_comp_str", VAR_UINT8 | PROFILE_VALUE, &masterConfig.profile[0].throttle_tilt_compensation_strength, .config.minmax = { 0, 100 }, 0 },
|
||||
|
||||
{ "yaw_control_direction", VAR_INT8 | MASTER_VALUE, &masterConfig.yaw_control_direction, .config.minmax = { -1, 1 }, 0 },
|
||||
{ "yaw_motor_direction", VAR_INT8 | MASTER_VALUE, &masterConfig.mixerConfig.yaw_motor_direction, .config.minmax = { -1, 1 }, 0 },
|
||||
{ "yaw_jump_prevention_limit", VAR_UINT16 | MASTER_VALUE, &masterConfig.mixerConfig.yaw_jump_prevention_limit, .config.minmax = { YAW_JUMP_PREVENTION_LIMIT_LOW, YAW_JUMP_PREVENTION_LIMIT_HIGH }, 0 },
|
||||
|
||||
|
@ -707,6 +706,7 @@ const clivalue_t valueTable[] = {
|
|||
|
||||
{ "mag_hardware", VAR_UINT8 | MASTER_VALUE, &masterConfig.mag_hardware, .config.minmax = { 0, MAG_MAX }, 0 },
|
||||
{ "mag_declination", VAR_INT16 | PROFILE_VALUE, &masterConfig.profile[0].mag_declination, .config.minmax = { -18000, 18000 }, 0 },
|
||||
{ "mag_hold_rate_limit", VAR_UINT8 | PROFILE_VALUE, &masterConfig.profile[0].pidProfile.mag_hold_rate_limit, .config.minmax = { MAG_HOLD_RATE_LIMIT_MIN, MAG_HOLD_RATE_LIMIT_MAX }, 0 },
|
||||
|
||||
{ "p_pitch", VAR_UINT8 | PROFILE_VALUE, &masterConfig.profile[0].pidProfile.P8[PITCH], .config.minmax = { 0, 200 }, 0 },
|
||||
{ "i_pitch", VAR_UINT8 | PROFILE_VALUE, &masterConfig.profile[0].pidProfile.I8[PITCH], .config.minmax = { 0, 200 }, 0 },
|
||||
|
@ -1830,7 +1830,7 @@ void cliEnter(serialPort_t *serialPort)
|
|||
setPrintfSerialPort(cliPort);
|
||||
cliWriter = bufWriterInit(cliWriteBuffer, sizeof(cliWriteBuffer),
|
||||
(bufWrite_t)serialWriteBufShim, serialPort);
|
||||
|
||||
|
||||
cliPrint("\r\nEntering CLI Mode, type 'exit' to return, or 'help'\r\n");
|
||||
cliPrompt();
|
||||
ENABLE_ARMING_FLAG(PREVENT_ARMING);
|
||||
|
@ -1842,7 +1842,7 @@ static void cliExit(char *cmdline)
|
|||
|
||||
cliPrint("\r\nLeaving CLI mode, unsaved changes lost.\r\n");
|
||||
bufWriterFlush(cliWriter);
|
||||
|
||||
|
||||
*cliBuffer = '\0';
|
||||
bufferIndex = 0;
|
||||
cliMode = 0;
|
||||
|
@ -2558,7 +2558,7 @@ void cliProcess(void)
|
|||
|
||||
// Be a little bit tricky. Flush the last inputs buffer, if any.
|
||||
bufWriterFlush(cliWriter);
|
||||
|
||||
|
||||
while (serialRxBytesWaiting(cliPort)) {
|
||||
uint8_t c = serialRead(cliPort);
|
||||
if (c == '\t' || c == '?') {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue