Skip to content

OSD support of Kalman settings #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 3.3_kalman_test
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions src/main/cms/cms_menu_imu.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,20 @@ static OSD_Entry cmsx_menuRateProfileEntries[] =
{ "THRPID ATT", OME_FLOAT, NULL, &(OSD_FLOAT_t) { &rateProfile.dynThrPID, 0, 100, 1, 10}, 0 },
{ "TPA BRKPT", OME_UINT16, NULL, &(OSD_UINT16_t){ &rateProfile.tpa_breakpoint, 1000, 2000, 10}, 0 },

{ "RF RATE ENABLED", OME_Bool, NULL, &rateProfile.rfRatesEnabled, 0 },

{ "RF RATE ROLL", OME_UINT16, NULL, &(OSD_UINT16_t) { &rateProfile.rfRate[FD_ROLL], 200, 1500, 1 }, 0 },
{ "RF ACRO ROLL", OME_UINT8, NULL, &(OSD_UINT8_t) { &rateProfile.rfAcro[FD_ROLL], 0, 255, 1 }, 0 },
{ "RF EXPO ROLL", OME_UINT8, NULL, &(OSD_UINT8_t) { &rateProfile.rfExpo[FD_ROLL], 0, 100, 1 }, 0 },

{ "RF RATE PITCH", OME_UINT16, NULL, &(OSD_UINT16_t) { &rateProfile.rfRate[FD_PITCH], 200, 1500, 1 }, 0 },
{ "RF ACRO PITCH", OME_UINT8, NULL, &(OSD_UINT8_t) { &rateProfile.rfAcro[FD_PITCH], 0, 255, 1 }, 0 },
{ "RF EXPO PITCH", OME_UINT8, NULL, &(OSD_UINT8_t) { &rateProfile.rfExpo[FD_PITCH], 0, 100, 1 }, 0 },

{ "RF RATE YAW", OME_UINT16, NULL, &(OSD_UINT16_t) { &rateProfile.rfRate[FD_YAW], 200, 1500, 1 }, 0 },
{ "RF ACRO YAW", OME_UINT8, NULL, &(OSD_UINT8_t) { &rateProfile.rfAcro[FD_YAW], 0, 255, 1 }, 0 },
{ "RF EXPO YAW", OME_UINT8, NULL, &(OSD_UINT8_t) { &rateProfile.rfExpo[FD_YAW], 0, 100, 1 }, 0 },

{ "BACK", OME_Back, NULL, NULL, 0 },
{ NULL, OME_END, NULL, NULL, 0 }
};
Expand Down Expand Up @@ -307,6 +321,10 @@ static uint16_t gyroConfig_gyro_soft_notch_hz_1;
static uint16_t gyroConfig_gyro_soft_notch_cutoff_1;
static uint16_t gyroConfig_gyro_soft_notch_hz_2;
static uint16_t gyroConfig_gyro_soft_notch_cutoff_2;
static uint8_t gyroConfig_gyro_kalman_enable;
static uint16_t gyroConfig_gyro_kalman_q;
static uint16_t gyroConfig_gyro_kalman_r;
static uint16_t gyroConfig_gyro_kalman_p;

static long cmsx_menuGyro_onEnter(void)
{
Expand All @@ -316,6 +334,11 @@ static long cmsx_menuGyro_onEnter(void)
gyroConfig_gyro_soft_notch_hz_2 = gyroConfig()->gyro_soft_notch_hz_2;
gyroConfig_gyro_soft_notch_cutoff_2 = gyroConfig()->gyro_soft_notch_cutoff_2;

gyroConfig_gyro_kalman_enable = gyroConfig()->gyro_kalman_enable;
gyroConfig_gyro_kalman_q = gyroConfig()->gyro_kalman_q;
gyroConfig_gyro_kalman_r = gyroConfig()->gyro_kalman_r;
gyroConfig_gyro_kalman_p = gyroConfig()->gyro_kalman_p;

return 0;
}

Expand All @@ -329,6 +352,11 @@ static long cmsx_menuGyro_onExit(const OSD_Entry *self)
gyroConfigMutable()->gyro_soft_notch_hz_2 = gyroConfig_gyro_soft_notch_hz_2;
gyroConfigMutable()->gyro_soft_notch_cutoff_2 = gyroConfig_gyro_soft_notch_cutoff_2;

gyroConfigMutable()->gyro_kalman_enable = gyroConfig_gyro_kalman_enable;
gyroConfigMutable()->gyro_kalman_q = gyroConfig_gyro_kalman_q;
gyroConfigMutable()->gyro_kalman_r = gyroConfig_gyro_kalman_r;
gyroConfigMutable()->gyro_kalman_p = gyroConfig_gyro_kalman_p;

return 0;
}

Expand All @@ -342,6 +370,11 @@ static OSD_Entry cmsx_menuFilterGlobalEntries[] =
{ "GYRO NF2", OME_UINT16, NULL, &(OSD_UINT16_t) { &gyroConfig_gyro_soft_notch_hz_2, 0, 500, 1 }, 0 },
{ "GYRO NF2C", OME_UINT16, NULL, &(OSD_UINT16_t) { &gyroConfig_gyro_soft_notch_cutoff_2, 0, 500, 1 }, 0 },

{ "KALMAN ENABLED", OME_Bool, NULL, &gyroConfig_gyro_kalman_enable, 0 },
{ "KALMAN Q", OME_UINT16, NULL, &(OSD_UINT16_t) { &gyroConfig_gyro_kalman_q, 0, 16000, 1 }, 0 },
{ "KALMAN R", OME_UINT16, NULL, &(OSD_UINT16_t) { &gyroConfig_gyro_kalman_r, 0, 16000, 1 }, 0 },
{ "KALMAN P", OME_UINT16, NULL, &(OSD_UINT16_t) { &gyroConfig_gyro_kalman_p, 0, 16000, 1 }, 0 },

{ "BACK", OME_Back, NULL, NULL, 0 },
{ NULL, OME_END, NULL, NULL, 0 }
};
Expand Down