Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change default railed percentage #1055

Merged
merged 1 commit into from
May 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion OpenBCI_GUI/Extras.pde
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions OpenBCI_GUI/OpenBCI_GUI.pde
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down