Skip to content

Commit 52447b7

Browse files
authored
Merge pull request #1062 from OpenBCI/team-review-5-5.1.0
Team review 5 5.1.0
2 parents a10073b + a553781 commit 52447b7

17 files changed

+118
-70
lines changed

OpenBCI_GUI/ADS1299SettingsController.pde

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class ADS1299SettingsController {
102102
if (isVisible) {
103103
//Control button space above channels
104104
pushStyle();
105-
//stroke(31,69,110, 50);
105+
//stroke(OPENBCI_BLUE_ALPHA50);
106106
stroke(OBJECT_BORDER_GREY);
107107
fill(GREY_100);
108108
rect(x, y - columnLabelH, w, columnLabelH);
@@ -300,7 +300,7 @@ class ADS1299SettingsController {
300300
if (!atLeastOneChannelHasChanged) {
301301
output("No new settings to send to board.");
302302
} else if (noErrors) {
303-
output("Hardware Settings sent to board!");
303+
outputSuccess("Hardware Settings sent to board!");
304304
} else {
305305
PopupMessage msg = new PopupMessage("Error", "Failed to send one or more Hardware Settings to board. Check hardware and battery level. Cyton users, check that your dongle is connected with blue light shining.");
306306
}

OpenBCI_GUI/Containers.pde

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ public class Container {
210210
//stroke(255, 0, 0);
211211
//rect(x0, y0, w0, h0);
212212

213-
fill(31, 69, 110, 100);
213+
fill(OPENBCI_BLUE_ALPHA100);
214214
noStroke();
215215
rect(x, y, w, h);
216216

OpenBCI_GUI/ControlPanel.pde

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,7 +1339,7 @@ class SessionDataBox {
13391339
.setOpen(false)
13401340
.setColor(settings.dropdownColors)
13411341
.setOutlineColor(150)
1342-
//.setColorBackground(color(31,69,110)) // text field bg color
1342+
//.setColorBackground(OPENBCI_BLUE) // text field bg color
13431343
.setColorValueLabel(OPENBCI_DARKBLUE) // text color
13441344
//.setColorCaptionLabel(color(255))
13451345
//.setColorForeground(color(125)) // border color when not selected
@@ -1987,7 +1987,7 @@ class RecentPlaybackBox {
19871987
void createRecentPlaybackFilesDropdown(String name, List<String> _items){
19881988
recentPlaybackSL = rpb_cp5.addScrollableList(name)
19891989
.setOpen(false)
1990-
.setColorBackground(color(31,69,110)) // text field bg color
1990+
.setColorBackground(OPENBCI_BLUE) // text field bg color
19911991
.setColorValueLabel(color(255)) // text color
19921992
.setColorCaptionLabel(color(255))
19931993
.setColorForeground(color(125)) // border color when not selected
@@ -2132,7 +2132,7 @@ class GaleaBox {
21322132
private ScrollableList createDropdown(String name, GaleaSettingsEnum[] enumValues){
21332133
ScrollableList list = localCP5.addScrollableList(name)
21342134
.setOpen(false)
2135-
.setColorBackground(color(31,69,110)) // text field bg color
2135+
.setColorBackground(OPENBCI_BLUE) // text field bg color
21362136
.setColorValueLabel(color(255)) // text color
21372137
.setColorCaptionLabel(color(255))
21382138
.setColorForeground(color(125)) // border color when not selected
@@ -2598,7 +2598,7 @@ class StreamingBoardBox {
25982598
private ScrollableList createDropdown(String name, BrainFlowStreaming_Boards[] enumValues){
25992599
ScrollableList list = localCP5.addScrollableList(name)
26002600
.setOpen(false)
2601-
.setColorBackground(color(31,69,110)) // text field bg color
2601+
.setColorBackground(OPENBCI_BLUE) // text field bg color
26022602
.setColorValueLabel(color(255)) // text color
26032603
.setColorCaptionLabel(color(255))
26042604
.setColorForeground(color(125)) // border color when not selected
@@ -3089,25 +3089,26 @@ class InitBox {
30893089
public void initButtonPressed() {
30903090
if (getInitSessionButtonText().equals("START SESSION")) {
30913091
if ((eegDataSource == DATASOURCE_CYTON && selectedProtocol == BoardProtocol.NONE) || (eegDataSource == DATASOURCE_GANGLION && selectedProtocol == BoardProtocol.NONE)) {
3092-
output("No Transfer Protocol selected. Please select your Transfer Protocol and retry system initiation.");
3092+
outputWarn("No Transfer Protocol selected. Please select your Transfer Protocol and retry system initiation.");
30933093
return;
30943094
} else if (eegDataSource == DATASOURCE_CYTON && selectedProtocol == BoardProtocol.SERIAL && openBCI_portName == "N/A") { //if data source == normal && if no serial port selected OR no SD setting selected
3095-
output("No Serial/COM port selected. Please select your Serial/COM port and retry system initiation.");
3095+
outputWarn("No Serial/COM port selected. Attempting to AUTO-CONNECT to Cyton.");
3096+
controlPanel.comPortBox.attemptAutoConnectCyton();
30963097
return;
30973098
} else if (eegDataSource == DATASOURCE_CYTON && selectedProtocol == BoardProtocol.WIFI && wifi_portName == "N/A" && controlPanel.getWifiSearchStyle() == controlPanel.WIFI_DYNAMIC) {
3098-
output("No Wifi Shield selected. Please select your Wifi Shield and retry system initiation.");
3099+
outputWarn("No Wifi Shield selected. Please select your Wifi Shield and retry system initiation.");
30993100
return;
31003101
} else if (eegDataSource == DATASOURCE_PLAYBACKFILE && playbackData_fname == "N/A" && sdData_fname == "N/A") { //if data source == playback && playback file == 'N/A'
3101-
output("No playback file selected. Please select a playback file and retry system initiation."); // tell user that they need to select a file before the system can be started
3102+
outputWarn("No playback file selected. Please select a playback file and retry system initiation."); // tell user that they need to select a file before the system can be started
31023103
return;
31033104
} else if (eegDataSource == DATASOURCE_GANGLION && (selectedProtocol == BoardProtocol.BLE || selectedProtocol == BoardProtocol.BLED112) && ganglion_portName == "N/A") {
3104-
output("No BLE device selected. Please select your Ganglion device and retry system initiation.");
3105+
outputWarn("No BLE device selected. Please select your Ganglion device and retry system initiation.");
31053106
return;
31063107
} else if (eegDataSource == DATASOURCE_GANGLION && selectedProtocol == BoardProtocol.WIFI && wifi_portName == "N/A" && controlPanel.getWifiSearchStyle() == controlPanel.WIFI_DYNAMIC) {
3107-
output("No Wifi Shield selected. Please select your Wifi Shield and retry system initiation.");
3108+
outputWarn("No Wifi Shield selected. Please select your Wifi Shield and retry system initiation.");
31083109
return;
31093110
} else if (eegDataSource == -1) {//if no data source selected
3110-
output("No DATA SOURCE selected. Please select a DATA SOURCE and retry system initiation.");//tell user they must select a data source before initiating system
3111+
outputWarn("No DATA SOURCE selected. Please select a DATA SOURCE and retry system initiation.");//tell user they must select a data source before initiating system
31113112
return;
31123113
} else { //otherwise, initiate system!
31133114
//verbosePrint("ControlPanel: CPmouseReleased: init");

OpenBCI_GUI/CustomCp5Classes.pde

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,11 @@ class ButtonHelpText{
115115
//if on left side of screen, draw box brightness to prevent box off screen
116116
if(x <= width/2){
117117
rect(x, y, 200, 2*padding + numLines*lineSpacing + 4);
118-
fill(31,69,110, masterOpacity); //text colof
118+
fill(31,69,110, masterOpacity); //text color
119119
text(myText, x + padding, y + padding, 180, (numLines*lineSpacing + 4));
120120
} else{ //if on right side of screen, draw box left to prevent box off screen
121121
rect(x - 200, y, 200, 2*padding + numLines*lineSpacing + 4);
122-
fill(31,69,110); //text colof
122+
fill(OPENBCI_BLUE); //text color
123123
text(myText, x + padding - 200, y + padding, 180, (numLines*lineSpacing + 4));
124124
}
125125
popStyle();

OpenBCI_GUI/Debugging.pde

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class HelpWidget {
9595
} else if (colorScheme == COLOR_SCHEME_ALTERNATIVE_A){
9696
// draw background of widget
9797
stroke(OPENBCI_DARKBLUE);
98-
fill(31,69,110);
98+
fill(OPENBCI_BLUE);
9999
rect(-1, height-h, width+2, h);
100100
noStroke();
101101

@@ -158,8 +158,8 @@ class HelpWidget {
158158
return color(199, sat, 97);
159159
case SUCCESS:
160160
//base color - #DFF2BF;
161-
maxSat = 50;
162-
sat = 25;
161+
maxSat = 25;
162+
sat = 0;
163163
sat = (int)map(fadeVal, 0, 100, sat, maxSat);
164164
return color(106, sat, 95);
165165
case WARN:

OpenBCI_GUI/FilterUI.pde

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ class FilterUIPopup extends PApplet implements Runnable {
8888
private int expanderLineTwoStart;
8989
private int[] expanderTriangleXYCollapsed = new int[6];
9090
private int[] expanderTriangleXYExpanded = new int[6];
91+
private boolean ignoreExpanderInteraction = false;
92+
List<controlP5.ScrollableList> cp5ElementsToCheck = new ArrayList<controlP5.ScrollableList>();
9193

9294
DecimalFormat df = new DecimalFormat("#.0");
9395

@@ -206,10 +208,12 @@ class FilterUIPopup extends PApplet implements Runnable {
206208
rect(0, 0, width, headerHeight);
207209

208210
// Draw Channel Expander
211+
lockExpanderOnOverlapCheck(cp5ElementsToCheck);
209212
expanderIsHover = mouseY > expanderY - expanderH/2
210213
&& mouseX < expanderX + expanderW
211214
&& mouseY < expanderY + expanderH/2
212-
&& mouseX > expanderX;
215+
&& mouseX > expanderX
216+
&& !ignoreExpanderInteraction;
213217
color expanderColor = expanderIsHover ? OPENBCI_BLUE : color(102);
214218
int[] triXY = filterSettings.values.filterChannelSelect == FilterChannelSelect.ALL_CHANNELS ?
215219
expanderTriangleXYCollapsed :
@@ -327,6 +331,8 @@ class FilterUIPopup extends PApplet implements Runnable {
327331
// Create header objects last so they always draw on top!
328332
bfGlobalFilterDropdown = createDropdown("filter", -1, headerObjX[1], headerObjY, headerObjWidth, filterSettings.values.brainFlowFilter, BFFilter.values());
329333
bfEnvironmentalNoiseDropdown = createDropdown("environmentalFilter", -1, headerObjX[3], headerObjY, headerObjWidth - 10, filterSettings.values.globalEnvFilter, GlobalEnvironmentalFilter.values());
334+
cp5ElementsToCheck.add(bfGlobalFilterDropdown);
335+
cp5ElementsToCheck.add(bfEnvironmentalNoiseDropdown);
330336

331337
updateChannelCp5Objects();
332338
arrangeAllObjectsXY();
@@ -910,13 +916,15 @@ class FilterUIPopup extends PApplet implements Runnable {
910916
filterTypeDropdowns[chan] = createDropdown("filterType"+chan, chan, lg_spacer*4 + textfieldWidth*3, headerHeight*2 + sm_spacer*(chan+2) + uiObjectHeight*(chan+1), typeDropdownWidth, filterSettings.values.masterBandPassFilterType, BrainFlowFilterType.values());
911917
}
912918
masterFilterTypeDropdown = createDropdown("masterFilterTypeDropdown", -1, lg_spacer*4 + textfieldWidth*3, headerHeight*2 + sm_spacer, typeDropdownWidth, filterSettings.values.masterBandPassFilterType, BrainFlowFilterType.values());
919+
cp5ElementsToCheck.add(masterFilterTypeDropdown);
913920
}
914921

915922
private void createOrderDropdowns() {
916923
for (int chan = filterSettings.getChannelCount() - 1; chan >= 0; chan--) {
917924
filterOrderDropdowns[chan] = createDropdown("filterOrder"+chan, chan, lg_spacer*5 + textfieldWidth*3 + typeDropdownWidth, headerHeight*2 + sm_spacer*(chan+2) + uiObjectHeight*(chan+1), orderDropdownWidth, filterSettings.values.masterBandPassFilterOrder, BrainFlowFilterOrder.values());
918925
}
919926
masterFilterOrderDropdown = createDropdown("masterFilterOrderDropdown", -1, lg_spacer*5 + textfieldWidth*3 + typeDropdownWidth, headerHeight*2 + sm_spacer, orderDropdownWidth, filterSettings.values.masterBandPassFilterOrder, BrainFlowFilterOrder.values());
927+
cp5ElementsToCheck.add(masterFilterOrderDropdown);
920928
}
921929

922930
private void createFilterSettingsSaveButton(String name, String text, int _x, int _y, int _w, int _h) {
@@ -1029,4 +1037,18 @@ class FilterUIPopup extends PApplet implements Runnable {
10291037
private void checkIfExpanderWasClicked() {
10301038
setUItoChannelMode(filterSettings.values.filterChannelSelect);
10311039
}
1040+
1041+
private void lockExpanderOnOverlapCheck(List<controlP5.ScrollableList> listOfControllers) {
1042+
for (controlP5.ScrollableList c : listOfControllers) {
1043+
if (c == null) {
1044+
continue; //Gracefully skip over a controller if it is null
1045+
}
1046+
if (c.isOpen()) {
1047+
ignoreExpanderInteraction = true;
1048+
return;
1049+
} else {
1050+
ignoreExpanderInteraction = false;
1051+
}
1052+
}
1053+
}
10321054
}

OpenBCI_GUI/OpenBCI_GUI.pde

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,11 +231,15 @@ final color WHITE = color(255);
231231
final color BLACK = color(0);
232232
final color OPENBCI_DARKBLUE = color(1, 18, 41);
233233
final color OPENBCI_BLUE = color(31, 69, 110);
234+
final color OPENBCI_BLUE_ALPHA50 = color(31, 69, 110, 50);
235+
final color OPENBCI_BLUE_ALPHA100 = color(31, 69, 110, 100);
234236
final color boxColor = color(200);
235237
final color boxStrokeColor = OPENBCI_DARKBLUE;
236238
final color isSelected_color = color(184, 220, 105); //Used for textfield borders,
237239
final color colorNotPressed = WHITE;
238240
final color buttonsLightBlue = color(57,128,204);
241+
final color GREY_235 = color(235);
242+
final color GREY_200 = color(200);
239243
final color GREY_125 = color(125);
240244
final color GREY_100 = color(100);
241245
final color GREY_20 = color(20);

OpenBCI_GUI/RadioConfig.pde

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ class RadioConfig {
333333
return false;
334334
}
335335
} else {
336-
output("No Serial/COM port selected. Please select your Serial/COM port and retry");
336+
outputWarn("No Serial/COM port selected. Please select your Serial/COM port and retry.");
337337
rcConfig.print_onscreen("Select a Serial/COM port, then try again.");
338338
return false;
339339
}
@@ -364,7 +364,7 @@ class RadioConfig {
364364
return false;
365365
}
366366
} else {
367-
output("No Serial/COM port selected. Please select your Serial/COM port and retry");
367+
outputWarn("No Serial/COM port selected. Please select your Serial/COM port and retry.");
368368
return false;
369369
}
370370
}

OpenBCI_GUI/TopNav.pde

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@ class TopNav {
132132
configSelector.update();
133133
previousSystemMode = systemMode;
134134
}
135+
136+
boolean topNavSubClassIsOpen = layoutSelector.isVisible || configSelector.isVisible || tutorialSelector.isVisible;
137+
setDropdownMenuIsOpen(topNavSubClassIsOpen);
135138
}
136139

137140
void draw() {
@@ -631,7 +634,6 @@ class LayoutSelector {
631634

632635
void toggleVisibility() {
633636
isVisible = !isVisible;
634-
topNav.setDropdownMenuIsOpen(isVisible);
635637
if (isVisible) {
636638
//the very convoluted way of locking all controllers of a single controlP5 instance...
637639
for (int i = 0; i < wm.widgets.size(); i++) {
@@ -815,7 +817,6 @@ class ConfigSelector {
815817

816818
void toggleVisibility() {
817819
isVisible = !isVisible;
818-
topNav.setDropdownMenuIsOpen(isVisible);
819820
if (systemMode >= SYSTEMMODE_POSTINIT) {
820821
if (isVisible) {
821822
//the very convoluted way of locking all controllers of a single controlP5 instance...
@@ -1061,7 +1062,6 @@ class TutorialSelector {
10611062

10621063
void toggleVisibility() {
10631064
isVisible = !isVisible;
1064-
topNav.setDropdownMenuIsOpen(isVisible);
10651065
if (systemMode >= SYSTEMMODE_POSTINIT) {
10661066
if (isVisible) {
10671067
//the very convoluted way of locking all controllers of a single controlP5 instance...

OpenBCI_GUI/W_Accelerometer.pde

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class W_Accelerometer extends Widget {
7272
accelerometerBar.adjustTimeAxis(xLimOptions[settings.accHorizScaleSave]);
7373
accelerometerBar.adjustVertScale(yLimOptions[settings.accVertScaleSave]);
7474

75-
createAccelModeButton("accelModeButton", "Turn Accel. Off", (int)(x + 3), (int)(y + 3 - navHeight), 120, navHeight - 6, p5, 12, colorNotPressed, OPENBCI_DARKBLUE);
75+
createAccelModeButton("accelModeButton", "Turn Accel. Off", (int)(x + 1), (int)(y0 + navHeight + 1), 120, navHeight - 3, p5, 12, colorNotPressed, OPENBCI_DARKBLUE);
7676
}
7777

7878
float adjustYMaxMinBasedOnSource() {
@@ -175,7 +175,7 @@ class W_Accelerometer extends Widget {
175175
//resize the accelerometer line graph
176176
accelerometerBar.screenResized(accelGraphX, accelGraphY, accelGraphWidth-accPadding*2, accelGraphHeight); //bar x, bar y, bar w, bar h
177177
//update the position of the accel mode button
178-
accelModeButton.setPosition((int)(x + 3), (int)(y + 3 - navHeight));
178+
accelModeButton.setPosition((int)(x0 + 1), (int)(y0 + navHeight + 1));
179179
}
180180

181181
void mousePressed() {

0 commit comments

Comments
 (0)