diff --git a/opensprinkler_server.cpp b/opensprinkler_server.cpp index 44e716d3..e21976d0 100644 --- a/opensprinkler_server.cpp +++ b/opensprinkler_server.cpp @@ -910,6 +910,15 @@ void server_change_program(OTF_PARAMS_DEF) { *(char*)(&prog) = parse_listdata(&pv); prog.days[0]= parse_listdata(&pv); prog.days[1]= parse_listdata(&pv); + + if (prog.type == PROGRAM_TYPE_INTERVAL) { + if (prog.days[1] == 0) handle_return(HTML_DATA_OUTOFBOUND) + else if (prog.days[1] >= 1) { + // process interval day remainder (relative-> absolute) + pd.drem_to_absolute(prog.days); + } + } + // parse start times pv++; // this should be a '[' for (i=0;i absolute) - if (prog.type == PROGRAM_TYPE_INTERVAL && prog.days[1] >= 1) { - pd.drem_to_absolute(prog.days); - } - if (pid==-1) { if(!pd.add(&prog)) handle_return(HTML_DATA_OUTOFBOUND); } else { diff --git a/program.h b/program.h index b3d6d8db..f2dea6aa 100644 --- a/program.h +++ b/program.h @@ -81,7 +81,7 @@ class ProgramStruct { // weekly: days[0][0..6] correspond to Monday till Sunday // bi-weekly:days[0][0..6] and [1][0..6] store two weeks // monthly: days[0][0..5] stores the day of the month (32 means last day of month) - // interval: days[0] stores the interval (0 to 255), days[1] stores the starting day remainder (0 to 254) + // interval: days[1] stores the interval (0 to 255), days[0] stores the starting day remainder (0 to 254) unsigned char days[2]; // When the program is a fixed start time type: