I have minor suggestions: name the states in your state machine. Constants / preprocessor labels are "free."
When you finish processing a command reset the front and rear for the receive buffer to zero. Using a wrapround queue is probably making the code more complicated / less efficient. Log to your debug port if you overflow your buffer. Check the checksum on incoming requests and log if they are corrupt. Head and tail names seems reverse of what is typical. It is a little disorienting. Also a comment that you're relying on the receive buffer being exactly 256 bytes and the indices being bytes deserves a comment. -- John. On Tue, Oct 15, 2019, 12:22 PM Gary Hammond <[email protected]> wrote: > I woke up this morning to an inbox full of useful suggestions and ideas, > and the amount of excellent quality feedback has been amazing. > > I now have a bunch of work to do to try some of the ideas and do some > further investigation. > > This list is awesome! > > > > A few of quotes from my career as a software developer… > > “Who wrote this crap!…(looks at SVN blame)…oh. It was me ☹” > > “If you get N software developers to come up with a solution, you will get > N+1 solutions to the problem” > > “Sometimes there are many solutions to the same problem, and the > differences in choosing which one is the ‘right’ one comes down to personal > preferences.” >
