Refactored name of is_test_build, also added dual stuff to foc_detect_apply_all_can

This commit is contained in:
Jeffrey M. Friesen 2020-04-05 12:28:08 -07:00
parent 30f3d8e455
commit 1b67dc2666
3 changed files with 34 additions and 7 deletions

View File

@ -182,7 +182,7 @@ void commands_process_packet(unsigned char *data, unsigned int len,
ind += 12;
send_buffer[ind++] = app_get_configuration()->pairing_done;
send_buffer[ind++] = FW_IS_TEST_BUILD;
send_buffer[ind++] = FW_TEST_VERSION_NUMBER;
reply_func(send_buffer, ind);
} break;

View File

@ -23,7 +23,8 @@
// Firmware version
#define FW_VERSION_MAJOR 5
#define FW_VERSION_MINOR 00
#define FW_IS_TEST_BUILD 1
// Set to 0 for building a release and iterate during beta test builds
#define FW_TEST_VERSION_NUMBER 1
#include "datatypes.h"

View File

@ -661,6 +661,7 @@ void terminal_process_string(char *str) {
}
#ifdef HW_HAS_DUAL_MOTORS
mc_interface_select_motor_thread(2);
mcconf = mc_interface_get_configuration();
commands_printf("\nMOTOR 2\n");
commands_printf("Motor Current : %.1f A", (double)(mcconf->l_current_max));
commands_printf("Motor R : %.2f mOhm", (double)(mcconf->foc_motor_r * 1e3));
@ -681,7 +682,7 @@ void terminal_process_string(char *str) {
if (res == -10) {
commands_printf("Could not measure flux linkage.");
} else if (res == -11) {
commands_printf("Fault code occured during detection.");
commands_printf("Fault code occurred during detection.");
}
commands_printf("Detection failed.\n");
@ -719,6 +720,9 @@ void terminal_process_string(char *str) {
if (res >= 0) {
commands_printf("Detection finished and applied. Results:");
#ifdef HW_HAS_DUAL_MOTORS
commands_printf("\nMOTOR 1\n");
#endif
const volatile mc_configuration *mcconf = mc_interface_get_configuration();
commands_printf("Motor Current : %.1f A", (double)(mcconf->l_current_max));
commands_printf("Motor R : %.2f mOhm", (double)(mcconf->foc_motor_r * 1e3));
@ -729,20 +733,42 @@ void terminal_process_string(char *str) {
commands_printf("Temp Comp Base Temp : %.1f degC", (double)mcconf->foc_temp_comp_base_temp);
}
if (res == 0) {
if (mcconf->foc_sensor_mode == FOC_SENSOR_MODE_SENSORLESS) {
commands_printf("No sensors found, using sensorless mode.\n");
} else if (res == 1) {
} else if (mcconf->foc_sensor_mode == FOC_SENSOR_MODE_HALL) {
commands_printf("Found hall sensors, using them.\n");
} else if (res == 2) {
} else if (mcconf->foc_sensor_mode == FOC_SENSOR_MODE_ENCODER) {
commands_printf("Found AS5047 encoder, using it.\n");
} else {
commands_printf("Detection error: %d\n", res);
}
#ifdef HW_HAS_DUAL_MOTORS
mc_interface_select_motor_thread(2);
mcconf = mc_interface_get_configuration();
commands_printf("\nMOTOR 2\n");
commands_printf("Motor Current : %.1f A", (double)(mcconf->l_current_max));
commands_printf("Motor R : %.2f mOhm", (double)(mcconf->foc_motor_r * 1e3));
commands_printf("Motor L : %.2f microH", (double)(mcconf->foc_motor_l * 1e6));
commands_printf("Motor Flux Linkage : %.3f mWb", (double)(mcconf->foc_motor_flux_linkage * 1e3));
commands_printf("Temp Comp : %s", mcconf->foc_temp_comp ? "true" : "false");
if (mcconf->foc_sensor_mode == FOC_SENSOR_MODE_SENSORLESS) {
commands_printf("No sensors found, using sensorless mode.\n");
} else if (mcconf->foc_sensor_mode == FOC_SENSOR_MODE_HALL) {
commands_printf("Found hall sensors, using them.\n");
} else if (mcconf->foc_sensor_mode == FOC_SENSOR_MODE_ENCODER) {
commands_printf("Found AS5047 encoder, using it.\n");
} else {
commands_printf("Detection error: %d\n", res);
}
commands_printf("\nNote that this is only printing values of motors 1");
commands_printf("and 2 of the currently connected unit, other motors");
commands_printf("may have been detected, but won't be printed here");
#endif
} else {
if (res == -10) {
commands_printf("Could not measure flux linkage.");
} else if (res == -11) {
commands_printf("Fault code occured during detection.");
commands_printf("Fault code occurred during detection.");
}
commands_printf("Detection failed.\n");