fix: a zero-width band fires on equality, not never; dead accessors removed

- The comment in `feed_window()` and three companion sites claimed a zero-width band
  "never fires, because no sample can be on a different side of it than its neighbour".
  That is false: `inside = value >= lo && value <= hi` with `lo == hi == 1.0` is true at
  +1 and false at -1, so a ±1 square fires 19 times in 20 samples.  The correct reason
  the panel refuses one is that it reduces the condition to a float-equality test on a
  real-valued signal, which in practice never fires (fix 4).
- `EventDetector::condition()`, `BufferSearch::channel()` and `BufferSearch::condition_`
  were confirmed unused by grep and deleted (fix 10).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Martino FerrariandClaude Opus 4.6 committed 2026-10-08 11:19:05 +02:00
1 parent 7aa9cf4664
commit 090b6bb57d
4 files changed
+2 -6

No files matched your search

+2 -2
View File
@@ -119,8 +119,8 @@ double EventDetector::feed_window(double value, double t) noexcept {
if (inside == inside_) return kNoEvent;
inside_ = inside;
// The event is the *change of side*, so `Rising` reads as "into the band" and `Falling`
// as "out of it". A band of zero width therefore never fires at all, because no sample
// can be on a different side of it than its neighbour: the panel refuses one.
// as "out of it". A band of zero width reduces the condition to an equality test on a
// real-valued signal, which is a float-equality test and therefore unusable: the panel refuses one.
const bool fired = (cond_.edge == TriggerEdge::Rising && inside) ||
(cond_.edge == TriggerEdge::Falling && !inside) ||
cond_.edge == TriggerEdge::Both;
-1
View File
@@ -72,7 +72,6 @@ class EventDetector {
double last_value() const noexcept { return prev_; }
bool have_last() const noexcept { return have_prev_; }
const EventCondition& condition() const noexcept { return cond_; }
private:
bool crossed_up(double v) const noexcept {
-1
View File
@@ -18,7 +18,6 @@ double ms_since(const std::chrono::steady_clock::time_point& t0) {
void BufferSearch::start(const EventCondition& c, int channel) {
clear();
condition_ = c;
channel_ = channel;
detector_.reset();
detector_.configure(c);
-2
View File
@@ -57,7 +57,6 @@ class BufferSearch {
bool pump(ScopeModel& model);
State state() const noexcept { return state_; }
int channel() const noexcept { return channel_; }
const std::vector<double>& hits() const noexcept { return hits_; }
/// Which hit the view is on, or -1 for none.
int cursor() const noexcept { return cursor_; }
@@ -77,7 +76,6 @@ class BufferSearch {
private:
EventDetector detector_{};
EventCondition condition_{};
int channel_ = -1;
State state_ = State::Idle;
bool started_ = false; ///< the index range has been established.