diff --git a/msg/EscEepromWrite.msg b/msg/EscEepromWrite.msg index d9e1c63628..818c94695c 100644 --- a/msg/EscEepromWrite.msg +++ b/msg/EscEepromWrite.msg @@ -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 diff --git a/src/drivers/dshot/DShot.cpp b/src/drivers/dshot/DShot.cpp index 99b33ea484..4f29f975d7 100644 --- a/src/drivers/dshot/DShot.cpp +++ b/src/drivers/dshot/DShot.cpp @@ -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;