On Sat, May 15, 2010 at 10:11:28AM -0500, Andy Pugh wrote:
> hostmot2: add support for three-phase pwm
Besides the whitespace problems I noted on irc, I didn't spot any
huge problems with the second revision of your patches.
I cleaned up the whitespace and tweaked a few other things, gave the
LEDs a test, then merged the whole thing to 'master'. It can be merged
to v2.4_branch later if we decide to do that (news that an actual
machine is moving with 3pwm would be a big encouragement towards that
end -- but it sounds like there's more needed to get to that point)
The most important change I made was in the LED write function. I
particularly want to note something that shouldn't be done -- namely,
comparing a 'bit' pin or parameter to true:
+ if (*hm2->led.instance[i].led == true) {
we've had bugs due to this in the past, because 'true' is just another
way of writing '1' but the range of values that can be stored in a 'bit'
is actually 0..255 (an unsigned char) and any value besides '0' is true
even though they're not all equal.
Instead, write simply
+ if (*hm2->led.instance[i].led) {
For the "testing for false" case, prefer to write
+ if (!*hm2->led.instance[i].led) {
so that you form the habit of never comparing to either true or false.
Jeff
------------------------------------------------------------------------------
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers