From 0b30c2035d7d08d3a3fa025a2f487a0f042ff35e Mon Sep 17 00:00:00 2001 From: Andrey Parfenov Date: Wed, 11 May 2022 19:34:24 +0300 Subject: [PATCH] change default railed percentage Signed-off-by: Andrey Parfenov --- OpenBCI_GUI/Extras.pde | 16 +++++++++++++++- OpenBCI_GUI/OpenBCI_GUI.pde | 4 ++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/OpenBCI_GUI/Extras.pde b/OpenBCI_GUI/Extras.pde index 71e7ac476..53dbe3e48 100644 --- a/OpenBCI_GUI/Extras.pde +++ b/OpenBCI_GUI/Extras.pde @@ -413,11 +413,18 @@ class DataStatus { int endPos = data.length; int startPos = Math.max(0, endPos - nPoints); + boolean is_straight_line = true; + if (!currentBoard.isStreaming()) { + is_straight_line = false; + } float max = Math.abs(data[startPos]); - for (int i = startPos; i < endPos; i++) { + for (int i = startPos + 1; i < endPos; i++) { if (Math.abs(data[i]) > max) { max = Math.abs(data[i]); } + if ((Math.abs(data[i - 1] - data[i]) > 0.00001) && (Math.abs(data[i]) > 0.00001)) { + is_straight_line = false; + } } percentage = (max / maxVal) * 100.0; @@ -432,7 +439,14 @@ class DataStatus { is_railed = true; notificationString = "Railed " + String.format("%1$,.2f", percentage) + "% "; colorIndicator = red; + } else { + if (is_straight_line) { + is_railed = true; + notificationString = "Data from the board doesn't change"; + colorIndicator = red; + } } + } } public color getColor() { diff --git a/OpenBCI_GUI/OpenBCI_GUI.pde b/OpenBCI_GUI/OpenBCI_GUI.pde index 2ab6d21eb..013e96fc5 100644 --- a/OpenBCI_GUI/OpenBCI_GUI.pde +++ b/OpenBCI_GUI/OpenBCI_GUI.pde @@ -140,8 +140,8 @@ int nchan = NCHAN_CYTON; //Normally, 8 or 16. Choose a smaller number to show f //define variables related to warnings to the user about whether the EEG data is nearly railed (and, therefore, of dubious quality) DataStatus is_railed[]; // thresholds are pecentages of max possible value -final double threshold_railed = 90.0; -final double threshold_railed_warn = 75.0; +final double threshold_railed = 99.0; +final double threshold_railed_warn = 90.0; //Cyton SD Card setting CytonSDMode cyton_sdSetting = CytonSDMode.NO_WRITE;