Merge pull request #152 from Jfriesen222/dev_fw_5_00

Dev fw 5 00
This commit is contained in:
Benjamin Vedder 2020-04-09 09:21:17 +02:00 committed by GitHub
commit 72d0ae2e69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 63 additions and 14 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 2
#include "datatypes.h"
@ -132,12 +133,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"

View File

@ -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,20 +650,39 @@ 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);
}
#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");
@ -697,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));
@ -707,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");