Skip to content

Commit

Permalink
Merge pull request #5 from Metori/chime_hours_fix
Browse files Browse the repository at this point in the history
Fixed Chime hours bug
  • Loading branch information
aFewBits committed Mar 31, 2018
2 parents be933e2 + 89d262b commit 8d75563
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,23 +136,21 @@ void checkAlarm()

void checkChime()
{
uint8_t tCurrent,tStart,tStop,t;
uint8_t tCurrent,tStart,tStop;
__bit tFormat;
tFormat = Select_12;
changeTimeFormat(FALSE); // convert to 24 hour (maybe)
tCurrent = clockRam.hr;
tStart = clockRam.chimeStartHour;
tStop = clockRam.chimeStopHour;
changeTimeFormat(tFormat); // convert back to entry state
if (tStart > tStop){
t = tStart;
tStart = tStop;
tStop = t;
if (tStop >= tStart) {
if (tCurrent >= tStart && tCurrent <= tStop)
soundChime();
} else {
if (tCurrent >= tStart || tCurrent <= tStop)
soundChime();
}
if ( tCurrent >= tStart )
soundChime();
else if ( tCurrent <= tStop )
soundChime();
}

// soundChime - Toggle the buzzer on and off at alarm rate only once.
Expand Down

0 comments on commit 8d75563

Please sign in to comment.