mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-11 20:43:34 +08:00
dshot: fix bug preventing writing settings
This commit is contained in:
@@ -2,7 +2,7 @@ uint64 timestamp # time since system start (microseconds)
|
||||
uint8 firmware # ESC firmware type (see ESC_FIRMWARE enum in MAVLink)
|
||||
uint8 index # Index of the ESC (0 = ESC1, 1 = ESC2, etc, 255 = All)
|
||||
uint16 length # Length of valid data
|
||||
uint8[192] data # Raw ESC EEPROM data
|
||||
uint32[6] write_mask # Bitmask indicating which bytes in the data array should be written (max 192 values)
|
||||
uint8[64] data # Raw ESC EEPROM data
|
||||
uint32[2] write_mask # Bitmask indicating which bytes in the data array should be written (max 64 values)
|
||||
|
||||
uint8 ORB_QUEUE_LENGTH = 8 # To support 8 queued up requests
|
||||
|
||||
@@ -216,7 +216,7 @@ void DShot::select_next_command()
|
||||
}
|
||||
}
|
||||
|
||||
} else if (_serial_telemetry_enabled && serial_telem_delay_elapsed) {
|
||||
} else if (_serial_telemetry_enabled && serial_telem_delay_elapsed && (_motor_mask & needs_settings_request_mask)) {
|
||||
// Settings Request: use motor-order masks since needs_settings_request_mask is in motor order
|
||||
uint8_t settings_motors_to_request = _motor_mask & needs_settings_request_mask;
|
||||
|
||||
@@ -241,7 +241,9 @@ void DShot::select_next_command()
|
||||
int next_index = -1;
|
||||
|
||||
// Find settings that need to be written but haven't been yet
|
||||
for (int i = 0; i < _esc_eeprom_write.length; i++) {
|
||||
int max_length = math::min((int)_esc_eeprom_write.length, 64);
|
||||
|
||||
for (int i = 0; i < max_length; i++) {
|
||||
int array_index = i / 32;
|
||||
int bit_index = i % 32;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user