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