diff --git a/Source/NeuropixCanvas.cpp b/Source/NeuropixCanvas.cpp index 45f702f..2ac6555 100644 --- a/Source/NeuropixCanvas.cpp +++ b/Source/NeuropixCanvas.cpp @@ -87,6 +87,8 @@ NeuropixCanvas::NeuropixCanvas (GenericProcessor* processor_, NeuropixEditor* ed topLevelTabComponent = std::make_unique (editor, true); addAndMakeVisible (topLevelTabComponent.get()); + LOGC ("Creating new NeuropixCanvas"); + Array availableBasestations = thread->getBasestations(); int topLevelTabNumber = 0; @@ -99,6 +101,8 @@ NeuropixCanvas::NeuropixCanvas (GenericProcessor* processor_, NeuropixEditor* ed basestationTab, true); + LOGC ("Adding tab for ", String (" Slot " + String (basestation->slot) + " ")); + basestationTab->setTabBarDepth (26); basestationTab->setIndent (0); // gap to leave around the edge basestationTab->setOutline (0); @@ -111,13 +115,6 @@ NeuropixCanvas::NeuropixCanvas (GenericProcessor* processor_, NeuropixEditor* ed topLevelTabComponent->setCurrentTabIndex (topLevelTabNumber - 1); - //neuropixViewport->setViewedComponent(settingsInterfaces.getFirst(), false); - //addAndMakeVisible(neuropixViewport); - - //settingsInterfaces[0]->viewport->setVisible(true); - - //resized(); - savedSettings.probeType = ProbeType::NONE; } @@ -129,6 +126,8 @@ void NeuropixCanvas::populateSourceTabs(Basestation* basestation, CustomTabCompo int basestationTabNumber = 0; + LOGC ("Found ", probeCount, " probes in slot ", basestation->slot, " with ", availableDataSources.size(), " data sources") + for (auto source : availableDataSources) { if (source->sourceType == DataSourceType::PROBE && source->basestation == basestation) diff --git a/Source/NeuropixEditor.cpp b/Source/NeuropixEditor.cpp index 36665ca..058928d 100644 --- a/Source/NeuropixEditor.cpp +++ b/Source/NeuropixEditor.cpp @@ -26,6 +26,7 @@ #include "NeuropixCanvas.h" #include "NeuropixComponents.h" #include "NeuropixThread.h" +#include "UI/NeuropixInterface.h" RefreshButton::RefreshButton() : Button ("Refresh") { @@ -778,7 +779,8 @@ void NeuropixEditor::comboBoxChanged (ComboBox* comboBox) if (asOutput) { thread->setSyncOutput (slotIndex); - syncFrequencyLabel->setVisible (true); + if(background->numBasestations > 0) + syncFrequencyLabel->setVisible (true); background->setFreqSelectAvailable (true); } else @@ -881,6 +883,15 @@ void NeuropixEditor::buttonClicked (Button* button) btn->stopTimer(); } + for (auto& settingsInterface : canvas->settingsInterfaces) + { + if (settingsInterface->type == SettingsInterface::PROBE_SETTINGS_INTERFACE) + { + NeuropixInterface* ni = (NeuropixInterface*) settingsInterface; + ni->probe = nullptr; + } + } + if (thread->getBasestations()[0]->type == BasestationType::SIMULATED) { uiLoaderWithProgressWindow->updateProbeMap(); // call outside of thread @@ -889,6 +900,7 @@ void NeuropixEditor::buttonClicked (Button* button) { thread->isRefreshing = true; uiLoaderWithProgressWindow->runThread(); + LOGD ("Finished refresh thread."); } LOGD ("Resetting canvas..."); @@ -898,6 +910,7 @@ void NeuropixEditor::buttonClicked (Button* button) LOGD ("Updating settings interfaces..."); for (auto& interface : canvas->settingsInterfaces) { + for (auto probe : thread->getProbes()) { if (interface->dataSource != nullptr && interface->dataSource->getName() == probe->getName()) @@ -1052,7 +1065,8 @@ void NeuropixEditor::loadVisualizerEditorParameters (XmlElement* xml) { inputOutputSyncSelector->setSelectedItemIndex (1, dontSendNotification); thread->setSyncOutput (mainSyncSlotIndex); - syncFrequencyLabel->setVisible (true); + if(background->numBasestations > 0) + syncFrequencyLabel->setVisible (true); background->setFreqSelectAvailable (true); // syncFrequencySelector->setSelectedItemIndex (frequencyIndex, dontSendNotification); thread->setSyncFrequency (mainSyncSlotIndex, frequencyIndex); diff --git a/Source/NeuropixEditor.h b/Source/NeuropixEditor.h index 7dd61b9..ba09db1 100644 --- a/Source/NeuropixEditor.h +++ b/Source/NeuropixEditor.h @@ -120,11 +120,12 @@ class EditorBackground : public Component, public ComponentListener slotButtons[i]->isEnabled = isEnabled; } + int numBasestations; + private: /** Draws the background */ void paint (Graphics& g); - int numBasestations; bool freqSelectEnabled; /* An array of Basestation objections, one for each basestation detected */ diff --git a/Source/NeuropixThread.cpp b/Source/NeuropixThread.cpp index 7cd0035..6d78d82 100644 --- a/Source/NeuropixThread.cpp +++ b/Source/NeuropixThread.cpp @@ -455,6 +455,8 @@ void NeuropixThread::updateStreamInfo (bool enabledStateChanged) } } } + + LOGD ("Finished updating stream info"); } NeuropixThread::~NeuropixThread() diff --git a/Source/UI/NeuropixInterface.cpp b/Source/UI/NeuropixInterface.cpp index cee1115..85cee3b 100644 --- a/Source/UI/NeuropixInterface.cpp +++ b/Source/UI/NeuropixInterface.cpp @@ -1503,9 +1503,6 @@ bool NeuropixInterface::applyProbeSettings (ProbeSettings p, bool shouldUpdatePr return false; } - //if (electrodeConfigurationComboBox != 0) - // electrodeConfigurationComboBox->setSelectedId(p.electrodeConfigurationIndex + 2, dontSendNotification); - // update display if (apGainComboBox != 0) apGainComboBox->setSelectedId (p.apGainIndex + 1, dontSendNotification); @@ -1570,6 +1567,9 @@ bool NeuropixInterface::applyProbeSettings (ProbeSettings p, bool shouldUpdatePr } } + probe->updateNamingScheme (basestation->getNamingScheme()); + updateInfoString(); + // apply settings in background thread if (shouldUpdateProbe) { @@ -1876,28 +1876,32 @@ void NeuropixInterface::loadParameters (XmlElement* xml) String PN = xmlNode->getStringAttribute ("probe_part_number"); ProbeType type = ProbeType::NP1; - if (PN.equalsIgnoreCase ("NP1010")) + if (PN.equalsIgnoreCase ("NP1010") || PN.equalsIgnoreCase ("NP1011") || PN.equalsIgnoreCase ("NP1012") || PN.equalsIgnoreCase ("NP1013") + || PN.equalsIgnoreCase ("NP1015") || PN.equalsIgnoreCase ("NP1016")) type = ProbeType::NHP10; - else if (PN.equalsIgnoreCase ("NP1020") || PN.equalsIgnoreCase ("NP1021")) + else if (PN.equalsIgnoreCase ("NP1020") || PN.equalsIgnoreCase ("NP1021") || PN.equalsIgnoreCase ("NP1022")) type = ProbeType::NHP25; - else if (PN.equalsIgnoreCase ("NP1030") || PN.equalsIgnoreCase ("NP1031")) + else if (PN.equalsIgnoreCase ("NP1030") || PN.equalsIgnoreCase ("NP1031") || PN.equalsIgnoreCase ("NP1032")) type = ProbeType::NHP45; else if (PN.equalsIgnoreCase ("NP1200") || PN.equalsIgnoreCase ("NP1210")) type = ProbeType::NHP1; - else if (PN.equalsIgnoreCase ("PRB2_1_2_0640_0") || PN.equalsIgnoreCase ("NP2000")) + else if (PN.equalsIgnoreCase ("PRB2_1_2_0640_0") || PN.equalsIgnoreCase ("NP2000") || PN.equalsIgnoreCase ("NP2003") || PN.equalsIgnoreCase ("NP2004")) type = ProbeType::NP2_1; - else if (PN.equalsIgnoreCase ("PRB2_4_2_0640_0") || PN.equalsIgnoreCase ("NP2010")) + else if (PN.equalsIgnoreCase ("PRB2_4_2_0640_0") || PN.equalsIgnoreCase ("NP2010") || PN.equalsIgnoreCase ("NP2013") || PN.equalsIgnoreCase ("NP2014")) type = ProbeType::NP2_4; - else if (PN.equalsIgnoreCase ("PRB_1_4_0480_1") || PN.equalsIgnoreCase ("PRB_1_4_0480_1_C")) + else if (PN.equalsIgnoreCase ("NP2020")) + type = ProbeType::QUAD_BASE; + + else if (PN.equalsIgnoreCase ("PRB_1_4_0480_1") || PN.equalsIgnoreCase ("PRB_1_4_0480_1_C") || PN.equalsIgnoreCase ("PRB_1_2_0480_2")) type = ProbeType::NP1; - else if (PN.equalsIgnoreCase ("NP1100")) + else if (PN.equalsIgnoreCase ("NP1100") || PN.equalsIgnoreCase ("NP1120") || PN.equalsIgnoreCase ("NP1121") || PN.equalsIgnoreCase ("NP1122") || PN.equalsIgnoreCase ("NP1123")) type = ProbeType::UHD1; else if (PN.equalsIgnoreCase ("NP1110"))