Tecsmith/DS3232RTC

TestRTC: setting alarm 1 always set SQI to sqiModeAlarmBoth

Opened this issue · 0 comments

Using the following test code:

        mode = alarmModeHoursMatch; // Match on full time
        bool a1 = RTC.isAlarmInterupt(1);
        bool a2 = RTC.isAlarmInterupt(2);
        if (alarmNum == 1) {
          a1 = true;
        } else {
          a2 = true;
        }
        Serial.println(a1);
        Serial.println(a2);            
        if (a1 && a2) {
          RTC.setSQIMode(sqiModeAlarmBoth);
          Serial.println("SET SQI 1 + 2");
        } else if (a1) {
          Serial.println("SET SQI 1");
          RTC.setSQIMode(sqiModeAlarm1);
        } else if (a2) {
          Serial.println("SET SQI 2");
          RTC.setSQIMode(sqiModeAlarm2);
        }

You can notice any combination will always generate
Serial.println("SET SQI 1 + 2");
Expected behaviour is that correct Serial is called and correct SQI is set.


        mode = alarmModeHoursMatch; // Match on full time
        bool a1 = RTC.isAlarmInterupt(1);
        bool a2 = RTC.isAlarmInterupt(2);
        Serial.println(a1);
        Serial.println(a2); 
        Serial.println(alarmNum);
        if (alarmNum == 1) {
          a1 = true;
        } else {
          a2 = true;
        }
        Serial.println(a1);
        Serial.println(a2);            
        if (a1 && a2) {
          RTC.setSQIMode(sqiModeAlarmBoth);
          Serial.println("SET SQI 1 + 2");
        } else if (a1) {
          Serial.println("SET SQI 1");
          RTC.setSQIMode(sqiModeAlarm1);
        } else if (a2) {
          Serial.println("SET SQI 2");
          RTC.setSQIMode(sqiModeAlarm2);
        }

always generates the first call to a1 and a2 to return 1 and 1 (true, true).
So possible error is in function RTC.isAlarmInterupt?