You spoke in your original post of an "easier way", while this is not exactly what you asked, I find it easier and so offer...
Keeping track of hours and minutes separately is unnecessary. For me, over and again, I have determined that a word value representing the minutes since midnight (a value of 0 to 1440) is clearer and easier to manipulate. Switching to hours and minutes is as easy as /60 for hours and MOD 60 for minutes. All calculations loose the clumsiness of handling hours and minutes separately and determining if dates change when subtracting or adding periods is less complicated.
It doesn't save any actual eeprom space, but it could reduce the typing by changing "lightsetHR(counterD),lightsetMN(counterD)," to SetTime(counterD) and "lightoffHR(counterD),lightoffMN(counterD)," to OnOffTime(counterD)
... just a thought.
Bookmarks