From b39b5601db2d845134b80c0083391cbbc601d5c5 Mon Sep 17 00:00:00 2001 From: Isaac Plotkin <108891347+isaacplotkin@users.noreply.github.com> Date: Thu, 22 Feb 2024 15:59:46 -0500 Subject: [PATCH] Update Galea default command and log Galea gain values (#707) * Update default mode command --- .../openbci/galea_serial_v4.cpp | 19 ++++++++++++++++- src/board_controller/openbci/galea_v4.cpp | 21 +++++++++++++++++-- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/src/board_controller/openbci/galea_serial_v4.cpp b/src/board_controller/openbci/galea_serial_v4.cpp index 133dfa440..51e32679f 100644 --- a/src/board_controller/openbci/galea_serial_v4.cpp +++ b/src/board_controller/openbci/galea_serial_v4.cpp @@ -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) { @@ -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 ()); diff --git a/src/board_controller/openbci/galea_v4.cpp b/src/board_controller/openbci/galea_v4.cpp index fbd931ca3..7ab3c48eb 100644 --- a/src/board_controller/openbci/galea_v4.cpp +++ b/src/board_controller/openbci/galea_v4.cpp @@ -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) { @@ -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; @@ -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 ());