Skip to content

Commit

Permalink
Merge pull request #1062 from OpenBCI/team-review-5-5.1.0
Browse files Browse the repository at this point in the history
Team review 5 5.1.0
  • Loading branch information
retiutut authored May 27, 2022
2 parents a10073b + a553781 commit 52447b7
Show file tree
Hide file tree
Showing 17 changed files with 118 additions and 70 deletions.
4 changes: 2 additions & 2 deletions OpenBCI_GUI/ADS1299SettingsController.pde
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class ADS1299SettingsController {
if (isVisible) {
//Control button space above channels
pushStyle();
//stroke(31,69,110, 50);
//stroke(OPENBCI_BLUE_ALPHA50);
stroke(OBJECT_BORDER_GREY);
fill(GREY_100);
rect(x, y - columnLabelH, w, columnLabelH);
Expand Down Expand Up @@ -300,7 +300,7 @@ class ADS1299SettingsController {
if (!atLeastOneChannelHasChanged) {
output("No new settings to send to board.");
} else if (noErrors) {
output("Hardware Settings sent to board!");
outputSuccess("Hardware Settings sent to board!");
} else {
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.");
}
Expand Down
2 changes: 1 addition & 1 deletion OpenBCI_GUI/Containers.pde
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public class Container {
//stroke(255, 0, 0);
//rect(x0, y0, w0, h0);

fill(31, 69, 110, 100);
fill(OPENBCI_BLUE_ALPHA100);
noStroke();
rect(x, y, w, h);

Expand Down
23 changes: 12 additions & 11 deletions OpenBCI_GUI/ControlPanel.pde
Original file line number Diff line number Diff line change
Expand Up @@ -1339,7 +1339,7 @@ class SessionDataBox {
.setOpen(false)
.setColor(settings.dropdownColors)
.setOutlineColor(150)
//.setColorBackground(color(31,69,110)) // text field bg color
//.setColorBackground(OPENBCI_BLUE) // text field bg color
.setColorValueLabel(OPENBCI_DARKBLUE) // text color
//.setColorCaptionLabel(color(255))
//.setColorForeground(color(125)) // border color when not selected
Expand Down Expand Up @@ -1987,7 +1987,7 @@ class RecentPlaybackBox {
void createRecentPlaybackFilesDropdown(String name, List<String> _items){
recentPlaybackSL = rpb_cp5.addScrollableList(name)
.setOpen(false)
.setColorBackground(color(31,69,110)) // text field bg color
.setColorBackground(OPENBCI_BLUE) // text field bg color
.setColorValueLabel(color(255)) // text color
.setColorCaptionLabel(color(255))
.setColorForeground(color(125)) // border color when not selected
Expand Down Expand Up @@ -2132,7 +2132,7 @@ class GaleaBox {
private ScrollableList createDropdown(String name, GaleaSettingsEnum[] enumValues){
ScrollableList list = localCP5.addScrollableList(name)
.setOpen(false)
.setColorBackground(color(31,69,110)) // text field bg color
.setColorBackground(OPENBCI_BLUE) // text field bg color
.setColorValueLabel(color(255)) // text color
.setColorCaptionLabel(color(255))
.setColorForeground(color(125)) // border color when not selected
Expand Down Expand Up @@ -2598,7 +2598,7 @@ class StreamingBoardBox {
private ScrollableList createDropdown(String name, BrainFlowStreaming_Boards[] enumValues){
ScrollableList list = localCP5.addScrollableList(name)
.setOpen(false)
.setColorBackground(color(31,69,110)) // text field bg color
.setColorBackground(OPENBCI_BLUE) // text field bg color
.setColorValueLabel(color(255)) // text color
.setColorCaptionLabel(color(255))
.setColorForeground(color(125)) // border color when not selected
Expand Down Expand Up @@ -3089,25 +3089,26 @@ class InitBox {
public void initButtonPressed() {
if (getInitSessionButtonText().equals("START SESSION")) {
if ((eegDataSource == DATASOURCE_CYTON && selectedProtocol == BoardProtocol.NONE) || (eegDataSource == DATASOURCE_GANGLION && selectedProtocol == BoardProtocol.NONE)) {
output("No Transfer Protocol selected. Please select your Transfer Protocol and retry system initiation.");
outputWarn("No Transfer Protocol selected. Please select your Transfer Protocol and retry system initiation.");
return;
} 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
output("No Serial/COM port selected. Please select your Serial/COM port and retry system initiation.");
outputWarn("No Serial/COM port selected. Attempting to AUTO-CONNECT to Cyton.");
controlPanel.comPortBox.attemptAutoConnectCyton();
return;
} else if (eegDataSource == DATASOURCE_CYTON && selectedProtocol == BoardProtocol.WIFI && wifi_portName == "N/A" && controlPanel.getWifiSearchStyle() == controlPanel.WIFI_DYNAMIC) {
output("No Wifi Shield selected. Please select your Wifi Shield and retry system initiation.");
outputWarn("No Wifi Shield selected. Please select your Wifi Shield and retry system initiation.");
return;
} else if (eegDataSource == DATASOURCE_PLAYBACKFILE && playbackData_fname == "N/A" && sdData_fname == "N/A") { //if data source == playback && playback file == 'N/A'
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
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
return;
} else if (eegDataSource == DATASOURCE_GANGLION && (selectedProtocol == BoardProtocol.BLE || selectedProtocol == BoardProtocol.BLED112) && ganglion_portName == "N/A") {
output("No BLE device selected. Please select your Ganglion device and retry system initiation.");
outputWarn("No BLE device selected. Please select your Ganglion device and retry system initiation.");
return;
} else if (eegDataSource == DATASOURCE_GANGLION && selectedProtocol == BoardProtocol.WIFI && wifi_portName == "N/A" && controlPanel.getWifiSearchStyle() == controlPanel.WIFI_DYNAMIC) {
output("No Wifi Shield selected. Please select your Wifi Shield and retry system initiation.");
outputWarn("No Wifi Shield selected. Please select your Wifi Shield and retry system initiation.");
return;
} else if (eegDataSource == -1) {//if no data source selected
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
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
return;
} else { //otherwise, initiate system!
//verbosePrint("ControlPanel: CPmouseReleased: init");
Expand Down
4 changes: 2 additions & 2 deletions OpenBCI_GUI/CustomCp5Classes.pde
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ class ButtonHelpText{
//if on left side of screen, draw box brightness to prevent box off screen
if(x <= width/2){
rect(x, y, 200, 2*padding + numLines*lineSpacing + 4);
fill(31,69,110, masterOpacity); //text colof
fill(31,69,110, masterOpacity); //text color
text(myText, x + padding, y + padding, 180, (numLines*lineSpacing + 4));
} else{ //if on right side of screen, draw box left to prevent box off screen
rect(x - 200, y, 200, 2*padding + numLines*lineSpacing + 4);
fill(31,69,110); //text colof
fill(OPENBCI_BLUE); //text color
text(myText, x + padding - 200, y + padding, 180, (numLines*lineSpacing + 4));
}
popStyle();
Expand Down
6 changes: 3 additions & 3 deletions OpenBCI_GUI/Debugging.pde
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class HelpWidget {
} else if (colorScheme == COLOR_SCHEME_ALTERNATIVE_A){
// draw background of widget
stroke(OPENBCI_DARKBLUE);
fill(31,69,110);
fill(OPENBCI_BLUE);
rect(-1, height-h, width+2, h);
noStroke();

Expand Down Expand Up @@ -158,8 +158,8 @@ class HelpWidget {
return color(199, sat, 97);
case SUCCESS:
//base color - #DFF2BF;
maxSat = 50;
sat = 25;
maxSat = 25;
sat = 0;
sat = (int)map(fadeVal, 0, 100, sat, maxSat);
return color(106, sat, 95);
case WARN:
Expand Down
24 changes: 23 additions & 1 deletion OpenBCI_GUI/FilterUI.pde
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ class FilterUIPopup extends PApplet implements Runnable {
private int expanderLineTwoStart;
private int[] expanderTriangleXYCollapsed = new int[6];
private int[] expanderTriangleXYExpanded = new int[6];
private boolean ignoreExpanderInteraction = false;
List<controlP5.ScrollableList> cp5ElementsToCheck = new ArrayList<controlP5.ScrollableList>();

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

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

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

updateChannelCp5Objects();
arrangeAllObjectsXY();
Expand Down Expand Up @@ -910,13 +916,15 @@ class FilterUIPopup extends PApplet implements Runnable {
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());
}
masterFilterTypeDropdown = createDropdown("masterFilterTypeDropdown", -1, lg_spacer*4 + textfieldWidth*3, headerHeight*2 + sm_spacer, typeDropdownWidth, filterSettings.values.masterBandPassFilterType, BrainFlowFilterType.values());
cp5ElementsToCheck.add(masterFilterTypeDropdown);
}

private void createOrderDropdowns() {
for (int chan = filterSettings.getChannelCount() - 1; chan >= 0; chan--) {
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());
}
masterFilterOrderDropdown = createDropdown("masterFilterOrderDropdown", -1, lg_spacer*5 + textfieldWidth*3 + typeDropdownWidth, headerHeight*2 + sm_spacer, orderDropdownWidth, filterSettings.values.masterBandPassFilterOrder, BrainFlowFilterOrder.values());
cp5ElementsToCheck.add(masterFilterOrderDropdown);
}

private void createFilterSettingsSaveButton(String name, String text, int _x, int _y, int _w, int _h) {
Expand Down Expand Up @@ -1029,4 +1037,18 @@ class FilterUIPopup extends PApplet implements Runnable {
private void checkIfExpanderWasClicked() {
setUItoChannelMode(filterSettings.values.filterChannelSelect);
}

private void lockExpanderOnOverlapCheck(List<controlP5.ScrollableList> listOfControllers) {
for (controlP5.ScrollableList c : listOfControllers) {
if (c == null) {
continue; //Gracefully skip over a controller if it is null
}
if (c.isOpen()) {
ignoreExpanderInteraction = true;
return;
} else {
ignoreExpanderInteraction = false;
}
}
}
}
4 changes: 4 additions & 0 deletions OpenBCI_GUI/OpenBCI_GUI.pde
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,15 @@ final color WHITE = color(255);
final color BLACK = color(0);
final color OPENBCI_DARKBLUE = color(1, 18, 41);
final color OPENBCI_BLUE = color(31, 69, 110);
final color OPENBCI_BLUE_ALPHA50 = color(31, 69, 110, 50);
final color OPENBCI_BLUE_ALPHA100 = color(31, 69, 110, 100);
final color boxColor = color(200);
final color boxStrokeColor = OPENBCI_DARKBLUE;
final color isSelected_color = color(184, 220, 105); //Used for textfield borders,
final color colorNotPressed = WHITE;
final color buttonsLightBlue = color(57,128,204);
final color GREY_235 = color(235);
final color GREY_200 = color(200);
final color GREY_125 = color(125);
final color GREY_100 = color(100);
final color GREY_20 = color(20);
Expand Down
4 changes: 2 additions & 2 deletions OpenBCI_GUI/RadioConfig.pde
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ class RadioConfig {
return false;
}
} else {
output("No Serial/COM port selected. Please select your Serial/COM port and retry");
outputWarn("No Serial/COM port selected. Please select your Serial/COM port and retry.");
rcConfig.print_onscreen("Select a Serial/COM port, then try again.");
return false;
}
Expand Down Expand Up @@ -364,7 +364,7 @@ class RadioConfig {
return false;
}
} else {
output("No Serial/COM port selected. Please select your Serial/COM port and retry");
outputWarn("No Serial/COM port selected. Please select your Serial/COM port and retry.");
return false;
}
}
Expand Down
6 changes: 3 additions & 3 deletions OpenBCI_GUI/TopNav.pde
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ class TopNav {
configSelector.update();
previousSystemMode = systemMode;
}

boolean topNavSubClassIsOpen = layoutSelector.isVisible || configSelector.isVisible || tutorialSelector.isVisible;
setDropdownMenuIsOpen(topNavSubClassIsOpen);
}

void draw() {
Expand Down Expand Up @@ -631,7 +634,6 @@ class LayoutSelector {

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

void toggleVisibility() {
isVisible = !isVisible;
topNav.setDropdownMenuIsOpen(isVisible);
if (systemMode >= SYSTEMMODE_POSTINIT) {
if (isVisible) {
//the very convoluted way of locking all controllers of a single controlP5 instance...
Expand Down Expand Up @@ -1061,7 +1062,6 @@ class TutorialSelector {

void toggleVisibility() {
isVisible = !isVisible;
topNav.setDropdownMenuIsOpen(isVisible);
if (systemMode >= SYSTEMMODE_POSTINIT) {
if (isVisible) {
//the very convoluted way of locking all controllers of a single controlP5 instance...
Expand Down
4 changes: 2 additions & 2 deletions OpenBCI_GUI/W_Accelerometer.pde
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class W_Accelerometer extends Widget {
accelerometerBar.adjustTimeAxis(xLimOptions[settings.accHorizScaleSave]);
accelerometerBar.adjustVertScale(yLimOptions[settings.accVertScaleSave]);

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

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

void mousePressed() {
Expand Down
6 changes: 3 additions & 3 deletions OpenBCI_GUI/W_AnalogRead.pde
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class W_AnalogRead extends Widget {
analogReadBars[i].adjustTimeAxis(w_timeSeries.getTSHorizScale().getValue());
}

createAnalogModeButton("analogModeButton", "Turn Analog Read On", (int)(x + 3), (int)(y + 3 - navHeight), 128, navHeight - 6, p5, 12, colorNotPressed, OPENBCI_DARKBLUE);
createAnalogModeButton("analogModeButton", "Turn Analog Read On", (int)(x0 + 1), (int)(y0 + navHeight + 1), 128, navHeight - 3, p5, 12, colorNotPressed, OPENBCI_DARKBLUE);
}

public int getNumAnalogReads() {
Expand Down Expand Up @@ -145,7 +145,7 @@ class W_AnalogRead extends Widget {
analogReadBars[i].screenResized(int(ar_x), analogReadBarY, int(ar_w), analogReadBarHeight); //bar x, bar y, bar w, bar h
}

analogModeButton.setPosition(x + 3, y + 3 - navHeight);
analogModeButton.setPosition((int)(x0 + 1), (int)(y0 + navHeight + 1));
}

void mousePressed() {
Expand Down Expand Up @@ -393,7 +393,7 @@ class AnalogReadBar{
pushStyle();

//draw plot
stroke(31,69,110, 50);
stroke(OPENBCI_BLUE_ALPHA50);
fill(color(125,30,12,30));

rect(x + 36 + 4, y, w - 36 - 4, h);
Expand Down
Loading

0 comments on commit 52447b7

Please sign in to comment.