mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-01 09:24:10 +01:00
OP-1685 - calls sanitychecks after updates to actuatorsettings, update board sanitycheck rules
This commit is contained in:
parent
f3fe45750d
commit
096a321181
@ -55,6 +55,7 @@
|
||||
uint32_t pios_rcvr_group_map[MANUALCONTROLSETTINGS_CHANNELGROUPS_NONE];
|
||||
|
||||
static SystemAlarmsExtendedAlarmStatusOptions CopterControlConfigHook();
|
||||
static void ActuatorSettingsUpdatedCb(UAVObjEvent *ev);
|
||||
|
||||
#define PIOS_COM_TELEM_RF_RX_BUF_LEN 32
|
||||
#define PIOS_COM_TELEM_RF_TX_BUF_LEN 12
|
||||
@ -848,6 +849,9 @@ void PIOS_Board_Init(void)
|
||||
|
||||
// Attach the board config check hook
|
||||
SANITYCHECK_AttachHook(&CopterControlConfigHook);
|
||||
// trigger a config check if actuatorsettings are updated
|
||||
ActuatorSettingsInitialize();
|
||||
ActuatorSettingsConnectCallback(ActuatorSettingsUpdatedCb);
|
||||
}
|
||||
|
||||
SystemAlarmsExtendedAlarmStatusOptions CopterControlConfigHook()
|
||||
@ -856,32 +860,44 @@ SystemAlarmsExtendedAlarmStatusOptions CopterControlConfigHook()
|
||||
uint8_t recmode;
|
||||
|
||||
HwSettingsCC_RcvrPortGet(&recmode);
|
||||
uint8_t modes[ACTUATORSETTINGS_BANKMODE_NUMELEM];
|
||||
ActuatorSettingsBankModeGet(modes);
|
||||
switch ((HwSettingsCC_RcvrPortOptions)recmode) {
|
||||
// Those modes allows oneshot usage
|
||||
case HWSETTINGS_CC_RCVRPORT_DISABLEDONESHOT:
|
||||
case HWSETTINGS_CC_RCVRPORT_OUTPUTSONESHOT:
|
||||
case HWSETTINGS_CC_RCVRPORT_PPM_PIN6ONESHOT:
|
||||
return SYSTEMALARMS_EXTENDEDALARMSTATUS_NONE;
|
||||
|
||||
case HWSETTINGS_CC_RCVRPORT_PPM_PIN6ONESHOT:
|
||||
if (modes[3] == ACTUATORSETTINGS_BANKMODE_ONESHOT ||
|
||||
modes[3] == ACTUATORSETTINGS_BANKMODE_ONESHOT125) {
|
||||
return SYSTEMALARMS_EXTENDEDALARMSTATUS_UNSUPPORTEDCONFIG_ONESHOT;
|
||||
} else {
|
||||
return SYSTEMALARMS_EXTENDEDALARMSTATUS_NONE;
|
||||
}
|
||||
|
||||
// inhibit oneshot for the following modes
|
||||
case HWSETTINGS_CC_RCVRPORT_PPMNOONESHOT:
|
||||
case HWSETTINGS_CC_RCVRPORT_PPMOUTPUTSNOONESHOT:
|
||||
case HWSETTINGS_CC_RCVRPORT_PPMPWMNOONESHOT:
|
||||
case HWSETTINGS_CC_RCVRPORT_PWMNOONESHOT:
|
||||
{
|
||||
uint8_t modes[ACTUATORSETTINGS_BANKMODE_NUMELEM];
|
||||
ActuatorSettingsBankModeGet(modes);
|
||||
for (uint8_t i = 0; i < ACTUATORSETTINGS_BANKMODE_NUMELEM; i++) {
|
||||
if (modes[i] == ACTUATORSETTINGS_BANKMODE_ONESHOT ||
|
||||
modes[i] == ACTUATORSETTINGS_BANKMODE_ONESHOT125) {
|
||||
return SYSTEMALARMS_EXTENDEDALARMSTATUS_UNSUPPORTEDCONFIG_ONESHOT;;
|
||||
}
|
||||
|
||||
return SYSTEMALARMS_EXTENDEDALARMSTATUS_NONE;
|
||||
}
|
||||
return SYSTEMALARMS_EXTENDEDALARMSTATUS_NONE;
|
||||
}
|
||||
}
|
||||
return SYSTEMALARMS_EXTENDEDALARMSTATUS_UNSUPPORTEDCONFIG_ONESHOT;;
|
||||
}
|
||||
// trigger a configuration check if ActuatorSettings are changed.
|
||||
void ActuatorSettingsUpdatedCb(__attribute__((unused)) UAVObjEvent *ev)
|
||||
{
|
||||
configuration_check();
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -2,14 +2,7 @@
|
||||
<object name="ActuatorSettings" singleinstance="true" settings="true" category="Control">
|
||||
<description>Settings for the @ref ActuatorModule that controls the channel assignments for the mixer based on AircraftType</description>
|
||||
<field name="BankUpdateFreq" units="Hz" type="uint16" elements="6" defaultvalue="50"/>
|
||||
<field name="BankMode" type="enum" units="" elements="6" options="PWM,OneShot,OneShot125" defaultvalue="PWM"
|
||||
limits="; \
|
||||
; \
|
||||
; \
|
||||
; \
|
||||
; \
|
||||
%0401NE:OneShot:OneShot125,%0402NE:OneShot:OneShot125;"
|
||||
/>
|
||||
<field name="BankMode" type="enum" units="" elements="6" options="PWM,OneShot,OneShot125" defaultvalue="PWM"/>
|
||||
<field name="ChannelMax" units="us" type="int16" elements="12" defaultvalue="1000"/>
|
||||
<field name="ChannelNeutral" units="us" type="int16" elements="12" defaultvalue="1000"/>
|
||||
<field name="ChannelMin" units="us" type="int16" elements="12" defaultvalue="1000"/>
|
||||
|
Loading…
Reference in New Issue
Block a user