Electronics > Microcontrollers
Parsing UART packets / state machines / packed structs
abyrvalg:
uer166, the cmd in this protocol is that byte you’ve described as a fixed 01 actually. And the “cmd” from your description is a “param” (for cmd 01 it’s a register address), check my description here: https://github.com/etransport/ninebot-docs/wiki/protocol
This protocol is quite relaxed, lost packets are not a problem at all since the data changes slowly and is cached on both sides. The original M365 ECU maintains a full 256-byte cache of BMS’s registers and treats valid cmd 01 replies as cache syncs. There is no “request-response” pairing at all, the ECU is a real time device, it just sends read requests periodically and a separate superloop “task” handles responses in it’s time slots, caching new data at offsets specified by “param” field of the reply. All other ECU tasks use cached data.
What are you trying to achieve? Porting VESC to M365?
uer166:
--- Quote from: abyrvalg on December 10, 2022, 10:51:29 am ---What are you trying to achieve? Porting VESC to M365?
--- End quote ---
This is a new experimental dual BLDC (so I can have 2 hub motors) of my own design. I need to know the pack status and voltages, but no attempt is made to keep any compatibility of the original M365 bits with the exception of pack. With this much feedback there's lots to think about, although TBH I already have it working well enough for my needs. No decisions (e.g. graceful torque de-rating) would be made here based on the BMS data so the stakes aren't too high.
Perkele:
What you're describing is a fault of project lead, team lead or other person in charge to enforce rules. Most of people are slackers, they will invest minimum effort into uninteresting things. Documentation is boring.
Doxygen is only a tool, it all depends on how you use it. To be a bit controversial, I find it useful.
"Details" command is really useful, one might say the most important one, although rarely used in most of documentation.
For languages which use exceptions, a dedicated command to list and describe them is also really useful.
If making a documentation for a third party, you can make an introduction/main page with detailed desription on subpages. I find searchable and clickable HTML documents done this way more useful than a static document made in a text editor. "Just read the code, bro" might not be valid for compiled closed-source libraries. Yes, some of us still use those.
When trying to understand large codebases, graphing tool can help to figure-out the critical parts, or to compare the code with its design documentatio or class diagrams.
And at least in some editors there should be tools available to keep doxygen comments for classes and fuctions in sync and warn you if there is a mismatch. It really helps when an IDE gives has a mass rename of "refactoring" tool without a preview when executing it.
Nominal Animal:
--- Quote from: Perkele on December 11, 2022, 12:37:41 pm ---Doxygen is only a tool, it all depends on how you use it. To be a bit controversial, I find it useful.
--- End quote ---
Doxygen, and things like Python docstrings (visible via pydoc3), are very useful for documenting an API, for those using the module or library.
They do not help document the intent behind the code, needed for efficiently and effectively maintaining the module or library itself. In fact, they kinda-sorta steer away from it (documenting the programmer intent), which makes them less than useful for the code maintenance purposes.
Sherlock Holmes:
--- Quote from: uer166 on December 05, 2022, 06:13:16 pm ---
--- Quote from: Sherlock Holmes on December 05, 2022, 04:43:40 pm ---
--- Quote from: Siwastaja on December 05, 2022, 04:37:47 pm ---
--- Quote from: Sherlock Holmes on December 05, 2022, 04:29:46 pm ---You cannot counter someone's argument by simply insinuating they are incompetent, ignoring "facts" and so on.
--- End quote ---
Unlike you, nctnico is highly competent and I deeply respect his competence. He just has a few weird "blind spots" where his opinions, which are just matter of taste which I could accept as opinions, like disliking structs in networking and preferring bit manipulation reconstruction, make him close his eyes from objective facts. I'm sure he still does excellent job.
I have offered all the relevant information, unlike you; in other words, please get out of our argument, your comments are completely unhelpful. We have enough trolls on this forum already. Thank you in advance.
--- End quote ---
I see through this Sir, when you speak it is to be regarded as "facts" as "objectively true" but the words of another (who disagrees with you) are merely "opinions" as the words of one who has "closed" their eyes, has "blind spots".
You are a brave man indeed, hiding behind a keyboard and unhesitatingly insulting me and my presumed lack of competence. Is that how you speak to coworkers who dare to disagree with you? Is that really the way you'd communicate in person? I doubt it, I bet you're as nice as pie under those circumstances, nobody who bullies as you do here, would last long in the workplace.
--- End quote ---
If you have nothing technical to add to the discussion, feel free to avoid the thread. I don't mind technical discourse but this is not useful.
--- End quote ---
I did have something to add and said that here.
My other post was not directed at you but at another who's post was - IMHO - rude, demeaning and condescending.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version