rszimm / sprinklers_pi

Sprinkling System Control Program for the Raspberry Pi
GNU General Public License v2.0
310 stars 100 forks source link

Schedules crossing midnight do not complete #29

Closed vaniwaar closed 5 years ago

vaniwaar commented 10 years ago

I scheduled the yard system to run at 11:30 at night. The first zone took 27 minutes, the second zone took 25 minutes and then no more zones went. I haven't had a chance to really get into the code yet but will see what I can find. For now, I have changed my schedule to just start after midnight...

rszimm commented 10 years ago

This is verified as a known bug. Schedules crossing midnight will be cut short. Working on a fix. Sorry...

vaniwaar commented 10 years ago

Just saw the TODO note in core.cpp...

Do want to say that this is a wonderful piece of software and I am deeply appreciative of your writing it. For about $150 I have a web based sprinkler control system that is many times more powerful than any of the ones I can buy off the shelf and I get SOURCE CODE!

vaniwaar commented 10 years ago

This code adjusts the schedule for events after midnight I believe

void RemoveEventsNotScheduledAfterMidnight() { int newNumEvents = 0; for (int i=0; i < iNumEvents; ++i) { if (events[i].time > 1440) { events[i].time -= 1440; events[newNumEvents++] = events[i]; } } iNumEvents = newNumEvents; }

Then the top of ReloadEvents then becomes void ReloadEvents(bool bAllEvents) { if (false == bAllEvents) { ClearEvents(); TurnOffZones(); } else { RemoveEventsNotScheduledAfterMidnight(); }

Pascal66 commented 9 years ago

Just remove clearEvent() and forget TurnOffZone() this will merge the newer event

Whytehorse commented 6 years ago

where is the code to correct? this bug also affects me