Skip to content

Commit 39bbb05

Browse files
committed
Update GaleaGainTracker to align with Galea Firmware v2.0.0
1 parent 9fbb143 commit 39bbb05

1 file changed

Lines changed: 16 additions & 46 deletions

File tree

src/board_controller/openbci/inc/openbci_gain_tracker.h

Lines changed: 16 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -179,50 +179,8 @@ class GaleaGainTracker : public OpenBCIGainTracker
179179
{
180180
public:
181181
GaleaGainTracker ()
182-
: OpenBCIGainTracker ({4, 4, 4, 4, 4, 4, 12, 12, 2, 2, 2, 2, 2, 2, 2, 2}) // to be confirmed
183-
{
184-
}
185-
186-
virtual int apply_config (std::string config)
187-
{
188-
if (config.size () == 1)
189-
{
190-
if ((config.at (0) == 'f') || (config.at (0) == 'g'))
191-
{
192-
std::copy (current_gains.begin (), current_gains.end (), old_gains.begin ());
193-
std::fill (current_gains.begin (), current_gains.end (), 1);
194-
}
195-
if ((config.at (0) == 'o') || (config.at (0) == 'd'))
196-
{
197-
std::copy (current_gains.begin (), current_gains.end (), old_gains.begin ());
198-
for (size_t i = 0; i < current_gains.size (); i++)
199-
{
200-
if (i < 6)
201-
{
202-
current_gains[i] = 4;
203-
}
204-
else if ((i == 6) || (i == 7))
205-
{
206-
current_gains[i] = 12;
207-
}
208-
else
209-
{
210-
current_gains[i] = 2;
211-
}
212-
}
213-
}
214-
}
215-
216-
return OpenBCIGainTracker::apply_config (config);
217-
}
218-
};
219-
220-
class GaleaV4GainTracker : public OpenBCIGainTracker
221-
{
222-
public:
223-
GaleaV4GainTracker ()
224-
: OpenBCIGainTracker ({4, 4, 4, 4, 4, 4, 4, 4, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
225-
12, 12, 12, 12, 12}) // to be confirmed
182+
: OpenBCIGainTracker ({4, 4, 4, 4, 4, 4, 4, 4, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 4, 4,
183+
4, 4, 12, 12}) // 8 EMG + 12 EEG + 4 AUX(EMG) + 2 Reserved
226184
{
227185
channel_letters = std::vector<char> {'1', '2', '3', '4', '5', '6', '7', '8', 'Q', 'W', 'E',
228186
'R', 'T', 'Y', 'U', 'I', 'A', 'S', 'D', 'G', 'H', 'J', 'K', 'L'};
@@ -240,16 +198,28 @@ class GaleaV4GainTracker : public OpenBCIGainTracker
240198
if ((config.at (0) == 'o') || (config.at (0) == 'd'))
241199
{
242200
std::copy (current_gains.begin (), current_gains.end (), old_gains.begin ());
201+
// 8 EMG + 12 EEG + 4 AUX(EMG) + 2 Reserved
243202
for (size_t i = 0; i < current_gains.size (); i++)
244203
{
245-
if (i < 8)
204+
if (i < 8) // EMG channels 0-7
246205
{
247206
current_gains[i] = 4;
248207
}
249-
else
208+
else if (i < 20) // EEG channels 8-19
250209
{
251210
current_gains[i] = 12;
252211
}
212+
else if (i < 24) // AUX channels 20-23 (4 AUX EMG + 2 Reserved)
213+
{
214+
if (i < 22) // AUX EMG channels 20-21
215+
{
216+
current_gains[i] = 4;
217+
}
218+
else // Reserved channels 22-23
219+
{
220+
current_gains[i] = 12;
221+
}
222+
}
253223
}
254224
}
255225
}

0 commit comments

Comments
 (0)