Skip to content

Commit b8d163d

Browse files
committed
Simplify BNO055 interface
- Correct tooltip information
1 parent 24038a0 commit b8d163d

File tree

4 files changed

+13
-61
lines changed

4 files changed

+13
-61
lines changed

Source/OnixSource.cpp

+1-4
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ void OnixSource::initializeDevices(bool updateStreamInfo)
137137
static const String probeLetters = "ABCDEFGHI";
138138
const int bufferSizeInSeconds = 10;
139139
int npxProbeIdx = 0;
140-
int bnoIdx = 0;
141140

142141
for (size_t dev_idx = 0; dev_idx < num_devs; dev_idx++)
143142
{
@@ -175,7 +174,7 @@ void OnixSource::initializeDevices(bool updateStreamInfo)
175174
}
176175
else if (devices[dev_idx].id == ONIX_BNO055)
177176
{
178-
auto bno = std::make_unique<Bno055>("BNO-" + String::charToString(probeLetters[bnoIdx]), devices[dev_idx].idx, ctx);
177+
auto bno = std::make_unique<Bno055>("BNO055", devices[dev_idx].idx, ctx);
179178

180179
int result = bno->enableDevice();
181180

@@ -188,8 +187,6 @@ void OnixSource::initializeDevices(bool updateStreamInfo)
188187
bno->addSourceBuffers(sourceBuffers);
189188

190189
sources.add(bno.release());
191-
192-
bnoIdx++;
193190
}
194191
else if (devices[dev_idx].id == ONIX_DS90UB9RAW)
195192
{

Source/UI/Bno055Interface.cpp

+3-40
Original file line numberDiff line numberDiff line change
@@ -23,45 +23,26 @@
2323

2424
#include "Bno055Interface.h"
2525

26-
Bno055Interface::Bno055Interface(OnixDevice* d, OnixSourceEditor* e, OnixSourceCanvas* c, String headstageName_) :
26+
Bno055Interface::Bno055Interface(OnixDevice* d, OnixSourceEditor* e, OnixSourceCanvas* c) :
2727
SettingsInterface(d, e, c),
2828
device((Bno055*)d)
2929
{
3030
if (device != nullptr)
3131
{
32-
nameLabel = std::make_unique<Label>("MAIN", "NAME");
33-
nameLabel->setFont(FontOptions("Fira Code", "Medium", 30.0f));
34-
nameLabel->setBounds(625, 40, 370, 45);
35-
addAndMakeVisible(nameLabel.get());
36-
3732
deviceEnableButton = std::make_unique<UtilityButton>("ENABLED");
3833
deviceEnableButton->setFont(FontOptions("Fira Code", "Regular", 12.0f));
3934
deviceEnableButton->setRadius(3.0f);
40-
deviceEnableButton->setBounds(nameLabel->getX(), nameLabel->getBottom() + 3, 100, 22);
35+
deviceEnableButton->setBounds(35, 35, 100, 22);
4136
deviceEnableButton->setClickingTogglesState(true);
4237
deviceEnableButton->setToggleState(device->isEnabled(), dontSendNotification);
43-
deviceEnableButton->setTooltip("If disabled, probe will not stream data during acquisition");
38+
deviceEnableButton->setTooltip("If disabled, BNO055 device will not stream data during acquisition");
4439
deviceEnableButton->addListener(this);
4540
addAndMakeVisible(deviceEnableButton.get());
46-
47-
infoLabel = std::make_unique<Label>("INFO", "INFO");
48-
infoLabel->setFont(FontOptions(15.0f));
49-
infoLabel->setBounds(deviceEnableButton->getX(), deviceEnableButton->getBottom() + 10, 300, 20);
50-
infoLabel->setJustificationType(Justification::topLeft);
51-
addAndMakeVisible(infoLabel.get());
52-
53-
updateInfoString();
5441
}
5542

56-
headstageName = headstageName_;
57-
5843
type = SettingsInterface::Type::BNO055_SETTINGS_INTERFACE;
5944
}
6045

61-
Bno055Interface::~Bno055Interface()
62-
{
63-
}
64-
6546
void Bno055Interface::buttonClicked(Button* button)
6647
{
6748
if (button == deviceEnableButton.get())
@@ -98,21 +79,3 @@ void Bno055Interface::saveParameters(XmlElement* xml)
9879
void Bno055Interface::loadParameters(XmlElement* xml)
9980
{
10081
}
101-
102-
void Bno055Interface::updateInfoString()
103-
{
104-
String nameString, infoString;
105-
106-
if (headstageName != "")
107-
nameString = "Headstage: " + headstageName;
108-
109-
if (device != nullptr)
110-
{
111-
infoString = "Device: BNO055";
112-
infoString += "\n";
113-
infoString += "\n";
114-
}
115-
116-
infoLabel->setText(infoString, dontSendNotification);
117-
nameLabel->setText(nameString, dontSendNotification);
118-
}

Source/UI/Bno055Interface.h

+3-11
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,7 @@ class Bno055Interface : public SettingsInterface,
3636
{
3737
public:
3838
/** Constructor */
39-
Bno055Interface(OnixDevice* d, OnixSourceEditor* e, OnixSourceCanvas* c, String headstageName = "");
40-
41-
/** Destructor */
42-
~Bno055Interface();
39+
Bno055Interface(OnixDevice* d, OnixSourceEditor* e, OnixSourceCanvas* c);
4340

4441
/** Disables buttons and starts animation if necessary */
4542
void startAcquisition() override;
@@ -54,21 +51,16 @@ class Bno055Interface : public SettingsInterface,
5451
void loadParameters(XmlElement* xml) override;
5552

5653
/** Updates the info string on the right-hand side of the component */
57-
void updateInfoString() override;
54+
void updateInfoString() override {};
5855

5956
/** Listener methods*/
6057
void buttonClicked(Button*) override;
6158

62-
Bno055* device;
63-
6459
private:
6560

66-
std::unique_ptr<Label> nameLabel;
67-
std::unique_ptr<Label> infoLabel;
61+
Bno055* device;
6862

6963
std::unique_ptr<UtilityButton> deviceEnableButton;
70-
71-
String headstageName;
7264
};
7365

7466
#endif // !__BNO055INTERFACE_H__

Source/UI/NeuropixV1Interface.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -601,29 +601,29 @@ void NeuropixV1Interface::buttonClicked(Button* button)
601601
{
602602
mode = VisualizationMode::ENABLE_VIEW;
603603
probeBrowser->stopTimer();
604-
repaint();
605604
drawLegend();
605+
repaint();
606606
}
607607
else if (button == apGainViewButton.get())
608608
{
609609
mode = VisualizationMode::AP_GAIN_VIEW;
610610
probeBrowser->stopTimer();
611-
repaint();
612611
drawLegend();
612+
repaint();
613613
}
614614
else if (button == lfpGainViewButton.get())
615615
{
616616
mode = VisualizationMode::LFP_GAIN_VIEW;
617617
probeBrowser->stopTimer();
618-
repaint();
619618
drawLegend();
619+
repaint();
620620
}
621621
else if (button == referenceViewButton.get())
622622
{
623623
mode = VisualizationMode::REFERENCE_VIEW;
624624
probeBrowser->stopTimer();
625-
repaint();
626625
drawLegend();
626+
repaint();
627627
}
628628
else if (button == activityViewButton.get())
629629
{
@@ -632,8 +632,8 @@ void NeuropixV1Interface::buttonClicked(Button* button)
632632
if (acquisitionIsActive)
633633
probeBrowser->startTimer(100);
634634

635-
repaint();
636635
drawLegend();
636+
repaint();
637637
}
638638
else if (button == enableButton.get())
639639
{
@@ -868,8 +868,8 @@ bool NeuropixV1Interface::applyProbeSettings(ProbeSettings p, bool shouldUpdateP
868868
CoreServices::saveRecoveryConfig();
869869
}
870870

871-
repaint();
872871
drawLegend();
872+
repaint();
873873

874874
return true;
875875
}

0 commit comments

Comments
 (0)