mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-19 06:15:16 +03:00
Fixed 'cast-function-type' warnings, reworked CMS function pointer juggle.
This commit is contained in:
parent
cf86671997
commit
438a801eb8
21 changed files with 249 additions and 248 deletions
|
@ -112,7 +112,7 @@ static void setProfileIndexString(char *profileString, int profileIndex, char *p
|
|||
profileString[charIndex] = '\0';
|
||||
}
|
||||
|
||||
static long cmsx_menuImu_onEnter(void)
|
||||
static const void *cmsx_menuImu_onEnter(void)
|
||||
{
|
||||
pidProfileIndex = getCurrentPidProfileIndex();
|
||||
tmpPidProfileIndex = pidProfileIndex + 1;
|
||||
|
@ -120,20 +120,20 @@ static long cmsx_menuImu_onEnter(void)
|
|||
rateProfileIndex = getCurrentControlRateProfileIndex();
|
||||
tmpRateProfileIndex = rateProfileIndex + 1;
|
||||
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static long cmsx_menuImu_onExit(const OSD_Entry *self)
|
||||
static const void *cmsx_menuImu_onExit(const OSD_Entry *self)
|
||||
{
|
||||
UNUSED(self);
|
||||
|
||||
changePidProfile(pidProfileIndex);
|
||||
changeControlRateProfile(rateProfileIndex);
|
||||
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static long cmsx_profileIndexOnChange(displayPort_t *displayPort, const void *ptr)
|
||||
static const void *cmsx_profileIndexOnChange(displayPort_t *displayPort, const void *ptr)
|
||||
{
|
||||
UNUSED(displayPort);
|
||||
UNUSED(ptr);
|
||||
|
@ -141,10 +141,10 @@ static long cmsx_profileIndexOnChange(displayPort_t *displayPort, const void *pt
|
|||
pidProfileIndex = tmpPidProfileIndex - 1;
|
||||
changePidProfile(pidProfileIndex);
|
||||
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static long cmsx_rateProfileIndexOnChange(displayPort_t *displayPort, const void *ptr)
|
||||
static const void *cmsx_rateProfileIndexOnChange(displayPort_t *displayPort, const void *ptr)
|
||||
{
|
||||
UNUSED(displayPort);
|
||||
UNUSED(ptr);
|
||||
|
@ -152,10 +152,10 @@ static long cmsx_rateProfileIndexOnChange(displayPort_t *displayPort, const void
|
|||
rateProfileIndex = tmpRateProfileIndex - 1;
|
||||
changeControlRateProfile(rateProfileIndex);
|
||||
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static long cmsx_PidRead(void)
|
||||
static const void *cmsx_PidRead(void)
|
||||
{
|
||||
|
||||
const pidProfile_t *pidProfile = pidProfiles(pidProfileIndex);
|
||||
|
@ -166,18 +166,18 @@ static long cmsx_PidRead(void)
|
|||
tempPidF[i] = pidProfile->pid[i].F;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static long cmsx_PidOnEnter(void)
|
||||
static const void *cmsx_PidOnEnter(void)
|
||||
{
|
||||
setProfileIndexString(pidProfileIndexString, pidProfileIndex, currentPidProfile->profileName);
|
||||
cmsx_PidRead();
|
||||
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static long cmsx_PidWriteback(const OSD_Entry *self)
|
||||
static const void *cmsx_PidWriteback(const OSD_Entry *self)
|
||||
{
|
||||
UNUSED(self);
|
||||
|
||||
|
@ -190,7 +190,7 @@ static long cmsx_PidWriteback(const OSD_Entry *self)
|
|||
}
|
||||
pidInitConfig(currentPidProfile);
|
||||
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const OSD_Entry cmsx_menuPidEntries[] =
|
||||
|
@ -231,28 +231,28 @@ static CMS_Menu cmsx_menuPid = {
|
|||
// Rate & Expo
|
||||
//
|
||||
|
||||
static long cmsx_RateProfileRead(void)
|
||||
static const void *cmsx_RateProfileRead(void)
|
||||
{
|
||||
memcpy(&rateProfile, controlRateProfiles(rateProfileIndex), sizeof(controlRateConfig_t));
|
||||
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static long cmsx_RateProfileWriteback(const OSD_Entry *self)
|
||||
static const void *cmsx_RateProfileWriteback(const OSD_Entry *self)
|
||||
{
|
||||
UNUSED(self);
|
||||
|
||||
memcpy(controlRateProfilesMutable(rateProfileIndex), &rateProfile, sizeof(controlRateConfig_t));
|
||||
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static long cmsx_RateProfileOnEnter(void)
|
||||
static const void *cmsx_RateProfileOnEnter(void)
|
||||
{
|
||||
setProfileIndexString(rateProfileIndexString, rateProfileIndex, controlRateProfilesMutable(rateProfileIndex)->profileName);
|
||||
cmsx_RateProfileRead();
|
||||
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const OSD_Entry cmsx_menuRateProfileEntries[] =
|
||||
|
@ -301,7 +301,7 @@ static uint8_t cmsx_launchControlThrottlePercent;
|
|||
static uint8_t cmsx_launchControlAngleLimit;
|
||||
static uint8_t cmsx_launchControlGain;
|
||||
|
||||
static long cmsx_launchControlOnEnter(void)
|
||||
static const void *cmsx_launchControlOnEnter(void)
|
||||
{
|
||||
const pidProfile_t *pidProfile = pidProfiles(pidProfileIndex);
|
||||
|
||||
|
@ -311,10 +311,10 @@ static long cmsx_launchControlOnEnter(void)
|
|||
cmsx_launchControlAngleLimit = pidProfile->launchControlAngleLimit;
|
||||
cmsx_launchControlGain = pidProfile->launchControlGain;
|
||||
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static long cmsx_launchControlOnExit(const OSD_Entry *self)
|
||||
static const void *cmsx_launchControlOnExit(const OSD_Entry *self)
|
||||
{
|
||||
UNUSED(self);
|
||||
|
||||
|
@ -326,7 +326,7 @@ static long cmsx_launchControlOnExit(const OSD_Entry *self)
|
|||
pidProfile->launchControlAngleLimit = cmsx_launchControlAngleLimit;
|
||||
pidProfile->launchControlGain = cmsx_launchControlGain;
|
||||
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const OSD_Entry cmsx_menuLaunchControlEntries[] = {
|
||||
|
@ -376,7 +376,7 @@ static uint8_t cmsx_iterm_relax_type;
|
|||
static uint8_t cmsx_iterm_relax_cutoff;
|
||||
#endif
|
||||
|
||||
static long cmsx_profileOtherOnEnter(void)
|
||||
static const void *cmsx_profileOtherOnEnter(void)
|
||||
{
|
||||
setProfileIndexString(pidProfileIndexString, pidProfileIndex, currentPidProfile->profileName);
|
||||
|
||||
|
@ -410,10 +410,10 @@ static long cmsx_profileOtherOnEnter(void)
|
|||
cmsx_iterm_relax_cutoff = pidProfile->iterm_relax_cutoff;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static long cmsx_profileOtherOnExit(const OSD_Entry *self)
|
||||
static const void *cmsx_profileOtherOnExit(const OSD_Entry *self)
|
||||
{
|
||||
UNUSED(self);
|
||||
|
||||
|
@ -448,7 +448,7 @@ static long cmsx_profileOtherOnExit(const OSD_Entry *self)
|
|||
#endif
|
||||
|
||||
initEscEndpoints();
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const OSD_Entry cmsx_menuProfileOtherEntries[] = {
|
||||
|
@ -508,7 +508,7 @@ static uint16_t gyroConfig_gyro_soft_notch_hz_2;
|
|||
static uint16_t gyroConfig_gyro_soft_notch_cutoff_2;
|
||||
static uint8_t gyroConfig_gyro_to_use;
|
||||
|
||||
static long cmsx_menuGyro_onEnter(void)
|
||||
static const void *cmsx_menuGyro_onEnter(void)
|
||||
{
|
||||
gyroConfig_gyro_lowpass_hz = gyroConfig()->gyro_lowpass_hz;
|
||||
gyroConfig_gyro_lowpass2_hz = gyroConfig()->gyro_lowpass2_hz;
|
||||
|
@ -518,10 +518,10 @@ static long cmsx_menuGyro_onEnter(void)
|
|||
gyroConfig_gyro_soft_notch_cutoff_2 = gyroConfig()->gyro_soft_notch_cutoff_2;
|
||||
gyroConfig_gyro_to_use = gyroConfig()->gyro_to_use;
|
||||
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static long cmsx_menuGyro_onExit(const OSD_Entry *self)
|
||||
static const void *cmsx_menuGyro_onExit(const OSD_Entry *self)
|
||||
{
|
||||
UNUSED(self);
|
||||
|
||||
|
@ -533,7 +533,7 @@ static long cmsx_menuGyro_onExit(const OSD_Entry *self)
|
|||
gyroConfigMutable()->gyro_soft_notch_cutoff_2 = gyroConfig_gyro_soft_notch_cutoff_2;
|
||||
gyroConfigMutable()->gyro_to_use = gyroConfig_gyro_to_use;
|
||||
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const OSD_Entry cmsx_menuFilterGlobalEntries[] =
|
||||
|
@ -582,7 +582,7 @@ static uint16_t dynFiltDtermMin;
|
|||
static uint16_t dynFiltDtermMax;
|
||||
#endif
|
||||
|
||||
static long cmsx_menuDynFilt_onEnter(void)
|
||||
static const void *cmsx_menuDynFilt_onEnter(void)
|
||||
{
|
||||
#ifdef USE_GYRO_DATA_ANALYSE
|
||||
dynFiltNotchRange = gyroConfig()->dyn_notch_range;
|
||||
|
@ -598,10 +598,10 @@ static long cmsx_menuDynFilt_onEnter(void)
|
|||
dynFiltDtermMax = pidProfile->dyn_lpf_dterm_max_hz;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static long cmsx_menuDynFilt_onExit(const OSD_Entry *self)
|
||||
static const void *cmsx_menuDynFilt_onExit(const OSD_Entry *self)
|
||||
{
|
||||
UNUSED(self);
|
||||
|
||||
|
@ -619,7 +619,7 @@ static long cmsx_menuDynFilt_onExit(const OSD_Entry *self)
|
|||
pidProfile->dyn_lpf_dterm_max_hz = dynFiltDtermMax;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const OSD_Entry cmsx_menuDynFiltEntries[] =
|
||||
|
@ -663,7 +663,7 @@ static uint16_t cmsx_dterm_notch_hz;
|
|||
static uint16_t cmsx_dterm_notch_cutoff;
|
||||
static uint16_t cmsx_yaw_lowpass_hz;
|
||||
|
||||
static long cmsx_FilterPerProfileRead(void)
|
||||
static const void *cmsx_FilterPerProfileRead(void)
|
||||
{
|
||||
const pidProfile_t *pidProfile = pidProfiles(pidProfileIndex);
|
||||
|
||||
|
@ -673,10 +673,10 @@ static long cmsx_FilterPerProfileRead(void)
|
|||
cmsx_dterm_notch_cutoff = pidProfile->dterm_notch_cutoff;
|
||||
cmsx_yaw_lowpass_hz = pidProfile->yaw_lowpass_hz;
|
||||
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static long cmsx_FilterPerProfileWriteback(const OSD_Entry *self)
|
||||
static const void *cmsx_FilterPerProfileWriteback(const OSD_Entry *self)
|
||||
{
|
||||
UNUSED(self);
|
||||
|
||||
|
@ -688,7 +688,7 @@ static long cmsx_FilterPerProfileWriteback(const OSD_Entry *self)
|
|||
pidProfile->dterm_notch_cutoff = cmsx_dterm_notch_cutoff;
|
||||
pidProfile->yaw_lowpass_hz = cmsx_yaw_lowpass_hz;
|
||||
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const OSD_Entry cmsx_menuFilterPerProfileEntries[] =
|
||||
|
@ -731,15 +731,15 @@ static const char * const cmsx_ProfileNames[] = {
|
|||
static OSD_TAB_t cmsx_PidProfileTable = { &cmsx_dstPidProfile, 3, cmsx_ProfileNames };
|
||||
static OSD_TAB_t cmsx_ControlRateProfileTable = { &cmsx_dstControlRateProfile, 3, cmsx_ProfileNames };
|
||||
|
||||
static long cmsx_menuCopyProfile_onEnter(void)
|
||||
static const void *cmsx_menuCopyProfile_onEnter(void)
|
||||
{
|
||||
cmsx_dstPidProfile = 0;
|
||||
cmsx_dstControlRateProfile = 0;
|
||||
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static long cmsx_CopyPidProfile(displayPort_t *pDisplay, const void *ptr)
|
||||
static const void *cmsx_CopyPidProfile(displayPort_t *pDisplay, const void *ptr)
|
||||
{
|
||||
UNUSED(pDisplay);
|
||||
UNUSED(ptr);
|
||||
|
@ -748,10 +748,10 @@ static long cmsx_CopyPidProfile(displayPort_t *pDisplay, const void *ptr)
|
|||
pidCopyProfile(cmsx_dstPidProfile - 1, getCurrentPidProfileIndex());
|
||||
}
|
||||
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static long cmsx_CopyControlRateProfile(displayPort_t *pDisplay, const void *ptr)
|
||||
static const void *cmsx_CopyControlRateProfile(displayPort_t *pDisplay, const void *ptr)
|
||||
{
|
||||
UNUSED(pDisplay);
|
||||
UNUSED(ptr);
|
||||
|
@ -760,7 +760,7 @@ static long cmsx_CopyControlRateProfile(displayPort_t *pDisplay, const void *ptr
|
|||
copyControlRateProfile(cmsx_dstControlRateProfile - 1, getCurrentControlRateProfileIndex());
|
||||
}
|
||||
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const OSD_Entry cmsx_menuCopyProfileEntries[] =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue