From ef72c6b4673d54a181f41cae48db803a7ce69c72 Mon Sep 17 00:00:00 2001 From: Yannis Chatzikonstantinou Date: Thu, 6 Jun 2024 23:26:55 +0300 Subject: [PATCH 1/2] fix erroneous return during transform derivation --- firmware/src/sensor/sensors.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/firmware/src/sensor/sensors.c b/firmware/src/sensor/sensors.c index 1931c6bb..6cdbda28 100644 --- a/firmware/src/sensor/sensors.c +++ b/firmware/src/sensor/sensors.c @@ -308,7 +308,10 @@ bool sensors_calibrate_pole_pair_count_and_transforms(void) // Find pole pairs if not Hall; otherwise have to be defined manually if (sensor_get_type(commutation_sensor_p) != SENSOR_TYPE_HALL) { - return motor_find_pole_pairs(SENSOR_COMMON_RES_TICKS, commutation_frame_start, commutation_frame_end, motor_frame_end); + if (!motor_find_pole_pairs(SENSOR_COMMON_RES_TICKS, commutation_frame_start, commutation_frame_end, motor_frame_end)) + { + return false; + } } const float motor_frame_end_ticks = SENSOR_COMMON_RES_TICKS * (motor_frame_end / (TWOPI * motor_get_pole_pairs())); @@ -331,11 +334,11 @@ bool sensors_calibrate_pole_pair_count_and_transforms(void) frame_set_commutation_sensor_to_motor(t); } - if (commutation_sensor_p == position_sensor_p) + if (commutation_sensor_p == position_sensor_p) // same sensor { frame_set_position_sensor_to_motor(*(frame_commutation_sensor_to_motor_p())); } - else if (sensor_get_type(position_sensor_p) != SENSOR_TYPE_HALL) + else if (sensor_get_type(position_sensor_p) != SENSOR_TYPE_HALL) // different sensors, not Hall { frame_set_position_sensor_to_motor(derive_transform_2p(position_frame_start, 0, position_frame_end, motor_frame_end_ticks)); } From 307717a0a12ff2cb5422b214336aba726344673c Mon Sep 17 00:00:00 2001 From: Yannis Chatzikonstantinou Date: Thu, 6 Jun 2024 23:31:50 +0300 Subject: [PATCH 2/2] update expired discord link, once again :( --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 78c873b6..2a8d2b3f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ![FW Check Build](https://github.com/yconst/tinymovr/workflows/Tinymovr%20Firmware%20Check%2FBuild/badge.svg) ![Studio Lint Test](https://github.com/yconst/tinymovr/workflows/Tinymovr%20Studio%20Lint%2FTest/badge.svg) ![Docs Build](https://github.com/yconst/tinymovr/workflows/Tinymovr%20Docs%20Build/badge.svg) -[![Discord](https://img.shields.io/discord/742400176664084535)](https://discord.gg/CzcCaXbU) +[![Discord](https://img.shields.io/discord/742400176664084535)](https://discord.gg/UnmfuVzKuQ) [Tinymovr is an affordable motor controller](https://tinymovr.com) with integrated encoder and CAN bus for precise control of 3-phase brushless motors (PMSMs).