-
Notifications
You must be signed in to change notification settings - Fork 75
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
Combined #15
Conversation
merge with main
should only send on uart 2 and 3 if serialsensordebug is defined
the header byte should be first as well as some optimizations, early release for @EmanuelFeru
wrong baud rate
… of the data, not the end.
you are missing the sensorcoms.h file as per #10 |
ok, so we need the reading code to process the packet if it hits another 0x1xx, and fill from what it has. (I think this is similar to what I had originally :). But I like the start of read trigger. Torn.... |
at some point we should move the background taskers into their own interrupt driven SM double sending makes me feel unclean. |
the extra data includes Roll and Acceleration. I use Roll (angle end-to-end) to indicate that the hoverboard should not operate if not on the floor - e.g. if you lift one end quite far :). I MAY use acceleration as an aid to motion control, but less likely now if you don't have it :(. |
make it able to read up to 20 words from sensor. Add a variable for the number of words read. make it process when expected words reached, or when 0x1xx is hit. Add a STM32 based HB sensor config to config.h. Add a STM32 based HB sensor config to platformio.ini.
@lalalandrus - please test. |
p.s. when you get it going, will be interesting to know if you get the occasional click (100ms interruption on a wheel). I'm thinking this could be a misread of sensors for me - maybe my baud rate is off by a small amount. |
seems to work, the quick test i did with pads and angle data is OK. those define names are getting long :D. |
doing some light diagnosis - something seems to be overwriting sensorlights :(. |
…times seeing !55 and !AA.....
ok, that's all for this morning. pls test again. If all good we'll pull. |
the code works but looking into the frame decoder, it seems like you implemented processing extra frames, while i dont see much value i think it has a memory bug where you dont guard against running out of data. in addition you dont latch the data, you may run into a race condition where the buffer indexes have changed after your 0x100 test but before your memcpy. it is late and i am doing the analysis in my head without testing so i may be completely wrong. also does process decrement anywhere? |
the intent is to eat all the bytes available. But the copy from the buffer should ONLY occur with a 'complete' buffer. Partial buffers left at the end are added to next time the routine is called by main( ). p.s. the main loop runs at nominal 5ms intervals, so we could expect 1-2 frames each poll (assuming my ~2.5ms calculation was right :) ). |
i finally get what you are doing. a couple notes: first there are some if statements that are redundant, second processing the data multiple times is pretty inefficient and i really cant seem to find the root cause of why you sometimes dont get a good frame. however, the code works well enough and compiles, we should just do the merge and optimize later as we know more changes are coming down the pipe |
on the bad frame; thinking of adding some real time tuning on the baud rate; mine is obviously also an estimate..... but wife is getting pretty pissed off with my time spent at the moment :(. |
@p-h-a-i-l - your thoughts on this pull are required.... it should not affect you two, so if you have tested, let me know or merge. |
if we have precise timing as you pointed out in the other thread we just have to do a min time of a bunch of pulse interrupts to equate the uart baud. haha same here with my wife, i just justify it with that a 3rd hoverboard i got for free is destined for the daughters powerwheel jeep |
@lalalandrus - fixes to console output and timeout code. |
I'm not using this fork "in production" since it was a bit unstable for me (ouch..) Since I'm also spending way too much time on this project at the moment, I'll flash this branch quickly.. Sitting in front of a bench test setup anyways :) |
cost of progress, i think things will calm down once we get over a few more merges |
Tested bot UARTs with protocol, looking good! |
Sensor rework based on assumption that 0x1xx represents the START of the message to the sensor boards.
use with the similar pull request on hbprotocol.