mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-03-11 17:13:56 -03:00
AP_ICEngine: move to new relay functions
This commit is contained in:
parent
8292c6ea9f
commit
8ce490d985
@ -165,14 +165,8 @@ const AP_Param::GroupInfo AP_ICEngine::var_info[] = {
|
||||
AP_GROUPINFO("REDLINE_RPM", 17, AP_ICEngine, redline_rpm, 0),
|
||||
#endif
|
||||
|
||||
#if AP_RELAY_ENABLED
|
||||
// @Param: IGNITION_RLY
|
||||
// @DisplayName: Ignition relay channel
|
||||
// @Description: This is a a relay channel to use for ignition control
|
||||
// @User: Standard
|
||||
// @Values: 0:None,1:Relay1,2:Relay2,3:Relay3,4:Relay4,5:Relay5,6:Relay6
|
||||
AP_GROUPINFO("IGNITION_RLY", 18, AP_ICEngine, ignition_relay, 0),
|
||||
#endif
|
||||
// 18 was IGNITION_RLY
|
||||
|
||||
|
||||
AP_GROUPEND
|
||||
};
|
||||
@ -608,15 +602,14 @@ void AP_ICEngine::update_idle_governor(int8_t &min_throttle)
|
||||
void AP_ICEngine::set_ignition(bool on)
|
||||
{
|
||||
SRV_Channels::set_output_pwm(SRV_Channel::k_ignition, on? pwm_ignition_on : pwm_ignition_off);
|
||||
|
||||
#if AP_RELAY_ENABLED
|
||||
// optionally use a relay as well
|
||||
if (ignition_relay > 0) {
|
||||
auto *relay = AP::relay();
|
||||
if (relay != nullptr) {
|
||||
relay->set(ignition_relay-1, on);
|
||||
}
|
||||
AP_Relay *relay = AP::relay();
|
||||
if (relay != nullptr) {
|
||||
relay->set(AP_Relay_Params::FUNCTION::IGNITION, on);
|
||||
}
|
||||
#endif // AP_RELAY_ENABLED
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@ -638,6 +631,19 @@ bool AP_ICEngine::allow_throttle_while_disarmed() const
|
||||
hal.util->safety_switch_state() != AP_HAL::Util::SAFETY_DISARMED;
|
||||
}
|
||||
|
||||
#if AP_RELAY_ENABLED
|
||||
bool AP_ICEngine::get_legacy_ignition_relay_index(int8_t &num)
|
||||
{
|
||||
// PARAMETER_CONVERSION - Added: Dec-2023
|
||||
if (!enable || !AP_Param::get_param_by_index(this, 18, AP_PARAM_INT8, &num)) {
|
||||
return false;
|
||||
}
|
||||
// convert to zero indexed
|
||||
num -= 1;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
// singleton instance. Should only ever be set in the constructor.
|
||||
AP_ICEngine *AP_ICEngine::_singleton;
|
||||
namespace AP {
|
||||
|
@ -66,6 +66,11 @@ public:
|
||||
// do we have throttle while disarmed enabled?
|
||||
bool allow_throttle_while_disarmed(void) const;
|
||||
|
||||
#if AP_RELAY_ENABLED
|
||||
// Needed for param conversion from relay numbers to functions
|
||||
bool get_legacy_ignition_relay_index(int8_t &num);
|
||||
#endif
|
||||
|
||||
static AP_ICEngine *get_singleton() { return _singleton; }
|
||||
|
||||
private:
|
||||
@ -136,11 +141,6 @@ private:
|
||||
AP_Float idle_slew;
|
||||
#endif
|
||||
|
||||
#if AP_RELAY_ENABLED
|
||||
// relay number for ignition
|
||||
AP_Int8 ignition_relay;
|
||||
#endif
|
||||
|
||||
// height when we enter ICE_START_HEIGHT_DELAY
|
||||
float initial_height;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user