diff options
Diffstat (limited to 'core/signal_processor.py')
| -rw-r--r-- | core/signal_processor.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/core/signal_processor.py b/core/signal_processor.py index bfb7ba3..8ab3937 100644 --- a/core/signal_processor.py +++ b/core/signal_processor.py @@ -380,7 +380,7 @@ class SignalProcessor(QObject): Applies filter pipelines to raw channel data, then evaluates all derived channels and emits processed_data for everything. - Connect: engine.new_data → processor.on_raw_data + Connect: engine.new_data → processor.on_raw_batch Connect: processor.processed_data → chart.on_new_data """ @@ -468,9 +468,16 @@ class SignalProcessor(QObject): # ── Main data path ──────────────────────────────────────────────────── - def on_raw_data(self, device_id: str, channel_id: str, - timestamp: float, value: float): - """Slot: receive raw data, apply filters, emit processed, update derived.""" + def on_raw_batch(self, timestamp: float, readings: List[Tuple[str, str, float]]): + """Slot: receive one tick's worth of raw readings, apply filters and + emit processed for each, then evaluate derived channels once for the + whole batch — not once per channel.""" + for device_id, channel_id, value in readings: + self._process_one(device_id, channel_id, timestamp, value) + self._evaluate_derived(timestamp) + + def _process_one(self, device_id: str, channel_id: str, + timestamp: float, value: float): key = (device_id, channel_id) # Apply filter pipeline @@ -485,9 +492,6 @@ class SignalProcessor(QObject): # Emit processed physical channel self.processed_data.emit(device_id, channel_id, timestamp, processed) - # Evaluate all derived channels whose sources include this channel - self._evaluate_derived(timestamp) - def _evaluate_derived(self, timestamp: float): with self._lock: derived = list(self._derived) |
