Skip to content

Commit

Permalink
added manual impedance package number for ANT (and updated formatting)
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Dieudonné committed Jan 9, 2025
1 parent 8fa6023 commit 97c53ca
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
23 changes: 16 additions & 7 deletions src/board_controller/ant_neuro/ant_neuro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,12 @@ AntNeuroBoard::AntNeuroBoard (int board_id, struct BrainFlowInputParams params)
}
catch (...)
{
sampling_rate = -1.0;
sampling_rate = -1.0;
}
reference_range = -1.0;
bipolar_range = -1.0;
impedance_mode = false;
impedance_package_num = -1;
}

AntNeuroBoard::~AntNeuroBoard ()
Expand All @@ -94,13 +96,14 @@ int AntNeuroBoard::prepare_session ()
fact->getVersion ().major, fact->getVersion ().minor, fact->getVersion ().micro,
fact->getVersion ().build);
amp = fact->getAmplifier ();
impedance_mode = false;
reference_range = amp->getReferenceRangesAvailable ()[0];
bipolar_range = amp->getBipolarRangesAvailable ()[0];
if (sampling_rate < 0)
{
sampling_rate = amp->getSamplingRatesAvailable ()[0];
}
sampling_rate = amp->getSamplingRatesAvailable ()[0];
}
impedance_mode = false;
impedance_package_num = 0;
}
catch (const exceptions::notFound &e)
{
Expand Down Expand Up @@ -152,8 +155,8 @@ int AntNeuroBoard::start_stream (int buffer_size, const char *streamer_params)
else
{
safe_logger (spdlog::level::info,
"start eeg stream (sampling rate: {}, reference range: {}, bipolar range: {})", sampling_rate,
reference_range, bipolar_range);
"start eeg stream (sampling rate: {}, reference range: {}, bipolar range: {})",
sampling_rate, reference_range, bipolar_range);
stream = amp->OpenEegStream (sampling_rate, reference_range, bipolar_range);
}
}
Expand Down Expand Up @@ -245,7 +248,8 @@ void AntNeuroBoard::read_thread ()
}
try
{
resistance_channels = board_descr["default"]["resistance_channels"].get<std::vector<int>> ();
resistance_channels =
board_descr["default"]["resistance_channels"].get<std::vector<int>> ();
}
catch (...)
{
Expand Down Expand Up @@ -306,6 +310,11 @@ void AntNeuroBoard::read_thread ()
}
}
package[board_descr["default"]["timestamp_channel"].get<int> ()] = get_timestamp ();
if (impedance_mode)
{
package[board_descr["default"]["package_num_channel"].get<int> ()] =
impedance_package_num++;
}
push_package (package);
}
std::this_thread::sleep_for (std::chrono::milliseconds (1));
Expand Down
1 change: 1 addition & 0 deletions src/board_controller/ant_neuro/inc/ant_neuro.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class AntNeuroBoard : public Board
double reference_range;
double bipolar_range;
bool impedance_mode;
int impedance_package_num;

void read_thread ();
#endif
Expand Down

0 comments on commit 97c53ca

Please sign in to comment.