Updated hall_analyze deviation calculation

This commit is contained in:
Benjamin Vedder 2020-04-03 23:26:14 +02:00
parent 1016ab076b
commit f9bbb3c0e6
1 changed files with 5 additions and 4 deletions

View File

@ -880,12 +880,13 @@ void terminal_process_string(char *str) {
} }
} }
if ((max - min) <= 5) { float deviation = (max - min) / 2.0;
commands_printf("Maximum deviation: %.2f degrees. This is good alignment.\n", (double)(max - min)); if (deviation < 5) {
commands_printf("Maximum deviation: %.2f degrees. This is good alignment.\n", (double)deviation);
} else if ((max - min) < 10) { } else if ((max - min) < 10) {
commands_printf("Maximum deviation: %.2f degrees. This is OK, but not great alignment.\n", (double)(max - min)); commands_printf("Maximum deviation: %.2f degrees. This is OK, but not great alignment.\n", (double)deviation);
} else if ((max - min) < 15) { } else if ((max - min) < 15) {
commands_printf("Maximum deviation: %.2f degrees. This is bad, but probably usable alignment.\n", (double)(max - min)); commands_printf("Maximum deviation: %.2f degrees. This is bad, but probably usable alignment.\n", (double)deviation);
} else { } else {
commands_printf("Maximum deviation: %.2f degrees. The hall sensors are significantly misaligned. This has " commands_printf("Maximum deviation: %.2f degrees. The hall sensors are significantly misaligned. This has "
"to be fixed for proper operation.\n", (double)(max - min)); "to be fixed for proper operation.\n", (double)(max - min));