Skip to content

Commit

Permalink
Brake: simplify scratch stop requirement
Browse files Browse the repository at this point in the history
  • Loading branch information
ronso0 committed Mar 27, 2022
1 parent 2a36be6 commit 0932604
Showing 1 changed file with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -666,10 +666,7 @@ void ControllerScriptInterfaceLegacy::scratchProcess(int timerId) {
return;
}

const double oldRate = filter->predictedVelocity();

// Give the filter a data point:

// If we're ramping to end scratching and the wheel hasn't been turned very
// recently (spinback after lift-off,) feed fixed data
if (m_ramp[deck] && !m_softStartActive[deck] &&
Expand Down Expand Up @@ -701,14 +698,11 @@ void ControllerScriptInterfaceLegacy::scratchProcess(int timerId) {

// End scratching if we're ramping and the current rate is really close to the rampTo value
if ((m_ramp[deck] && fabs(m_rampTo[deck] - newRate) <= 0.00001) ||
// or if we brake or softStart and have crossed over the desired value,
((m_brakeActive[deck] || m_softStartActive[deck]) &&
((oldRate > m_rampTo[deck] && newRate < m_rampTo[deck]) ||
(oldRate < m_rampTo[deck] &&
newRate > m_rampTo[deck]))) ||
// or if we have crossed over the desired value during brake or softStart
(m_brakeActive[deck] && newRate < m_rampTo[deck]) ||
(m_softStartActive[deck] && newRate > m_rampTo[deck]) ||
// or if the deck was stopped manually during brake or softStart
((m_brakeActive[deck] || m_softStartActive[deck]) &&
(!isDeckPlaying(group)))) {
((m_brakeActive[deck] || m_softStartActive[deck]) && !isDeckPlaying(group))) {
// Not ramping no mo'
m_ramp[deck] = false;

Expand Down

0 comments on commit 0932604

Please sign in to comment.