Jerry
I strongly agree with you.? Code organization and functions that contain blocking
code are important and a PITA.? At present I am working on code for some test equipment (Arduino based) which involves a main loop that has some serious timing
constraints.? Slow operation in my initial code was fixed when I converted blocking routines to non-blocking and then spaced the slower sections equally around the
loop, taking care to duplicate critical routines so that they appear multiple times in
a single pass around the loop.
When I added timing discovery points it revealed what was slowing things down
and indicated just where things needed to be moved, deleted, or changed.? In the
process of timing discovery I almost made a real-time version of my code, but
not quite.? John helped me with scaffolding which allowed my DEBUG routines
to become "if DEBUG" so that a compile could include or not include the DEBUG
parts.? Thanks John.? That was a big help.
Some of the C++ based library calls in the Arduino IDE appear to be poorly
constructed for my particular needs.? This caused me to rewrite a few of these
calls.? I think the lesson here is that the Arduino libraries in the IDE should not
be taken as the sacred last word in how to do things.? If you need a special
function call, do not be afraid to write it yourself.? These type things can then
be included in your code and do not need to be formalized and stored as
a library.
Arv
_._