mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 06:28:27 -04:00
AP_ServoRelayEvents: add static create method
This commit is contained in:
parent
13d7f58036
commit
df29015533
@ -11,16 +11,15 @@
|
|||||||
|
|
||||||
class AP_ServoRelayEvents {
|
class AP_ServoRelayEvents {
|
||||||
public:
|
public:
|
||||||
AP_ServoRelayEvents(AP_Relay &_relay) :
|
static AP_ServoRelayEvents create(AP_Relay &_relay) {
|
||||||
relay(_relay),
|
return AP_ServoRelayEvents{_relay};
|
||||||
mask(0),
|
}
|
||||||
type(EVENT_TYPE_RELAY),
|
|
||||||
start_time_ms(0),
|
constexpr AP_ServoRelayEvents(AP_ServoRelayEvents &&other) = default;
|
||||||
delay_ms(0),
|
|
||||||
repeat(0),
|
/* Do not allow copies */
|
||||||
channel(0),
|
AP_ServoRelayEvents(const AP_ServoRelayEvents &other) = delete;
|
||||||
servo_value(0)
|
AP_ServoRelayEvents &operator=(const AP_ServoRelayEvents&) = delete;
|
||||||
{}
|
|
||||||
|
|
||||||
// set allowed servo channel mask
|
// set allowed servo channel mask
|
||||||
void set_channel_mask(uint16_t _mask) { mask = _mask; }
|
void set_channel_mask(uint16_t _mask) { mask = _mask; }
|
||||||
@ -32,6 +31,18 @@ public:
|
|||||||
void update_events(void);
|
void update_events(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
AP_ServoRelayEvents(AP_Relay &_relay)
|
||||||
|
: relay(_relay)
|
||||||
|
, mask(0)
|
||||||
|
, type(EVENT_TYPE_RELAY)
|
||||||
|
, start_time_ms(0)
|
||||||
|
, delay_ms(0)
|
||||||
|
, repeat(0)
|
||||||
|
, channel(0)
|
||||||
|
, servo_value(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
AP_Relay &relay;
|
AP_Relay &relay;
|
||||||
uint16_t mask;
|
uint16_t mask;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user