Skip to content

Commit efddf87

Browse files
authored
change default railed percentage (#1055)
Signed-off-by: Andrey Parfenov <a1994ndrey@gmail.com>
1 parent aee5ec1 commit efddf87

2 files changed

Lines changed: 17 additions & 3 deletions

File tree

OpenBCI_GUI/Extras.pde

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,11 +413,18 @@ class DataStatus {
413413
int endPos = data.length;
414414
int startPos = Math.max(0, endPos - nPoints);
415415

416+
boolean is_straight_line = true;
417+
if (!currentBoard.isStreaming()) {
418+
is_straight_line = false;
419+
}
416420
float max = Math.abs(data[startPos]);
417-
for (int i = startPos; i < endPos; i++) {
421+
for (int i = startPos + 1; i < endPos; i++) {
418422
if (Math.abs(data[i]) > max) {
419423
max = Math.abs(data[i]);
420424
}
425+
if ((Math.abs(data[i - 1] - data[i]) > 0.00001) && (Math.abs(data[i]) > 0.00001)) {
426+
is_straight_line = false;
427+
}
421428
}
422429
percentage = (max / maxVal) * 100.0;
423430

@@ -432,7 +439,14 @@ class DataStatus {
432439
is_railed = true;
433440
notificationString = "Railed " + String.format("%1$,.2f", percentage) + "% ";
434441
colorIndicator = red;
442+
} else {
443+
if (is_straight_line) {
444+
is_railed = true;
445+
notificationString = "Data from the board doesn't change";
446+
colorIndicator = red;
447+
}
435448
}
449+
436450
}
437451
}
438452
public color getColor() {

OpenBCI_GUI/OpenBCI_GUI.pde

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ int nchan = NCHAN_CYTON; //Normally, 8 or 16. Choose a smaller number to show f
140140
//define variables related to warnings to the user about whether the EEG data is nearly railed (and, therefore, of dubious quality)
141141
DataStatus is_railed[];
142142
// thresholds are pecentages of max possible value
143-
final double threshold_railed = 90.0;
144-
final double threshold_railed_warn = 75.0;
143+
final double threshold_railed = 99.0;
144+
final double threshold_railed_warn = 90.0;
145145

146146
//Cyton SD Card setting
147147
CytonSDMode cyton_sdSetting = CytonSDMode.NO_WRITE;

0 commit comments

Comments
 (0)