mirror of https://github.com/rusefi/bldc.git
Cleaned up detect_apply_all terminal command for dual hardware
This commit is contained in:
parent
ef37c70911
commit
0bb5b2d99c
|
@ -131,12 +131,12 @@
|
|||
//#define HW_SOURCE "hw_100_250.c"
|
||||
//#define HW_HEADER "hw_100_250.h"
|
||||
|
||||
#define HW_SOURCE "hw_unity.c"
|
||||
#define HW_HEADER "hw_unity.h"
|
||||
//#define HW_SOURCE "hw_unity.c"
|
||||
//#define HW_HEADER "hw_unity.h"
|
||||
|
||||
//#define HW_DUAL_CONFIG_PARALLEL
|
||||
//#define HW_SOURCE "hw_stormcore_100d.c"
|
||||
//#define HW_HEADER "hw_stormcore_100d.h"
|
||||
#define HW_SOURCE "hw_stormcore_100d.c"
|
||||
#define HW_HEADER "hw_stormcore_100d.h"
|
||||
|
||||
//#define HW_SOURCE "hw_stormcore_60d.c"
|
||||
//#define HW_HEADER "hw_stormcore_60d.h"
|
||||
|
|
28
terminal.c
28
terminal.c
|
@ -633,10 +633,14 @@ void terminal_process_string(char *str) {
|
|||
int res = conf_general_detect_apply_all_foc(max_power_loss, true, true);
|
||||
|
||||
commands_printf("Res: %d", res);
|
||||
mc_interface_select_motor_thread(1);
|
||||
|
||||
if (res >= 0) {
|
||||
commands_printf("Detection finished and applied. Results:");
|
||||
const volatile mc_configuration *mcconf = mc_interface_get_configuration();
|
||||
#ifdef HW_HAS_DUAL_MOTORS
|
||||
commands_printf("\nMOTOR 1\n");
|
||||
#endif
|
||||
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));
|
||||
|
@ -646,15 +650,33 @@ 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);
|
||||
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);
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
if (res == -10) {
|
||||
commands_printf("Could not measure flux linkage.");
|
||||
|
|
Loading…
Reference in New Issue