diff --git a/Source/Processors/DataThreads/RHD2000Editor.cpp b/Source/Processors/DataThreads/RHD2000Editor.cpp index 30285b166badfbe3ffb12d68cf9939342977415b..7a40e81e06c867ded7ca8671ce3492f59e6d79c7 100644 --- a/Source/Processors/DataThreads/RHD2000Editor.cpp +++ b/Source/Processors/DataThreads/RHD2000Editor.cpp @@ -181,7 +181,7 @@ void FPGAchannelList::update() streamNames.add("Port D2"); streamNames.add("ADC"); - for (int k = 0; k < MAX_NUM_DATA_STREAMS + 1; k++) + for (int k = 0; k < MAX_NUM_HEADSTAGES + 1; k++) { if (hsActive[k]) { @@ -316,17 +316,29 @@ void FPGAchannelList::comboBoxChanged(ComboBox* b) void FPGAchannelList::updateImpedance(Array<int> streams, Array<int> channels, Array<float> magnitude, Array<float> phase) { + int i = 0; for (int k = 0; k < streams.size(); k++) { - channelComponents[k]->setImpedanceValues(magnitude[k], phase[k]); + if (i >= channelComponents.size()) + break; //little safety + + if (channelComponents[i]->type != HEADSTAGE_CHANNEL) + { + k--; + } + else + { + channelComponents[i]->setImpedanceValues(magnitude[k], phase[k]); + } + i++; } } /****************************************************/ -FPGAchannelComponent::FPGAchannelComponent(FPGAchannelList* cl, int ch, int gainIndex_, String N, Array<float> gains_, ChannelType type) : - gains(gains_), channelList(cl), channel(ch), name(N), gainIndex(gainIndex_) +FPGAchannelComponent::FPGAchannelComponent(FPGAchannelList* cl, int ch, int gainIndex_, String N, Array<float> gains_, ChannelType type_) : +gains(gains_), channelList(cl), channel(ch), name(N), gainIndex(gainIndex_), type(type_) { Font f = Font("Small Text", 13, Font::plain); diff --git a/Source/Processors/DataThreads/RHD2000Editor.h b/Source/Processors/DataThreads/RHD2000Editor.h index 9964ab22a68c841d82978fa84c706e7a3f5a62ee..8a6ed579b52f2e306c59c24a36a43f5a406c8bc1 100644 --- a/Source/Processors/DataThreads/RHD2000Editor.h +++ b/Source/Processors/DataThreads/RHD2000Editor.h @@ -95,7 +95,7 @@ private: class FPGAchannelComponent : public Component, public AccessClass, Button::Listener, public ComboBox::Listener, public Label::Listener { public: - FPGAchannelComponent(FPGAchannelList* cl, int ch, int gainIndex_, String name_, Array<float> gains_, ChannelType type); + FPGAchannelComponent(FPGAchannelList* cl, int ch, int gainIndex_, String name_, Array<float> gains_, ChannelType type_); ~FPGAchannelComponent(); Colour getDefaultColor(int ID); void setImpedanceValues(float mag, float phase); @@ -115,6 +115,8 @@ public: void labelTextChanged(Label* lbl); void resized(); + + const ChannelType type; private: Array<float> gains; FPGAchannelList* channelList;