mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-11-29 07:24:13 +01:00
REVONANO 1. Sanity check for PWMSync & OneShot while using PWM receiver. 2. Remove CC in hwsettings.xml
This commit is contained in:
parent
2625340934
commit
8551048354
@ -36,7 +36,8 @@
|
||||
#include <pios_oplinkrcvr_priv.h>
|
||||
#include <taskinfo.h>
|
||||
#include <pios_ws2811.h>
|
||||
|
||||
#include <sanitycheck.h>
|
||||
#include <actuatorsettings.h>
|
||||
|
||||
#ifdef PIOS_INCLUDE_INSTRUMENTATION
|
||||
#include <pios_instrumentation.h>
|
||||
@ -52,6 +53,8 @@
|
||||
*/
|
||||
#include "../board_hw_defs.c"
|
||||
|
||||
static SystemAlarmsExtendedAlarmStatusOptions RevoNanoConfigHook();
|
||||
static void ActuatorSettingsUpdatedCb(UAVObjEvent *ev);
|
||||
/**
|
||||
* Sensor configurations
|
||||
*/
|
||||
@ -764,8 +767,54 @@ void PIOS_Board_Init(void)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Attach the board config check hook
|
||||
SANITYCHECK_AttachHook(&RevoNanoConfigHook);
|
||||
// trigger a config check if actuatorsettings are updated
|
||||
ActuatorSettingsInitialize();
|
||||
ActuatorSettingsConnectCallback(ActuatorSettingsUpdatedCb);
|
||||
}
|
||||
|
||||
SystemAlarmsExtendedAlarmStatusOptions RevoNanoConfigHook()
|
||||
{
|
||||
// inhibit usage of oneshot for non supported RECEIVER port modes
|
||||
uint8_t recmode;
|
||||
|
||||
HwSettingsRM_RcvrPortGet(&recmode);
|
||||
uint8_t modes[ACTUATORSETTINGS_BANKMODE_NUMELEM];
|
||||
ActuatorSettingsBankModeGet(modes);
|
||||
|
||||
switch ((HwSettingsRM_RcvrPortOptions)recmode) {
|
||||
// Those modes allows oneshot usage
|
||||
case HWSETTINGS_RM_RCVRPORT_DISABLED:
|
||||
case HWSETTINGS_RM_RCVRPORT_PPM:
|
||||
case HWSETTINGS_RM_RCVRPORT_PPMOUTPUTS:
|
||||
case HWSETTINGS_RM_RCVRPORT_OUTPUTS:
|
||||
return SYSTEMALARMS_EXTENDEDALARMSTATUS_NONE;
|
||||
|
||||
// inhibit oneshot for the following modes
|
||||
case HWSETTINGS_RM_RCVRPORT_PWM:
|
||||
for (uint8_t i = 0; i < ACTUATORSETTINGS_BANKMODE_NUMELEM; i++) {
|
||||
if (modes[i] == ACTUATORSETTINGS_BANKMODE_PWMSYNC ||
|
||||
modes[i] == ACTUATORSETTINGS_BANKMODE_ONESHOT125) {
|
||||
return SYSTEMALARMS_EXTENDEDALARMSTATUS_UNSUPPORTEDCONFIG_ONESHOT;;
|
||||
}
|
||||
}
|
||||
|
||||
return SYSTEMALARMS_EXTENDEDALARMSTATUS_NONE;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return SYSTEMALARMS_EXTENDEDALARMSTATUS_UNSUPPORTEDCONFIG_ONESHOT;;
|
||||
}
|
||||
|
||||
// trigger a configuration check if ActuatorSettings are changed.
|
||||
void ActuatorSettingsUpdatedCb(__attribute__((unused)) UAVObjEvent *ev)
|
||||
{
|
||||
configuration_check();
|
||||
}
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
|
@ -472,10 +472,7 @@ void ConfigOutputWidget::updateWarnings(UAVObject *)
|
||||
if (systemAlarms.Alarm[SystemAlarms::ALARM_SYSTEMCONFIGURATION] > SystemAlarms::ALARM_WARNING) {
|
||||
switch (systemAlarms.ExtendedAlarmStatus[SystemAlarms::EXTENDEDALARMSTATUS_SYSTEMCONFIGURATION]) {
|
||||
case SystemAlarms::EXTENDEDALARMSTATUS_UNSUPPORTEDCONFIG_ONESHOT:
|
||||
setWarning(tr("OneShot and PWMSync output only works with Receiver Port settings marked with '+OneShot'<br>"
|
||||
"When using Receiver Port setting 'PPM_PIN8+OneShot' "
|
||||
"<b><font color='%1'>Bank %2</font></b> must be set to PWM")
|
||||
.arg(m_banks.at(3).color().name()).arg(m_banks.at(3).label()->text()));
|
||||
setWarning(tr("OneShot and PWMSync output DO NOT work with Receiver Port is 'PWM'<br>"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -73,5 +73,34 @@ void EscPage::initializePage()
|
||||
|
||||
bool EscPage::isSynchOrOneShotAvailable()
|
||||
{
|
||||
return true;
|
||||
bool available = true;
|
||||
|
||||
switch (getWizard()->getControllerType()) {
|
||||
case SetupWizard::CONTROLLER_NANO:
|
||||
switch (getWizard()->getVehicleType()) {
|
||||
case SetupWizard::VEHICLE_MULTI:
|
||||
switch (getWizard()->getVehicleSubType()) {
|
||||
case SetupWizard::MULTI_ROTOR_TRI_Y:
|
||||
case SetupWizard::MULTI_ROTOR_QUAD_X:
|
||||
case SetupWizard::MULTI_ROTOR_QUAD_H:
|
||||
case SetupWizard::MULTI_ROTOR_QUAD_PLUS:
|
||||
available = getWizard()->getInputType() != SetupWizard::INPUT_PWM;
|
||||
break;
|
||||
|
||||
default:
|
||||
available = false;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return available;
|
||||
}
|
||||
|
@ -1,10 +1,6 @@
|
||||
<xml>
|
||||
<object name="HwSettings" singleinstance="true" settings="true" category="System">
|
||||
<description>Selection of optional hardware configurations.</description>
|
||||
<field name="CC_RcvrPort" units="function" type="enum" elements="1" options="Disabled+OneShot,PWM+NoOneShot,PPM+NoOneShot,PPM+PWM+NoOneShot,PPM+Outputs+NoOneShot,PPM_PIN8+OneShot, Outputs+OneShot" defaultvalue="PWM+NoOneShot"/>
|
||||
<field name="CC_MainPort" units="function" type="enum" elements="1" options="Disabled,Telemetry,GPS,S.Bus,DSM,DebugConsole,ComBridge,OsdHk" defaultvalue="Telemetry"/>
|
||||
<field name="CC_FlexiPort" units="function" type="enum" elements="1" options="Disabled,Telemetry,GPS,I2C,PPM,DSM,DebugConsole,ComBridge,OsdHk" defaultvalue="Disabled"/>
|
||||
|
||||
<field name="RV_RcvrPort" units="function" type="enum" elements="1" options="Disabled,PWM,PPM,PPM+Outputs,Outputs" defaultvalue="PWM"/>
|
||||
<field name="RV_AuxPort" units="function" type="enum" elements="1" options="Disabled,Telemetry,DSM,ComAux,ComBridge,OsdHk" defaultvalue="Disabled"/>
|
||||
<field name="RV_AuxSBusPort" units="function" type="enum" elements="1" options="Disabled,S.Bus,DSM,ComAux,ComBridge,OsdHk" defaultvalue="Disabled"/>
|
||||
@ -28,9 +24,7 @@
|
||||
<field name="ADCRouting" units="" type="enum" elementnames="adc0,adc1,adc2,adc3,adc4,adc5,adc6,adc7" options="Disabled,BatteryVoltage,BatteryCurrent,AnalogAirspeed,Generic" defaultvalue="Disabled"/>
|
||||
<field name="DSMxBind" units="" type="uint8" elements="1" defaultvalue="0"/>
|
||||
<field name="WS2811LED_Out" units="" type="enum" elements="1" options="ServoOut1,ServoOut2,ServoOut3,ServoOut4,ServoOut5,ServoOut6,FlexiIOPin3,FlexiIOPin4,Disabled" defaultvalue="Disabled"
|
||||
limits="%0905NE:ServoOut2:ServoOut3:ServoOut4:ServoOut5:ServoOut6:FlexiIOPin3:FlexiIOPin4,\
|
||||
%0401NE:ServoOut1:ServoOut2:ServoOut3:ServoOut4:ServoOut5:ServoOut6:FlexiIOPin3:FlexiIOPin4,\
|
||||
%0402NE:ServoOut1:ServoOut2:ServoOut3:ServoOut4:ServoOut5:ServoOut6:FlexiIOPin3:FlexiIOPin4;"
|
||||
limits="%0905NE:ServoOut2:ServoOut3:ServoOut4:ServoOut5:ServoOut6:FlexiIOPin3:FlexiIOPin4;"
|
||||
/>
|
||||
|
||||
<access gcs="readwrite" flight="readwrite"/>
|
||||
|
Loading…
Reference in New Issue
Block a user