Closed INemesisI closed 5 years ago
I'll look into this in the next couple of days
Thank you very much! After sleeping over it I noticed that adding the polarity to the setAlarm function makes no sense, since it would not work when using two alarms. So you can ignore the last part!
Made changes and implemented
If
setAlarmPolarity(1)
is called before setting an alarm throughsetAlarm()
the polarity will be forced to zero again. I don't think this is intended, since changing the polarity after setting up the alarm can cause the MFP to have the wrong polarity for the first few us.Affected line of code: https://github.com/SV-Zanshin/MCP7940/blob/0678a66569f9ea81a9d959c8c6cce5247a6916eb/src/MCP7940.cpp#L592
Fix: also keep the polarity bit. I also force the dow to be only 3 bit long to prevent an accidental overwrite.
Maybe it would also be beneficial to be able to set the polarity right in the
setAlarm()
function with an additional optional paramter?