OpenSprinkler › Forums › OpenSprinkler Unified Firmware › Clarification for API function › Reply To: Clarification for API function
You are correct that when using the /mp (manual program) API, all existing running and queued stations will be reset before starting the new program. Technically this is due to this line of code:
Generally when you manually start a program, you want to stop the existing programs because it’s understood that you want to immediately run the manually started program. But to clarify: this only affect stations that are in the queue at the time when /mp is called. For example, if you have a program that runs multiple times during the day, say, at 8am, 10am, noon, 2pm, 4pm. And let’s say you are triggering a manual program run at 10:01am, it only affects the run that started at 10am and won’t affect the noon, 2pm, and 4pm runs. In other words, the scheduler only queues stations at the start time of each run — it does not queue the entire day’s schedule at once.
If you manually start two separate programs at the same time, whatever started later will override the previous one (i.e. the queue is reset before a new manual program is launched). This behavior can be changed by commenting out the ‘reset_all_stations_immediate()’ line (also in manual_start_program function). But this does require you to recompile the firmware yourself.
Another work-around is to leverage the /mp (modify program) API to change the start time to something immediate, like 1 minute from the current time. This way the scheduler will automatically run the program at the specified time (which is almost immediate), and programs started this way will not override the existing stations in the queue.