Skip to content

Commit 9fbb143

Browse files
committed
Update Galea EDA calculation and available data
Fixes #784
1 parent 5451437 commit 9fbb143

2 files changed

Lines changed: 21 additions & 16 deletions

File tree

src/board_controller/brainflow_boards.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -199,17 +199,17 @@ BrainFlowBoards::BrainFlowBoards()
199199
{"name", "GaleaAuxiliary"},
200200
{"sampling_rate", 50},
201201
{"package_num_channel", 0},
202-
{"timestamp_channel", 17},
203-
{"marker_channel", 18},
204-
{"num_rows", 19},
205-
{"battery_channel", 5},
206-
{"eda_channels", {1}},
207-
{"ppg_channels", {2, 3}},
208-
{"accel_channels", {6, 7, 8}},
209-
{"gyro_channels", {9, 10, 11}},
210-
{"magnetometer_channels", {12, 13, 14}},
211-
{"other_channels", {15, 16}},
212-
{"temperature_channels", {4}}
202+
{"timestamp_channel", 18},
203+
{"marker_channel", 19},
204+
{"num_rows", 20},
205+
{"battery_channel", 6},
206+
{"eda_channels", {1, 2}},
207+
{"ppg_channels", {3, 4}},
208+
{"accel_channels", {7, 8, 9}},
209+
{"gyro_channels", {10, 11, 12}},
210+
{"magnetometer_channels", {13, 14, 15}},
211+
{"other_channels", {16, 17}},
212+
{"temperature_channels", {5}}
213213
};
214214
brainflow_boards_json["boards"]["4"]["default"] =
215215
{

src/board_controller/openbci/galea.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ constexpr int Galea::max_num_packages;
2323
constexpr int Galea::max_transaction_size;
2424
constexpr int Galea::socket_timeout;
2525

26-
Galea::Galea (struct BrainFlowInputParams params)
27-
: Board ((int)BoardIds::GALEA_BOARD, params)
26+
Galea::Galea (struct BrainFlowInputParams params) : Board ((int)BoardIds::GALEA_BOARD, params)
2827
{
2928
socket = NULL;
3029
is_streaming = false;
@@ -477,9 +476,9 @@ void Galea::read_thread ()
477476
uint16_t temperature = 0;
478477
int32_t ppg_ir = 0;
479478
int32_t ppg_red = 0;
480-
float eda;
479+
float eda_volts;
481480
memcpy (&temperature, b + 78 + offset, 2);
482-
memcpy (&eda, b + 1 + offset, 4);
481+
memcpy (&eda_volts, b + 1 + offset, 4);
483482
memcpy (&ppg_red, b + 80 + offset, 4);
484483
memcpy (&ppg_ir, b + 84 + offset, 4);
485484
// ppg
@@ -489,7 +488,13 @@ void Galea::read_thread ()
489488
(double)ppg_ir;
490489
// eda
491490
aux_package[board_descr["auxiliary"]["eda_channels"][0].get<int> ()] =
492-
(double)eda;
491+
(double)eda_volts;
492+
constexpr double eda_coefficient_1 = 3724389.83278;
493+
constexpr double eda_coefficient_2 = 1652406.91447;
494+
double eda_conductance =
495+
1000000.0 / ((eda_coefficient_1 * eda_volts) - eda_coefficient_2);
496+
aux_package[board_descr["auxiliary"]["eda_channels"][1].get<int> ()] =
497+
eda_conductance;
493498
// temperature
494499
aux_package[board_descr["auxiliary"]["temperature_channels"][0].get<int> ()] =
495500
temperature / 100.0;

0 commit comments

Comments
 (0)