dshot: fix bug preventing writing settings

This commit is contained in:
Jacob Dahl
2026-01-27 19:39:06 -09:00
parent 47bb1437e4
commit 6f8ba007d1
2 changed files with 6 additions and 4 deletions
+2 -2
View File
@@ -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
+4 -2
View File
@@ -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;