-
Notifications
You must be signed in to change notification settings - Fork 271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dangerous error produced in speed calculation for EBiCS display method #28
Comments
Looking into |
Also note that current UART transfer routines may not work with bluetooth serial adapters (connected to the controller's meter interface) featuring AT-like protocol before connection. In my case, bytes sent from the host device are always dislocated in the MCU receive buffer if I don't power on the serial adapter and connect to it before turning on the controller's power. It's probably caused by
My solution is to add this at the end of // restart DMA in case of the received data length isn't 12
HAL_UART_AbortReceive(&huart1); // this disables the DMA transfer too
if (HAL_UART_Receive_DMA(&huart1, (uint8_t *) ui8_rx_buffer, 12) != HAL_OK) {
// do not halt the program while riding, in case of it happens
//Error_Handler();
} |
In case of 2.2 m of wheel circumference, single magnet in the spokes:
When the speed reaches 4r/s (4 * 2.2 * 3.6 = 31.68 km/h), the interval measured by TIM3 is (1/f)/[1/(64M/7814)] = 8190/f = 8190/4 = 2048; the value in EBiCS is [(int)2200 / ((int)2048 >> 3)] * 36 / 10 = 28.8, nearly 2 km/h error produced.
you can draw two functions in the calculator
to see the maximum error 4.3 km/h. 29 km/h will be shown as 25 km/h!
I have extracted related code from your project (with many unindented code):
Thanks.
The text was updated successfully, but these errors were encountered: