-
Notifications
You must be signed in to change notification settings - Fork 929
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
USART input gets converted to 0 #157
Comments
Hi, It's not a bug. This type is initialized somewhere else. Wow the python code is so simple. It's definitely useful for others. |
Hi, this poti/calibration stuff applies to ADC control variant, right? I was talking about USART control variant as defined in config.h. There, the typ is 3. Maybe I missed some getting started section, but the only way I could got the USART variant running, was by fixing the line above in util.c. Or should the typ for USART be 2 in the first place? |
Calibration can run for any variant, and is saved to eeprom so it's conserved even if you flash. |
Okay, so if I leave the typ to 3, I would need to press the button for 5 sec and then send -1000 and 1000 via USART in order to get this variant running? In the Wiki is stated that no calibration is needed for USART. Also, as values are deterministic, I would say no calibration should be necessary. |
No if you leave type as 3, it will determine the type based on min, mid and max values from config.h, so type will become 2 (mid-resting pot).You don't have to run the auto-calibration procedure. I still think you ran it by mistake/without knowing, and type was set to 0 for both inputs. Erasing and flashing will get you back to normal. |
"The cmd of input is set to 0, when the typ of input is other than 1 or 2:" I've encountered this when unknowingly entering autocal. I would recommend printing an error message if you ever get to "other than 1 or 2" condition in the input calculation. |
I see, the input type gets re-defined in
This could be true in my case too. I pressed the button long to make sure the power latch is not released when flashing. |
There is a small, but critical bug which results in USART input always getting replaced by 0.
The
cmd
of input is set to 0, when thetyp
of input is other than 1 or 2:https://github.com/EmanuelFeru/hoverboard-firmware-hack-FOC/blob/0709e4cb62ef1d0bfedfc6bc3187614d5862acd6/Src/util.c#L794
Yet, the
typ
for USART is 3:https://github.com/EmanuelFeru/hoverboard-firmware-hack-FOC/blob/0709e4cb62ef1d0bfedfc6bc3187614d5862acd6/Inc/config.h#L321
My quick fix was
Btw, I tested the USART via Python, because I had no Arduino laying around. Maybe you are interested in adding the following code as a test script.
The text was updated successfully, but these errors were encountered: