Merge pull request #232 from wunderk1nd-e/comm-get-values-unity-ctrl-id-fix

[COMM_GET_VALUES] Unity should return second motor controller ID if that is the selected thread
This commit is contained in:
Benjamin Vedder 2020-11-11 11:13:32 +01:00 committed by GitHub
commit b1117ab3e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -353,7 +353,13 @@ void commands_process_packet(unsigned char *data, unsigned int len,
buffer_append_float32(send_buffer, mc_interface_get_pid_pos_now(), 1e6, &ind);
}
if (mask & ((uint32_t)1 << 17)) {
send_buffer[ind++] = app_get_configuration()->controller_id;
uint8_t current_controller_id = app_get_configuration()->controller_id;
#ifdef HW_HAS_DUAL_MOTORS
if (mc_interface_get_motor_thread() == 2) {
current_controller_id = utils_second_motor_id();
}
#endif
send_buffer[ind++] = current_controller_id;
}
if (mask & ((uint32_t)1 << 18)) {
buffer_append_float16(send_buffer, NTC_TEMP_MOS1(), 1e1, &ind);