void ValveController::changeValveState(bool ignoreDelay, e_valveState state) { if (!ignoreDelay && m_stateIsForced) { #ifdef DEBUG Serial.print(F("Told to change valve state on pin ")); Serial.print(m_valveSignalPin); Serial.print(F(" while in a forced state. State: ")); Serial.println(state); #endif if (m_suggestedState != state) { m_suggestedState = state; } return; } if (!ignoreDelay && !delayExpired()) { #ifdef DEBUG Serial.print(F("Told to change valve state on pin ")); Serial.print(m_valveSignalPin); Serial.print(F(" before delay finish. State:")); Serial.println(state); #endif if (m_suggestedState != state) { m_suggestedState = state; } return; } if (ignoreDelay && !m_stateIsForced) { #ifdef DEBUG Serial.print(F("Forcing change of valve state on pin ")); Serial.println(m_valveSignalPin); #endif if (m_suggestedState == UNDEF) { m_suggestedState = m_valveState; } m_stateIsForced = true; m_isStateForced = true; } if (m_valveState != state) { m_valveState = state; switch(state) { case OPEN: digitalWrite(m_valveSignalPin, HIGH); break; case CLOSED: digitalWrite(m_valveSignalPin, LOW); break; } #ifdef DEV Serial.print(F("VALVE ON PIN ")); Serial.print(m_valveSignalPin); Serial.print(F(" SET TO STATE: ")); Serial.println(state); #endif notify(); } resetDelay(); }
void Filesystem::prepareScan(QString dirPath) { if(!Uploader::instance()->isOnline()) return; if(isDelayActive(dirPath)) { resetDelay(dirPath); } else { insertDelay(dirPath); } }
//------------------------------------------------------------------------- // resetBuffer : // delete contents of buffer and instantiate a new buffer //------------------------------------------------------------------------- void CrossDelayLine::resetBuffer(){ if(buffer) delete [] buffer; buffer = new float[MAX_DELAY_SAMPLES]; resetDelay(); setDelayTimeMS(44100,delay_ms); return; }