Style question for you... and this is style, no right or wrong answers...

When you integrated the BTSERIAL code and the SPEKTRUM code, it needed the #ifdefs that surround the call to computerc to suppress that call for both BTSERIAL and SPEKTRUM. You came up with a solution, namely the NOCOMPUTERC definition. The NOCOMPUTERC define itself is automatically defined (or not) depending on the presences/absences of the BTSERIAL and SPEKTRUM defines. This works, and works great.
I have two style questions, the second of which becomes moot if we make the adjustment I'm going to propose for the first... so I'll hold the second until you respond. The first question is this:
Throughout the code there are many areas where a given #ifdef needs to turn on (or off) code for multiple settings. In all cases, the #ifdef is structured something like
Code: Select all
#if !(defined(SPEKTRUM) || defined(BTSERIAL))
Code: Select all
#if defined(LOG_VALUES) || (POWERMETER == 1)
logMotorsPower();
#endif
This accomplishes the same thing. From a style perspective, in my opinion, this makes the code easier to read. The exact things that turn that particular #ifdef on or off are right there to see. When using an abstracted define like NOCOMPUTERC, the reader of the code must look in another module to find out what that means, and what define(s) turn it on or off.
Well, I've used the word "style" about 20 times already, but I want to repeat: Either way will work. I'm asking here to have this snippet of code follow the style already established in the rest of Multiwii code. In fact, I feel so strongly about this that I'm going to make the change in shared in a moment. Feel free to regress it out if you strongly disagree.
And, Alex, thoughts?