Skip to content

Commit

Permalink
Add SettingsInterface Type
Browse files Browse the repository at this point in the history
  • Loading branch information
jsiegle committed Aug 28, 2023
1 parent 5635c15 commit ec5cc65
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 6 deletions.
13 changes: 8 additions & 5 deletions Source/NeuropixCanvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

}
Expand Down
4 changes: 3 additions & 1 deletion Source/Probes/Neuropixels2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

}

Expand Down Expand Up @@ -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()
Expand Down
6 changes: 6 additions & 0 deletions Source/UI/NeuropixInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ NeuropixInterface::NeuropixInterface(DataSource* p,

if (probe != nullptr)
{

type = SettingsInterface::PROBE_SETTINGS_INTERFACE;

basestation = probe->basestation;

probe->ui = this;
Expand Down Expand Up @@ -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;

Expand Down
2 changes: 2 additions & 0 deletions Source/UI/OneBoxInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
11 changes: 11 additions & 0 deletions Source/UI/SettingsInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_;
Expand All @@ -54,6 +63,8 @@ class SettingsInterface : public Component

virtual void updateInfoString() = 0;

Type type = UNKNOWN_SETTINGS_INTERFACE;

protected:

NeuropixThread* thread;
Expand Down

0 comments on commit ec5cc65

Please sign in to comment.