static bool SetQSched(const KVPairs & key_value_pairs) { // So, we first end any schedule that's currently running by turning things off then on again. ReloadEvents(); int sched = -1; // Iterate through the kv pairs and update the appropriate structure values. for (int i = 0; i < key_value_pairs.num_pairs; i++) { const char * key = key_value_pairs.keys[i]; const char * value = key_value_pairs.values[i]; if ((key[0] == 'z') && (key[1] > 'a') && (key[1] <= ('a' + NUM_ZONES)) && (key[2] == 0)) { quickSchedule.zone_duration[key[1] - 'b'] = atoi(value); } if (strcmp(key, "sched") == 0) { sched = atoi(value); } } if (sched == -1) LoadSchedTimeEvents(0, true); else LoadSchedTimeEvents(sched); return true; }
// this version uses QuickSchedule mechanism, allows setting run time as well as multi-valve runs void manual_station_on(byte sid, int ontimer) { if( sid >= NUM_ZONES ) return; // basic protection, ensure that required zone number is within acceptable range // So, we first end any schedule that's currently running by turning things off then on again. ReloadEvents(); if( ActiveZoneNum() != -1 ){ // something is currently running, turn it off TurnOffZones(); runState.SetManual(false); } for( byte n=0; n<NUM_ZONES; n++ ){ quickSchedule.zone_duration[n] = 0; // clear up QuickSchedule to zero out run time for all zones } // set run time for required zone. // quickSchedule.zone_duration[sid] = ontimer; LoadSchedTimeEvents(0, true); }