Skip to content

Commit

Permalink
Update Galea default command and log Galea gain values (#707)
Browse files Browse the repository at this point in the history
* Update default mode command
  • Loading branch information
isaacplotkin authored Feb 22, 2024
1 parent 97f11c8 commit b39b560
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 3 deletions.
19 changes: 18 additions & 1 deletion src/board_controller/openbci/galea_serial_v4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ int GaleaSerialV4::prepare_session ()

// set initial settings
std::string tmp;
std::string default_settings = "o"; // use demo mode with agnd
std::string default_settings = "d"; // use default mode
res = config_board (default_settings, tmp);
if (res != (int)BrainFlowExitCodes::STATUS_OK)
{
Expand Down Expand Up @@ -127,6 +127,23 @@ int GaleaSerialV4::config_board (std::string conf, std::string &response)
return res;
}

if (conf == "get_gains")
{
std::stringstream gains;

for (int i = 0; i < 20; i++)
{
gains << gain_tracker.get_gain_for_channel (i);
if (i < 19)
{
gains << ", ";
}
}
response = gains.str ();
safe_logger (spdlog::level::info, "gains for all channels: {}", response);
return (int)BrainFlowExitCodes::STATUS_OK;
}

if (gain_tracker.apply_config (conf) == (int)OpenBCICommandTypes::INVALID_COMMAND)
{
safe_logger (spdlog::level::warn, "invalid command: {}", conf.c_str ());
Expand Down
21 changes: 19 additions & 2 deletions src/board_controller/openbci/galea_v4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ int GaleaV4::prepare_session ()
socket->set_timeout (socket_timeout);
// force default settings for device
std::string tmp;
std::string default_settings = "o"; // use demo mode with agnd
std::string default_settings = "d"; // use default mode
res = config_board (default_settings, tmp);
if (res != (int)BrainFlowExitCodes::STATUS_OK)
{
Expand All @@ -88,7 +88,7 @@ int GaleaV4::prepare_session ()
res = config_board (sampl_rate, tmp);
if (res != (int)BrainFlowExitCodes::STATUS_OK)
{
safe_logger (spdlog::level::err, "failed to apply defaul sampling rate");
safe_logger (spdlog::level::err, "failed to apply default sampling rate");
delete socket;
socket = NULL;
return (int)BrainFlowExitCodes::BOARD_NOT_READY_ERROR;
Expand Down Expand Up @@ -116,6 +116,23 @@ int GaleaV4::config_board (std::string conf, std::string &response)
return res;
}

if (conf == "get_gains")
{
std::stringstream gains;

for (int i = 0; i < 20; i++)
{
gains << gain_tracker.get_gain_for_channel (i);
if (i < 19)
{
gains << ", ";
}
}
response = gains.str ();
safe_logger (spdlog::level::info, "gains for all channels: {}", response);
return (int)BrainFlowExitCodes::STATUS_OK;
}

if (gain_tracker.apply_config (conf) == (int)OpenBCICommandTypes::INVALID_COMMAND)
{
safe_logger (spdlog::level::warn, "invalid command: {}", conf.c_str ());
Expand Down

0 comments on commit b39b560

Please sign in to comment.