diff --git a/src/main/cli/settings.c b/src/main/cli/settings.c index b37841fb1..fa3f12add 100644 --- a/src/main/cli/settings.c +++ b/src/main/cli/settings.c @@ -1011,7 +1011,7 @@ const clivalue_t valueTable[] = { { "dterm_cut_lowpass_hz", VAR_UINT8 | PROFILE_VALUE, .config.minmaxUnsigned = { 1, 20 }, PG_PID_PROFILE, offsetof(pidProfile_t, dterm_cut_lowpass_hz) }, #endif - { "motor_output_limit", VAR_UINT8 | PROFILE_VALUE, .config.minmaxUnsigned = { 1, 100 }, PG_PID_PROFILE, offsetof(pidProfile_t, motor_output_limit) }, + { "motor_output_limit", VAR_UINT8 | PROFILE_VALUE, .config.minmaxUnsigned = { MOTOR_OUTPUT_LIMIT_PERCENT_MIN, MOTOR_OUTPUT_LIMIT_PERCENT_MAX }, PG_PID_PROFILE, offsetof(pidProfile_t, motor_output_limit) }, #ifdef USE_LAUNCH_CONTROL { "launch_control_mode", VAR_UINT8 | PROFILE_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_LAUNCH_CONTROL_MODE }, PG_PID_PROFILE, offsetof(pidProfile_t, launchControlMode) }, diff --git a/src/main/cms/cms_menu_imu.c b/src/main/cms/cms_menu_imu.c index f09a346d7..b2c9be281 100644 --- a/src/main/cms/cms_menu_imu.c +++ b/src/main/cms/cms_menu_imu.c @@ -39,16 +39,19 @@ #include "common/utils.h" #include "config/feature.h" -#include "pg/pg.h" + +#include "drivers/pwm_output.h" #include "fc/config.h" -#include "fc/core.h" #include "fc/controlrate_profile.h" +#include "fc/core.h" #include "fc/rc_controls.h" #include "fc/runtime_config.h" #include "flight/pid.h" +#include "pg/pg.h" + #include "sensors/gyro.h" @@ -322,6 +325,7 @@ static uint8_t cmsx_horizonTransition; static uint8_t cmsx_throttleBoost; static uint16_t cmsx_itermAcceleratorGain; static uint16_t cmsx_itermThrottleThreshold; +static uint8_t cmsx_motorOutputLimit; static long cmsx_profileOtherOnEnter(void) { @@ -339,6 +343,7 @@ static long cmsx_profileOtherOnEnter(void) cmsx_itermThrottleThreshold = pidProfile->itermThrottleThreshold; cmsx_throttleBoost = pidProfile->throttle_boost; + cmsx_motorOutputLimit = pidProfile->motor_output_limit; return 0; } @@ -359,6 +364,7 @@ static long cmsx_profileOtherOnExit(const OSD_Entry *self) pidProfile->itermThrottleThreshold = cmsx_itermThrottleThreshold; pidProfile->throttle_boost = cmsx_throttleBoost; + pidProfile->motor_output_limit = cmsx_motorOutputLimit; return 0; } @@ -378,7 +384,7 @@ static OSD_Entry cmsx_menuProfileOtherEntries[] = { #ifdef USE_LAUNCH_CONTROL {"LAUNCH CONTROL", OME_Submenu, cmsMenuChange, &cmsx_menuLaunchControl, 0 }, #endif - + { "MTR OUT LIM %",OME_UINT8, NULL, &(OSD_UINT8_t) { &cmsx_motorOutputLimit, MOTOR_OUTPUT_LIMIT_PERCENT_MIN, MOTOR_OUTPUT_LIMIT_PERCENT_MAX, 1}, 0 }, { "BACK", OME_Back, NULL, NULL, 0 }, { NULL, OME_END, NULL, NULL, 0 } diff --git a/src/main/drivers/pwm_output.h b/src/main/drivers/pwm_output.h index d9cb6fa16..d60c47095 100644 --- a/src/main/drivers/pwm_output.h +++ b/src/main/drivers/pwm_output.h @@ -32,6 +32,9 @@ #define DSHOT_TELEMETRY_INPUT_LEN 32 #define PROSHOT_TELEMETRY_INPUT_LEN 8 +#define MOTOR_OUTPUT_LIMIT_PERCENT_MIN 1 +#define MOTOR_OUTPUT_LIMIT_PERCENT_MAX 100 + /* DshotSettingRequest (KISS24). Spin direction, 3d and save Settings reqire 10 requests.. and the TLM Byte must always be high if 1-47 are used to send settings