Updated local storage
This commit is contained in:
1 parent
30db44eaa0
commit
2218aed839
10 files changed
+548
-5
No files matched your search
@@ -184,6 +184,12 @@ void ScopeModel::rebuild_channels() {
|
||||
ch.unit = sig.unit;
|
||||
ch.elements = sig.elements();
|
||||
ch.dt = sig.sampling_rate > 0.0 ? 1.0 / sig.sampling_rate : 0.0;
|
||||
// A calibration the user already set for this name (before it was enabled, or
|
||||
// before a CONFIG renumbered the channels) still applies.
|
||||
if (auto it = calibration_.find(sig.name); it != calibration_.end()) {
|
||||
ch.gain = it->second.first;
|
||||
ch.offset = it->second.second;
|
||||
}
|
||||
channels_.push_back(std::move(ch));
|
||||
}
|
||||
}
|
||||
@@ -277,6 +283,7 @@ void ScopeModel::set_signal_enabled(std::size_t signal, bool on) {
|
||||
|
||||
void ScopeModel::set_calibration(std::size_t signal, double gain, double offset) {
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
if (signal < signals_.size()) calibration_[signals_[signal].name] = {gain, offset};
|
||||
bool any = false;
|
||||
for (ChannelInfo& c : channels_) {
|
||||
if (c.signal != signal) continue;
|
||||
|
||||
Reference in new issue
Block a user