Skip to content

Commit

Permalink
Merge pull request #235 from conorrussomanno/development
Browse files Browse the repository at this point in the history
cosmetic additions & other stuff
  • Loading branch information
conorrussomanno authored Sep 5, 2017
2 parents 6ed0753 + f21e433 commit fe5ddb6
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 39 deletions.
57 changes: 38 additions & 19 deletions OpenBCI_GUI/ControlPanel.pde
Original file line number Diff line number Diff line change
Expand Up @@ -1678,6 +1678,11 @@ class WifiBox {
refreshWifi.setString("SEARCHING...");
} else {
refreshWifi.setString("START SEARCH");
pushStyle();
fill(#999999);
ellipseMode(CENTER);
ellipse(w + 225 + 10, y + padding*4 + 72 + 10 + 10, 12, 12);
popStyle();
}
}

Expand Down Expand Up @@ -2309,10 +2314,10 @@ class RadioConfigBox {
isShowing = false;

getChannel = new Button(x + padding, y + padding*2 + 18, (w-padding*3)/2, 24, "GET CHANNEL", fontInfo.buttonLabel_size);
systemStatus = new Button(x + padding + (w-padding*2)/2, y + padding*2 + 18, (w-padding*3)/2, 24, "STATUS", fontInfo.buttonLabel_size);
setChannel = new Button(x + padding, y + padding*3 + 18 + 24, (w-padding*3)/2, 24, "CHANGE CHANNEL", fontInfo.buttonLabel_size);
ovrChannel = new Button(x + padding, y + padding*4 + 18 + 24*2, (w-padding*3)/2, 24, "OVERRIDE DONGLE", fontInfo.buttonLabel_size);
autoscan = new Button(x + padding + (w-padding*2)/2, y + padding*4 + 18 + 24*2, (w-padding*3)/2, 24, "AUTOSCAN", fontInfo.buttonLabel_size);
systemStatus = new Button(x + 2*padding + (w-padding*3)/2, y + padding*2 + 18, (w-padding*3)/2, 24, "STATUS", fontInfo.buttonLabel_size);
setChannel = new Button(x + padding, y + padding*3 + 18 + 24, (w-padding*3)/2, 24, "CHANGE CHAN.", fontInfo.buttonLabel_size);
autoscan = new Button(x + 2*padding + (w-padding*3)/2, y + padding*3 + 18 + 24, (w-padding*3)/2, 24, "AUTOSCAN", fontInfo.buttonLabel_size);
ovrChannel = new Button(x + padding, y + padding*4 + 18 + 24*2, w-(padding*2), 24, "OVERRIDE DONGLE", fontInfo.buttonLabel_size);

//Set help text
getChannel.setHelpText("Get the current channel of your Cyton and USB Dongle");
Expand Down Expand Up @@ -2345,17 +2350,16 @@ class RadioConfigBox {

public void print_onscreen(String localstring){
textAlign(LEFT);
fill(0);
rect(x + padding, y + (padding*8) + 18 + (24*2), (w-padding*3 + 5), 135 - 24 - padding);
fill(bgColor);
rect(x + padding, y + (padding*8) + 13 + (24*2), w-(padding*2), 135 - 21 - padding);
fill(255);
text(localstring, x + padding + 10, y + (padding*8) + 18 + (24*2) + 15, (w-padding*3 ), 135 - 24 - padding -15);
text(localstring, x + padding + 10, y + (padding*8) + 5 + (24*2) + 15, (w-padding*3 ), 135 - 24 - padding -15);
this.last_message = localstring;
}

public void print_lastmessage(){

fill(0);
rect(x + padding, y + (padding*7) + 18 + (24*5), (w-padding*3 + 5), 135);
fill(bgColor);
rect(x + padding, y + (padding*8) + 13 + (24*2), w-(padding*2), 135 - 21 - padding);
fill(255);
text(this.last_message, 180, 340, 240, 60);
}
Expand All @@ -2376,10 +2380,13 @@ class WifiConfigBox {
isShowing = false;

getTypeOfAttachedBoard = new Button(x + padding, y + padding*2 + 18, (w-padding*3)/2, 24, "OPENBCI BOARD", fontInfo.buttonLabel_size);
getIpAddress = new Button(x + padding + (w-padding*2)/2, y + padding*2 + 18, (w-padding*3)/2, 24, "IP ADDRESS", fontInfo.buttonLabel_size);
eraseCredentials = new Button(x + padding, y + padding*3 + 18 + 24, (w-padding*3)/2, 24, "ERASE CREDENTIALS", fontInfo.buttonLabel_size);
getMacAddress = new Button(x + padding, y + padding*4 + 18 + 24*2, (w-padding*3)/2, 24, "MAC ADDRESS", fontInfo.buttonLabel_size);
getFirmwareVersion = new Button(x + padding + (w-padding*2)/2, y + padding*4 + 18 + 24*2, (w-padding*3)/2, 24, "FIRMWARE VERSION", fontInfo.buttonLabel_size);
getIpAddress = new Button(x + 2*padding + (w-padding*3)/2, y + padding*2 + 18, (w-padding*3)/2, 24, "IP ADDRESS", fontInfo.buttonLabel_size);
// getIpAddress = new Button(x + w -padding*2)/2, y + padding*2 + 18, (w-padding*3)/2, 24, "IP ADDRESS", fontInfo.buttonLabel_size);
getMacAddress = new Button(x + padding, y + padding*3 + 18 + 24, (w-padding*3)/2, 24, "MAC ADDRESS", fontInfo.buttonLabel_size);
getFirmwareVersion = new Button(x + 2*padding + (w-padding*3)/2, y + padding*3 + 18 + 24, (w-padding*3)/2, 24, "FIRMWARE VERS.", fontInfo.buttonLabel_size);
eraseCredentials = new Button(x + padding, y + padding*4 + 18 + 24*2, w-(padding*2), 24, "ERASE NETWORK CREDENTIALS", fontInfo.buttonLabel_size);

//y + padding*4 + 18 + 24*2

//Set help text
getTypeOfAttachedBoard.setHelpText("Get the type of OpenBCI board attached to the WiFi Shield");
Expand Down Expand Up @@ -2416,17 +2423,29 @@ class WifiConfigBox {

public void print_onscreen(String localstring){
textAlign(LEFT);
fill(0);
rect(x + padding, y + (padding*8) + 18 + (24*2), (w-padding*3 + 5), 135 - 24 - padding);
fill(bgColor);
rect(x + padding, y + (padding*8) + 13 + (24*2), w-(padding*2), 135 - 21 - padding);
fill(255);
text(localstring, x + padding + 10, y + (padding*8) + 18 + (24*2) + 15, (w-padding*3 ), 135 - 24 - padding -15);
text(localstring, x + padding + 10, y + (padding*8) + 5 + (24*2) + 15, (w-padding*3 ), 135 - 24 - padding -15);
// this.last_message = localstring;


// textAlign(LEFT);
// fill(0);
// rect(x + padding, y + (padding*8) + 18 + (24*2), (w-padding*3 + 5), 135 - 24 - padding);
// fill(255);
// text(localstring, x + padding + 10, y + (padding*8) + 18 + (24*2) + 15, (w-padding*3 ), 135 - 24 - padding -15);
}

public void print_lastmessage(){

fill(0);
rect(x + padding, y + (padding*7) + 18 + (24*5), (w-padding*3 + 5), 135);
fill(bgColor);
rect(x + padding, y + (padding*8) + 13 + (24*2), w-(padding*2), 135 - 21 - padding);
fill(255);

// fill(0);
// rect(x + padding, y + (padding*7) + 18 + (24*5), (w-padding*3 + 5), 135);
// fill(255);
text(this.last_message, 180, 340, 240, 60);
}
};
Expand Down
12 changes: 8 additions & 4 deletions OpenBCI_GUI/Interactivity.pde
Original file line number Diff line number Diff line change
Expand Up @@ -995,20 +995,24 @@ void openURLInBrowser(String _url){
}

void toggleFrameRate(){
if(frameRateCounter<2){
if(frameRateCounter<3){
frameRateCounter++;
} else {
frameRateCounter = 0;
frameRateCounter = 1; // until we resolve the latency issue with 24hz, only allow 30hz minimum (aka frameRateCounter = 1)
}
if(frameRateCounter==0){
frameRate(24); //refresh rate ... this will slow automatically, if your processor can't handle the specified rate
topNav.fpsButton.setString("24 fps");
}
if(frameRateCounter==1){
frameRate(30); //refresh rate ... this will slow automatically, if your processor can't handle the specified rate
topNav.fpsButton.setString("30 fps");
}
if(frameRateCounter==1){
if(frameRateCounter==2){
frameRate(45); //refresh rate ... this will slow automatically, if your processor can't handle the specified rate
topNav.fpsButton.setString("45 fps");
}
if(frameRateCounter==2){
if(frameRateCounter==3){
frameRate(60); //refresh rate ... this will slow automatically, if your processor can't handle the specified rate
topNav.fpsButton.setString("60 fps");
}
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 @@ -267,7 +267,7 @@ PApplet ourApplet;

//========================SETUP============================//

int frameRateCounter = 0; //0 = 30, 1 = 45, 2 = 60
int frameRateCounter = 1; //0 = 24, 1 = 30, 2 = 45, 3 = 60

void setup() {
// Step 1: Prepare the exit handler that will attempt to close a running node
Expand Down Expand Up @@ -1169,7 +1169,7 @@ void introAnimation() {
textLeading(24);
fill(31, 69, 110, transparency);
textAlign(CENTER, CENTER);
text("OpenBCI GUI v3.0.0-beta6\nAugust 2017", width/2, height/2 + width/9);
text("OpenBCI GUI v3.0.0\nSeptember 2017", width/2, height/2 + width/9);
}

//exit intro animation at t2
Expand Down
12 changes: 8 additions & 4 deletions OpenBCI_GUI/TopNav.pde
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,18 @@ class TopNav {

fpsButton = new Button(3+3+256, 3, 73, 26, "XX" + " fps", fontInfo.buttonLabel_size);
if(frameRateCounter==0){
fpsButton.setString("30 fps");
fpsButton.setString("24 fps");
}
if(frameRateCounter==1){
fpsButton.setString("45 fps");
fpsButton.setString("30 fps");
}
if(frameRateCounter==2){
fpsButton.setString("45 fps");
}
if(frameRateCounter==3){
fpsButton.setString("60 fps");
}

fpsButton.setFont(h3, 16);
fpsButton.setHelpText("If you're having latency issues, try adjusting the frame rate and see if it helps!");

Expand Down Expand Up @@ -764,9 +768,9 @@ class TutorialSelector{

buttonNumber = 3;
h = margin*(buttonNumber+2) + b_h*(buttonNumber+1);
tempTutorialButton = new Button(x + margin, y + margin*(buttonNumber+1) + b_h*(buttonNumber), b_w, b_h, "Building Widgets");
tempTutorialButton = new Button(x + margin, y + margin*(buttonNumber+1) + b_h*(buttonNumber), b_w, b_h, "Building Custom Widgets");
tempTutorialButton.setFont(p5, 12);
tempTutorialButton.setURL("https://github.com/OpenBCI/OpenBCI_GUI/blob/master/README.md#widgets");
tempTutorialButton.setURL("http://docs.openbci.com/Tutorials/15-Custom_Widgets");
tutorialOptions.add(tempTutorialButton);

}
Expand Down
34 changes: 24 additions & 10 deletions OpenBCI_GUI/W_Focus.pde
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,21 @@ class W_Focus extends Widget {
boolean showAbout = false;
PFont myfont = createFont("fonts/Raleway-SemiBold.otf", 12);
PFont f = createFont("Arial Bold", 24); //for "FFT Plot" Widget Title
color cBack = #020916;
color cDark = #032e61;
color cMark = #306aaf; //#20669c;
color cFocus = #fefaea; //#f0fbfd;
color cWave = #ffdd3a;

// original colors
// color cBack = #020916; //darker blue
// color cDark = #032e61; //medium/dark blue
// color cMark = #306aaf; //lighter blue
// color cFocus = #fefaea; //peach
// color cWave = #ffdd3a; //yellow

//new colors (to match GUI)
color cBack = #ffffff; //white
color cDark = #032e61; //medium/dark blue
color cMark = #306aaf; //lighter blue
color cFocus = #020916; //peach
color cWave = #ffdd3a; //yellow

// float x, y, w, h; //widget topleft xy, width and height
float xc, yc, wc, hc; // crystal ball center xy, width and height
float wg, hg; //graph width, graph height
Expand Down Expand Up @@ -194,18 +204,21 @@ class W_Focus extends Widget {
//----------------- draw focus crystalball -----------------
noStroke();
if (isFocused) {
fill(cFocus);
fill(#FFFFFF);
stroke(cFocus);
} else {
fill(cDark);
}
ellipse(xc, yc, wc, hc);
noStroke();
// draw focus label
if (isFocused) {
fill(cFocus);
text("focused!", xc, yc + hc/2 + 16);
} else {
fill(cMark);
text("not focused", xc, yc + hc/2 + 16);
}
text("focus", xc, yc + hc/2 + 16);

//----------------- draw alpha meter -----------------
noStroke();
Expand Down Expand Up @@ -296,7 +309,8 @@ class W_Focus extends Widget {
translate(x, y);
if (showAbout) {
stroke(255);
fill(cBack);
// fill(cBack);
fill(#dddddd);

rect(rp, rp, w-rp*2, h-rp*2);
textAlign(LEFT, TOP);
Expand All @@ -305,7 +319,7 @@ class W_Focus extends Widget {
}
// draw the button that toggles information
noStroke();
fill(cFocus);
fill(cDark);
ellipse(xb, yb, rb, rb);
fill(cBack);
textAlign(CENTER, CENTER);
Expand Down Expand Up @@ -385,7 +399,7 @@ public abstract class BasicSlider {
float x, y, w, h; // center x, y. w, h means width and height of triangle
float yBot, yTop; // y range. Notice val of top y is less than bottom y
boolean isPressed = false;
color cNormal = #FFFFFF;
color cNormal = #CCCCCC;
color cPressed = #FF0000;

BasicSlider(float _x, float _yBot, float _yTop) {
Expand Down

0 comments on commit fe5ddb6

Please sign in to comment.