Skip to content

Commit 5e6956f

Browse files
Keep ANT EDX impedance compatible with legacy presets
1 parent 46a3d25 commit 5e6956f

2 files changed

Lines changed: 22 additions & 31 deletions

File tree

src/board_controller/ant_neuro_edx/ant_neuro_edx.cpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -672,18 +672,19 @@ int AntNeuroEdxBoard::process_frames ()
672672
return (int)BrainFlowExitCodes::BOARD_NOT_READY_ERROR;
673673
}
674674

675-
int num_rows = board_descr["default"]["num_rows"];
676-
int package_num_channel = board_descr["default"]["package_num_channel"];
677-
int timestamp_channel = board_descr["default"]["timestamp_channel"];
678-
int marker_channel = board_descr["default"]["marker_channel"];
679-
std::vector<int> eeg_channels = try_get_vec (board_descr["default"], "eeg_channels");
680-
std::vector<int> emg_channels = try_get_vec (board_descr["default"], "emg_channels");
681-
std::vector<int> resistance_channels = try_get_vec (board_descr["default"], "resistance_channels");
675+
json &frame_descr = board_descr["default"];
676+
int num_rows = frame_descr["num_rows"];
677+
int package_num_channel = frame_descr["package_num_channel"];
678+
int timestamp_channel = frame_descr["timestamp_channel"];
679+
int marker_channel = frame_descr["marker_channel"];
680+
std::vector<int> eeg_channels = try_get_vec (frame_descr, "eeg_channels");
681+
std::vector<int> emg_channels = try_get_vec (frame_descr, "emg_channels");
682+
std::vector<int> resistance_channels = try_get_vec (frame_descr, "resistance_channels");
682683
std::vector<int> ref_resistance_channels =
683-
try_get_vec (board_descr["default"], "ref_resistance_channels");
684+
try_get_vec (frame_descr, "ref_resistance_channels");
684685
std::vector<int> gnd_resistance_channels =
685-
try_get_vec (board_descr["default"], "gnd_resistance_channels");
686-
std::vector<int> other_channels = try_get_vec (board_descr["default"], "other_channels");
686+
try_get_vec (frame_descr, "gnd_resistance_channels");
687+
std::vector<int> other_channels = try_get_vec (frame_descr, "other_channels");
687688
std::vector<double> package ((size_t)num_rows, 0.0);
688689
const double sample_dt = (sampling_rate > 0) ? (1.0 / (double)sampling_rate) : 0.0;
689690
const double large_gap_threshold = 1.0;
@@ -745,6 +746,7 @@ int AntNeuroEdxBoard::process_frames ()
745746
}
746747
last_emitted_timestamp = package[(size_t)timestamp_channel];
747748
impedance_sample_count++;
749+
push_package (package.data ());
748750
push_package (package.data (), (int)BrainFlowPresets::ANCILLARY_PRESET);
749751
continue;
750752
}

src/board_controller/brainflow_boards.cpp

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,27 +1179,16 @@ BrainFlowBoards::BrainFlowBoards()
11791179
{
11801180
json src =
11811181
brainflow_boards_json["boards"][std::to_string (master_board_id)]["default"];
1182-
// default preset: EEG streaming mode — no resistance channels
1183-
json eeg_preset = src;
1184-
eeg_preset["name"] = name;
1185-
eeg_preset.erase ("resistance_channels");
1186-
eeg_preset.erase ("ref_resistance_channels");
1187-
eeg_preset.erase ("gnd_resistance_channels");
1188-
brainflow_boards_json["boards"][std::to_string (edx_board_id)]["default"] = eeg_preset;
1189-
// ancillary preset: impedance measurement mode
1190-
json res_preset;
1191-
res_preset["name"] = name;
1192-
res_preset["num_rows"] = src["num_rows"];
1193-
res_preset["timestamp_channel"] = src["timestamp_channel"];
1194-
res_preset["marker_channel"] = src["marker_channel"];
1195-
res_preset["package_num_channel"] = src["package_num_channel"];
1196-
if (src.contains ("resistance_channels"))
1197-
res_preset["resistance_channels"] = src["resistance_channels"];
1198-
if (src.contains ("ref_resistance_channels"))
1199-
res_preset["ref_resistance_channels"] = src["ref_resistance_channels"];
1200-
if (src.contains ("gnd_resistance_channels"))
1201-
res_preset["gnd_resistance_channels"] = src["gnd_resistance_channels"];
1202-
brainflow_boards_json["boards"][std::to_string (edx_board_id)]["ancillary"] = res_preset;
1182+
// Keep the legacy ANT layout on default for compatibility, and mirror
1183+
// it on ancillary as an optional EDX-specific access path.
1184+
json default_preset = src;
1185+
default_preset["name"] = name;
1186+
brainflow_boards_json["boards"][std::to_string (edx_board_id)]["default"] =
1187+
default_preset;
1188+
json ancillary_preset = src;
1189+
ancillary_preset["name"] = name;
1190+
brainflow_boards_json["boards"][std::to_string (edx_board_id)]["ancillary"] =
1191+
ancillary_preset;
12031192
};
12041193
clone_ant_edx_board (67, 24, "AntNeuroEE410EDX");
12051194
clone_ant_edx_board (68, 25, "AntNeuroEE411EDX");

0 commit comments

Comments
 (0)