AP_HAL: RCOutput_Tap: make LEDs blink on non-Aero ESCs
The protocol defines bits for controlling possible LEDs. On Aero the ESC firmware simply ignores these bits and blink with a fixed frequency. Add logic to be able to blink the ESC if not flashed with the Aero version of the firmware.
This commit is contained in:
parent
2c3054cbae
commit
7edde571e1
@ -556,8 +556,17 @@ void RCOutput_Tap::push()
|
||||
EscPacket packet = {0xfe, _channels_count, ESCBUS_MSG_ID_RUN};
|
||||
packet.len *= sizeof(packet.d.reqRun.value[0]);
|
||||
|
||||
uint32_t tnow = AP_HAL::millis();
|
||||
if (tnow - _last_led_update_msec > 250) {
|
||||
_led_on = !_led_on;
|
||||
_last_led_update_msec = tnow;
|
||||
}
|
||||
|
||||
for (uint8_t i = 0; i < _channels_count; i++) {
|
||||
packet.d.reqRun.value[i] = out[i] & RUN_CHANNEL_VALUE_MASK;
|
||||
if (_led_on) {
|
||||
packet.d.reqRun.value[i] |= RUN_LED_ON_MASK;
|
||||
}
|
||||
}
|
||||
|
||||
int ret = _send_packet(packet);
|
||||
|
@ -89,12 +89,14 @@ private:
|
||||
|
||||
uint8_t _enabled_channels;
|
||||
bool _corking;
|
||||
bool _led_on;
|
||||
|
||||
uint8_t _channels_count = MAX_MOTORS;
|
||||
|
||||
uint16_t _period[MAX_MOTORS];
|
||||
uint16_t _esc_pwm_min;
|
||||
uint16_t _esc_pwm_max;
|
||||
uint32_t _last_led_update_msec;
|
||||
int _uart_fd = -1;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user