adafruit / Adafruit_Si5351_Library

Driver for Adafruit's Si5351 Clockgen Breakout
43 stars 30 forks source link

Error in ASSERT param #3

Closed dlchambers closed 2 years ago

dlchambers commented 5 years ago

Please take a look at lines 412 and 416 of Adafruit_SI5351.cpp ASSERT(m_si5351Config.plla_configured = true, ERROR_INVALIDPARAMETER); These are testing the assignment, not the value, and thus will always be true.

You probably intended: ASSERT((true==m_si5351Config.plla_configured), ERROR_INVALIDPARAMETER); (using the equality operator == rather than the assignment operator =) (and in general, when testing a value, it's best practice to put the constant as the lvalue, which would cause a "assigning to constant" compiler error in the original code).

Simplest (and most legible) code would be: ASSERT(m_si5351Config.plla_configured, ERROR_INVALIDPARAMETER); seeing as how plla_configured is a bool

ladyada commented 5 years ago

yeah! looks like it - good catch - wanna submit a PR? :)

dlchambers commented 5 years ago

Sure, how do I do that?

ladyada commented 5 years ago

https://learn.adafruit.com/an-introduction-to-collaborating-with-version-control is all about it :)

caternuson commented 2 years ago

Done with #14.