diff --git a/src/frontend/com_measure2.c b/src/frontend/com_measure2.c index 9db0c14da..5b947eacf 100644 --- a/src/frontend/com_measure2.c +++ b/src/frontend/com_measure2.c @@ -491,14 +491,13 @@ com_measure_when( crossCnt = 0; if (value < value2) { section = S_BELOW_VAL; - if ((prevValue <= value2) && (value >= value2)) { + if (prevValue >= prevValue2) { fallCnt = 1; crossCnt = 1; } - } else { section = S_ABOVE_VAL; - if ((prevValue <= value2) && (value >= value2)) { + if (prevValue < prevValue2) { riseCnt = 1; crossCnt = 1; } @@ -509,14 +508,13 @@ com_measure_when( crossCnt = 0; if (value < meas->m_val) { section = S_BELOW_VAL; - if ((prevValue <= meas->m_val) && (value >= meas->m_val)) { + if (prevValue >= meas->m_val) { fallCnt = 1; crossCnt = 1; } - } else { section = S_ABOVE_VAL; - if ((prevValue <= meas->m_val) && (value >= meas->m_val)) { + if (prevValue < meas->m_val) { riseCnt = 1; crossCnt = 1; }