From ec5cc6581a75170fdfb472e0e3fa57eb087eef8d Mon Sep 17 00:00:00 2001 From: Josh Siegle Date: Mon, 28 Aug 2023 12:26:33 -0700 Subject: [PATCH] Add SettingsInterface Type --- Source/NeuropixCanvas.cpp | 13 ++++++++----- Source/Probes/Neuropixels2.cpp | 4 +++- Source/UI/NeuropixInterface.cpp | 6 ++++++ Source/UI/OneBoxInterface.cpp | 2 ++ Source/UI/SettingsInterface.h | 11 +++++++++++ 5 files changed, 30 insertions(+), 6 deletions(-) diff --git a/Source/NeuropixCanvas.cpp b/Source/NeuropixCanvas.cpp index 09c5842..1d175bb 100644 --- a/Source/NeuropixCanvas.cpp +++ b/Source/NeuropixCanvas.cpp @@ -175,12 +175,15 @@ void NeuropixCanvas::applyParametersToAllProbes(ProbeSettings p) { for (auto settingsInterface : settingsInterfaces) { - if (settingsInterface->applyProbeSettings(p, false)) + if (settingsInterface->type == SettingsInterface::PROBE_SETTINGS_INTERFACE) { - NeuropixInterface* ni = (NeuropixInterface*)settingsInterface; - p.probe = ni->probe; - p.probe->updateSettings(p); - thread->updateProbeSettingsQueue(p); + if (settingsInterface->applyProbeSettings(p, false)) + { + NeuropixInterface* ni = (NeuropixInterface*)settingsInterface; + p.probe = ni->probe; + p.probe->updateSettings(p); + thread->updateProbeSettingsQueue(p); + } } } diff --git a/Source/Probes/Neuropixels2.cpp b/Source/Probes/Neuropixels2.cpp index 87b7038..085ed85 100644 --- a/Source/Probes/Neuropixels2.cpp +++ b/Source/Probes/Neuropixels2.cpp @@ -219,7 +219,7 @@ void Neuropixels2::selectElectrodes() } - LOGD("Updating electrode settings for slot: ", basestation->slot, " port: ", headstage->port, " dock: ", dock); + LOGD("Updated electrode settings for slot: ", basestation->slot, " port: ", headstage->port, " dock: ", dock); } @@ -352,6 +352,8 @@ void Neuropixels2::setAllReferences() refId, refElectrodeBank); + LOGD("Updated reference for slot: ", basestation->slot, " port: ", headstage->port, " dock: ", dock, " to ", refId); + } void Neuropixels2::writeConfiguration() diff --git a/Source/UI/NeuropixInterface.cpp b/Source/UI/NeuropixInterface.cpp index 084308d..f9dbbb3 100644 --- a/Source/UI/NeuropixInterface.cpp +++ b/Source/UI/NeuropixInterface.cpp @@ -45,6 +45,9 @@ NeuropixInterface::NeuropixInterface(DataSource* p, if (probe != nullptr) { + + type = SettingsInterface::PROBE_SETTINGS_INTERFACE; + basestation = probe->basestation; probe->ui = this; @@ -403,6 +406,9 @@ NeuropixInterface::NeuropixInterface(DataSource* p, probeSettingsLabel->setColour(Label::textColourId, Colours::grey); addAndMakeVisible(probeSettingsLabel); } + else { + type = SettingsInterface::BASESTATION_SETTINGS_INTERFACE; + } int verticalOffset = 550; diff --git a/Source/UI/OneBoxInterface.cpp b/Source/UI/OneBoxInterface.cpp index fc9b63f..9d6a2cf 100644 --- a/Source/UI/OneBoxInterface.cpp +++ b/Source/UI/OneBoxInterface.cpp @@ -102,6 +102,8 @@ OneBoxInterface::OneBoxInterface(DataSource* dataSource_, NeuropixThread* thread adc->ui = this; dac = adc->dac; + type = SettingsInterface::ONEBOX_SETTINGS_INTERFACE; + for (int ch = 0; ch < 12; ch++) { AdcChannelButton* button = new AdcChannelButton(ch); diff --git a/Source/UI/SettingsInterface.h b/Source/UI/SettingsInterface.h index 8dfbbba..2b1835c 100644 --- a/Source/UI/SettingsInterface.h +++ b/Source/UI/SettingsInterface.h @@ -35,6 +35,15 @@ class NeuropixCanvas; class SettingsInterface : public Component { public: + + enum Type + { + PROBE_SETTINGS_INTERFACE, + ONEBOX_SETTINGS_INTERFACE, + BASESTATION_SETTINGS_INTERFACE, + UNKNOWN_SETTINGS_INTERFACE + }; + SettingsInterface(DataSource* dataSource_, NeuropixThread* thread_, NeuropixEditor* editor_, NeuropixCanvas* canvas_) { dataSource = dataSource_; @@ -54,6 +63,8 @@ class SettingsInterface : public Component virtual void updateInfoString() = 0; + Type type = UNKNOWN_SETTINGS_INTERFACE; + protected: NeuropixThread* thread;