Skip to content
Snippets Groups Projects
Commit ce2b2a85 authored by jsiegle's avatar jsiegle
Browse files

Attempt to allow LFP channels to save their enabled state

parent e14ee6ee
Branches
Tags
No related merge requests found
......@@ -87,7 +87,7 @@ void RHD2000Thread::initializeBoard()
if (!evalBoard->uploadFpgaBitfile(bitfilename))
{
std::cout << "Couldn't upload bitfile." << std::endl;
std::cout << "Couldn't upload bitfile from " << bitfilename << std::endl;
// what to do if there's an error
}
......
......@@ -463,6 +463,20 @@ void LfpDisplayCanvas::saveVisualizerParameters(XmlElement* xml)
xmlNode->setAttribute("EventButtonState", eventButtonState);
String channelDisplayState = "";
for (int i = 0; i < nChans; i++)
{
if (lfpDisplay->getEnabledState(i))
{
channelDisplayState += "1";
} else {
channelDisplayState += "0";
}
}
xmlNode->setAttribute("ChannelDisplayState", channelDisplayState);
xmlNode->setAttribute("ScrollX",viewport->getViewPositionX());
xmlNode->setAttribute("ScrollY",viewport->getViewPositionY());
}
......@@ -481,7 +495,7 @@ void LfpDisplayCanvas::loadVisualizerParameters(XmlElement* xml)
viewport->setViewPosition(xmlNode->getIntAttribute("ScrollX"),
xmlNode->getIntAttribute("ScrollY"));
int eventButtonState = xmlNode->getIntAttribute("eventButtonState");
int eventButtonState = xmlNode->getIntAttribute("EventButtonState");
for (int i = 0; i < 8; i++)
{
......@@ -489,6 +503,21 @@ void LfpDisplayCanvas::loadVisualizerParameters(XmlElement* xml)
eventDisplayInterfaces[i]->checkEnabledState();
}
String channelDisplayState = xmlNode->getStringAttribute("ChannelDisplayState");
for (int i = 0; i < channelDisplayState.length(); i++)
{
if (channelDisplayState.substring(i,i+1).equalsIgnoreCase("1"))
{
lfpDisplay->setEnabledState(true, i);
} else {
lfpDisplay->setEnabledState(false, i);
}
}
}
}
......@@ -596,6 +625,7 @@ int LfpDisplay::getNumChannels()
return numChans;
}
void LfpDisplay::setNumChannels(int numChannels)
{
numChans = numChannels;
......@@ -861,11 +891,27 @@ bool LfpDisplay::getEventDisplayState(int ch)
return eventDisplayEnabled[ch];
}
void LfpDisplay::setEnabledState(bool state, int ch)
void LfpDisplay::setEnabledState(bool state, int chan)
{
channels[ch]->setEnabledState(state);
if (chan < numChans)
{
channels[chan]->setEnabledState(state);
channelInfo[chan]->setEnabledState(state);
}
}
bool LfpDisplay::getEnabledState(int chan)
{
if (chan < numChans)
{
return channels[chan]->getEnabledState();
}
return false;
}
// ------------------------------------------------------------------
......@@ -894,6 +940,10 @@ LfpChannelDisplay::~LfpChannelDisplay()
void LfpChannelDisplay::setEnabledState(bool state)
{
std::cout << "Setting channel " << name << " to " << state << std::endl;
isEnabled = state;
}
......@@ -1139,6 +1189,11 @@ void LfpChannelDisplayInfo::buttonClicked(Button* button)
}
void LfpChannelDisplayInfo::setEnabledState(bool state)
{
enableButton->setToggleState(state, false);
}
void LfpChannelDisplayInfo::paint(Graphics& g)
{
......
......@@ -187,7 +187,7 @@ public:
bool getEventDisplayState(int ch);
void setEnabledState(bool, int);
bool getEnabledState(int);
Array<Colour> channelColours;
......@@ -233,6 +233,7 @@ public:
int getRange();
void setEnabledState(bool);
bool getEnabledState() {return isEnabled;}
bool fullredraw; // used to indicate that a full redraw is required. is set false after each full redraw
......@@ -273,6 +274,8 @@ public:
void resized();
void setEnabledState(bool);
private:
ScopedPointer<UtilityButton> enableButton;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment