From a4121c72742f914a29fccf587a8d1b841c2018b4 Mon Sep 17 00:00:00 2001 From: Richard Waltman Date: Fri, 13 Aug 2021 12:48:22 -0500 Subject: [PATCH 01/17] test commit --- Networking-Test-Kit/LSL/lslStreamTest.py | 2 +- .../LSL/lslStreamTest_3Streams.py | 42 ++++++------ .../LSL/lslStreamTest_FFTplot.py | 2 +- OpenBCI_GUI/W_Networking.pde | 67 +++++-------------- 4 files changed, 42 insertions(+), 71 deletions(-) diff --git a/Networking-Test-Kit/LSL/lslStreamTest.py b/Networking-Test-Kit/LSL/lslStreamTest.py index 6fce85048..1b955aa98 100644 --- a/Networking-Test-Kit/LSL/lslStreamTest.py +++ b/Networking-Test-Kit/LSL/lslStreamTest.py @@ -5,7 +5,7 @@ # first resolve an EEG stream on the lab network print("looking for an EEG stream...") -streams = resolve_stream('type', 'EEG') +streams = resolve_stream('type', 'FOCUS') # create a new inlet to read from the stream inlet = StreamInlet(streams[0]) diff --git a/Networking-Test-Kit/LSL/lslStreamTest_3Streams.py b/Networking-Test-Kit/LSL/lslStreamTest_3Streams.py index bca94ade1..7e9acf03b 100644 --- a/Networking-Test-Kit/LSL/lslStreamTest_3Streams.py +++ b/Networking-Test-Kit/LSL/lslStreamTest_3Streams.py @@ -12,21 +12,22 @@ numStreams = 3 # first resolve an EEG stream on the lab network print("looking for an EEG stream...") -stream1 = resolve_stream('type', 'EEG') -stream2 = resolve_stream('type', 'AUX') -stream3 = resolve_stream('type', 'FFT') +stream_1 = resolve_stream('type', 'EEG') +stream_2 = resolve_stream('type', 'AUX') +stream_3 = resolve_stream('type', 'FOCUS') # create a new inlet to read from the stream -inlet = StreamInlet(stream1[0]) -inlet2 = StreamInlet(stream2[0]) -inlet3 = StreamInlet(stream3[0]) +inlet = StreamInlet(stream_1[0]) +intlet_2 = StreamInlet(stream_2[0]) +intlet_3 = StreamInlet(stream_3[0]) def testLSLSamplingRates(): print( "Testing Sampling Rates..." ) start = time.time() - numSamples1 = 0 - numSamples2 = 0 - numSamples3 = 0 + num_samples_1 = 0 + num_samples_2 = 0 + num_samples_3 = 0 + duration_seconds = 5 while time.time() < start + 5: # get a new sample (you can also omit the timestamp part if you're not # interested in it) @@ -34,19 +35,22 @@ def testLSLSamplingRates(): if i == 0: chunk, timestamps = inlet.pull_chunk() if timestamps: - numSamples1 += 1 + for sample in chunk: + num_samples_1 += 1 elif i == 1: - chunk, timestamps2 = inlet2.pull_chunk() - if timestamps2: - numSamples2 += 1 + chunk, timestamps_2 = intlet_2.pull_chunk() + for sample in chunk: + print(sample) + num_samples_2 += 1 elif i == 2: - chunk, timestamps3 = inlet3.pull_chunk() - if timestamps3: - numSamples3 += 1 + chunk, timestamps_3 = intlet_3.pull_chunk() + if timestamps_3: + for sample in chunk: + num_samples_3 += 1 #print("Stream", i + 1, " == ", chunk) - print( "Stream 1 Sampling Rate == ", numSamples1, " | Type : EEG") - print( "Stream 2 Sampling Rate == ", numSamples2, " | Type : AUX") - print( "Stream 3 Sampling Rate == ", numSamples3, " | Type : FFT") + print( "Stream 1 Sampling Rate == ", num_samples_1 / 5, " | Type : EEG") + print( "Stream 2 Sampling Rate == ", num_samples_2 / 5, " | Type : AUX") + print( "Stream 3 Sampling Rate == ", num_samples_3 / 5, " | Type : FOCUS") testLSLSamplingRates() \ No newline at end of file diff --git a/Networking-Test-Kit/LSL/lslStreamTest_FFTplot.py b/Networking-Test-Kit/LSL/lslStreamTest_FFTplot.py index f2a2a715f..70aa1aeab 100644 --- a/Networking-Test-Kit/LSL/lslStreamTest_FFTplot.py +++ b/Networking-Test-Kit/LSL/lslStreamTest_FFTplot.py @@ -14,7 +14,7 @@ # first resolve an EEG stream on the lab network print("looking for an EEG stream...") -streams = resolve_stream('type', 'EEG') +streams = resolve_stream('type', 'FFT') # create a new inlet to read from the stream inlet = StreamInlet(streams[0]) diff --git a/OpenBCI_GUI/W_Networking.pde b/OpenBCI_GUI/W_Networking.pde index fdc55a46e..bcd77a19d 100644 --- a/OpenBCI_GUI/W_Networking.pde +++ b/OpenBCI_GUI/W_Networking.pde @@ -121,7 +121,7 @@ class W_Networking extends Widget { private LinkedList dataAccumulationQueue; // accessed by individual streams. yes, i hate it too public float[][] dataBufferToSend; - public boolean newDataToSend = false; + public boolean newTimeSeriesDataToSend = false; HashMap cp5Map = new HashMap(); @@ -215,8 +215,6 @@ class W_Networking extends Widget { if (stream3!=null) { stream3.run(); } - //Setting this var here fixes #592 to allow multiple LSL streams - newDataToSend = false; } checkTopNovEvents(); @@ -287,7 +285,8 @@ class W_Networking extends Widget { } private void checkIfEnoughDataToSend() { - if (dataAccumulationQueue.size() >= nPointsPerUpdate) { + newTimeSeriesDataToSend = dataAccumulationQueue.size() >= nPointsPerUpdate; + if (newTimeSeriesDataToSend) { for (int iSample=0; iSample Date: Fri, 3 Sep 2021 15:43:57 -0500 Subject: [PATCH 02/17] Fix highDPI code breaking GUI on some Macs Fixes #987 Fixes #990 --- CHANGELOG.md | 8 ++++++++ OpenBCI_GUI/Info.plist.tmpl | 4 ++-- OpenBCI_GUI/OpenBCI_GUI.pde | 27 +++++++++++++++------------ 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 468107c26..79f11848f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +# v5.0.7 + +### Improvements + + +### Bug Fixes +* Fix GUI not running on some Macs due to high-dpi screen code #987 #990 + # v5.0.6 ### Improvements diff --git a/OpenBCI_GUI/Info.plist.tmpl b/OpenBCI_GUI/Info.plist.tmpl index 9aad9c08c..936cc6a2d 100644 --- a/OpenBCI_GUI/Info.plist.tmpl +++ b/OpenBCI_GUI/Info.plist.tmpl @@ -23,7 +23,7 @@ CFBundleShortVersionString 5 CFBundleVersion - 5.0.6 + 5.0.7 CFBundleSignature ???? NSHumanReadableCopyright @@ -32,7 +32,7 @@ Copyright © 2021 OpenBCI CFBundleGetInfoString - July 2021 + September 2021 @@jvm_runtime@@ diff --git a/OpenBCI_GUI/OpenBCI_GUI.pde b/OpenBCI_GUI/OpenBCI_GUI.pde index c7084707e..6fda69e2d 100644 --- a/OpenBCI_GUI/OpenBCI_GUI.pde +++ b/OpenBCI_GUI/OpenBCI_GUI.pde @@ -60,8 +60,8 @@ import http.requests.*; // Global Variables & Instances //------------------------------------------------------------------------ //Used to check GUI version in TopNav.pde and displayed on the splash screen on startup -String localGUIVersionString = "v5.0.6"; -String localGUIVersionDate = "July 2021"; +final String localGUIVersionString = "v5.0.7-alpha.1"; +String localGUIVersionDate = "September 2021"; String guiLatestVersionGithubAPI = "https://api.github.com/repos/OpenBCI/OpenBCI_GUI/releases/latest"; String guiLatestReleaseLocation = "https://github.com/OpenBCI/OpenBCI_GUI/releases/latest"; @@ -288,6 +288,9 @@ TopNav topNav; ddf.minim.analysis.FFT[] fftBuff = new ddf.minim.analysis.FFT[nchan]; //from the minim library boolean isFFTFiltered = true; //yes by default ... this is used in dataProcessing.pde to determine which uV array feeds the FFT calculation +StringBuilder globalScreenResolution; +StringBuilder globalScreenDPI; + //------------------------------------------------------------------------ // Global Functions //------------------------------------------------------------------------ @@ -308,18 +311,18 @@ void settings() { win_h = 580; } size(win_w, win_h, P2D); -} -void setup() { - StringBuilder sb_res = new StringBuilder("Screen Resolution: "); - sb_res.append(displayWidth); - sb_res.append(" X "); - sb_res.append(displayHeight); + globalScreenResolution = new StringBuilder("Screen Resolution: "); + globalScreenResolution.append(displayWidth); + globalScreenResolution.append(" X "); + globalScreenResolution.append(displayHeight); //Account for high-dpi displays on Mac, Windows, and Linux Machines Fixes #968 pixelDensity(displayDensity()); - StringBuilder sb_dpi = new StringBuilder("High-DPI Screen Detected: "); - sb_dpi.append(displayDensity() == 2); + globalScreenDPI = new StringBuilder("High-DPI Screen Detected: "); + globalScreenDPI.append(displayDensity() == 2); +} +void setup() { frameRate(120); copyPaste = new CopyPaste(); @@ -381,8 +384,8 @@ void setup() { } println("Console Log Started at Local Time: " + directoryManager.getFileNameDateTime()); - println(sb_res.toString()); - println(sb_dpi.toString()); + println(globalScreenResolution.toString()); + println(globalScreenDPI.toString()); println(osName.toString()); println("Welcome to the Processing-based OpenBCI GUI!"); //Welcome line. println("For more information, please visit: https://openbci.github.io/Documentation/docs/06Software/01-OpenBCISoftware/GUIDocs"); From f50bdf87de98020a1f7742a296b665d72c852218 Mon Sep 17 00:00:00 2001 From: "retiutut@icloud.com" Date: Fri, 3 Sep 2021 16:59:16 -0500 Subject: [PATCH 03/17] Update links to old docs -> new docs --- OpenBCI_GUI/ControlPanel.pde | 1 - OpenBCI_GUI/Debugging.pde | 2 +- OpenBCI_GUI/OpenBCI_GUI.pde | 2 +- OpenBCI_GUI/TopNav.pde | 8 ++++---- OpenBCI_GUI/W_Networking.pde | 2 +- OpenBCI_GUI/W_Template.pde | 2 +- README.md | 4 ++-- 7 files changed, 10 insertions(+), 11 deletions(-) diff --git a/OpenBCI_GUI/ControlPanel.pde b/OpenBCI_GUI/ControlPanel.pde index 144fb7c85..d3c3bfc45 100644 --- a/OpenBCI_GUI/ControlPanel.pde +++ b/OpenBCI_GUI/ControlPanel.pde @@ -2778,7 +2778,6 @@ class InitBox { } } else { //if system is already active ... stop session and flip button state back - outputInfo("Learn how to use this application and more at openbci.github.io/Documentation/"); setInitSessionButtonText("START SESSION"); topNav.setLockTopLeftSubNavCp5Objects(false); //Unlock top left subnav buttons //creates new data file name so that you don't accidentally overwrite the old one diff --git a/OpenBCI_GUI/Debugging.pde b/OpenBCI_GUI/Debugging.pde index 2892c5cd6..9d1412bf0 100644 --- a/OpenBCI_GUI/Debugging.pde +++ b/OpenBCI_GUI/Debugging.pde @@ -54,7 +54,7 @@ class HelpWidget { int padding; //current text shown in help widget, based on most recent command - String currentOutput = "Learn how to use this application and more at openbci.github.io/Documentation/"; + String currentOutput = "Learn how to use this application and more at docs.openbci.com"; OutputLevel curOutputLevel = OutputLevel.INFO; HelpWidget(float _xPos, float _yPos, float _width, float _height) { diff --git a/OpenBCI_GUI/OpenBCI_GUI.pde b/OpenBCI_GUI/OpenBCI_GUI.pde index 6fda69e2d..f7e20c398 100644 --- a/OpenBCI_GUI/OpenBCI_GUI.pde +++ b/OpenBCI_GUI/OpenBCI_GUI.pde @@ -388,7 +388,7 @@ void setup() { println(globalScreenDPI.toString()); println(osName.toString()); println("Welcome to the Processing-based OpenBCI GUI!"); //Welcome line. - println("For more information, please visit: https://openbci.github.io/Documentation/docs/06Software/01-OpenBCISoftware/GUIDocs"); + println("For more information, please visit: https://docs.openbci.com/Software/OpenBCISoftware/GUIDocs/"); // Copy sample data to the Users' Documents folder + create Recordings folder directoryManager.init(); diff --git a/OpenBCI_GUI/TopNav.pde b/OpenBCI_GUI/TopNav.pde index 448dec2b9..a98d9e08e 100644 --- a/OpenBCI_GUI/TopNav.pde +++ b/OpenBCI_GUI/TopNav.pde @@ -1160,7 +1160,7 @@ class TutorialSelector { gettingStarted = createButton(tutorial_cp5, name, text, _x, _y, _w, _h); gettingStarted.onRelease(new CallbackListener() { public void controlEvent(CallbackEvent theEvent) { - openURLInBrowser("https://openbci.github.io/Documentation/docs/01GettingStarted/GettingStartedLanding"); + openURLInBrowser("https://docs.openbci.com/GettingStarted/GettingStartedLanding/"); toggleVisibility(); //shut layoutSelector if something is selected } }); @@ -1171,7 +1171,7 @@ class TutorialSelector { testingImpedance = createButton(tutorial_cp5, name, text, _x, _y, _w, _h); testingImpedance.onRelease(new CallbackListener() { public void controlEvent(CallbackEvent theEvent) { - openURLInBrowser("https://openbci.github.io/Documentation/docs/06Software/01-OpenBCISoftware/GUIDocs#impedance-testing"); + openURLInBrowser("https://docs.openbci.com/Software/OpenBCISoftware/GUIDocs/#impedance-testing"); toggleVisibility(); //shut layoutSelector if something is selected } }); @@ -1182,7 +1182,7 @@ class TutorialSelector { troubleshootingGuide = createButton(tutorial_cp5, name, text, _x, _y, _w, _h); troubleshootingGuide.onRelease(new CallbackListener() { public void controlEvent(CallbackEvent theEvent) { - openURLInBrowser("https://docs.openbci.com/docs/10Troubleshooting/GUI_Troubleshooting"); + openURLInBrowser("https://docs.openbci.com/Troubleshooting/GUI_Troubleshooting/"); toggleVisibility(); //shut layoutSelector if something is selected } }); @@ -1193,7 +1193,7 @@ class TutorialSelector { customWidgets = createButton(tutorial_cp5, name, text, _x, _y, _w, _h); customWidgets.onRelease(new CallbackListener() { public void controlEvent(CallbackEvent theEvent) { - openURLInBrowser("https://openbci.github.io/Documentation/docs/06Software/01-OpenBCISoftware/GUIWidgets#custom-widget"); + openURLInBrowser("https://docs.openbci.com/Software/OpenBCISoftware/GUIWidgets/#custom-widget"); toggleVisibility(); //shut layoutSelector if something is selected } }); diff --git a/OpenBCI_GUI/W_Networking.pde b/OpenBCI_GUI/W_Networking.pde index fdc55a46e..ffb98ecba 100644 --- a/OpenBCI_GUI/W_Networking.pde +++ b/OpenBCI_GUI/W_Networking.pde @@ -113,7 +113,7 @@ class W_Networking extends Widget { "obci_eeg1","EEG", "obci_eeg2","EEG", "obci_eeg3","EEG"}; - String networkingGuideURL = "https://openbci.github.io/Documentation/docs/06Software/01-OpenBCISoftware/GUIWidgets#networking"; + String networkingGuideURL = "https://docs.openbci.com/Software/OpenBCISoftware/GUIWidgets/#networking"; String dataOutputsURL = "https://docs.google.com/document/d/e/2PACX-1vR_4DXPTh1nuiOwWKwIZN3NkGP3kRwpP4Hu6fQmy3jRAOaydOuEI1jket6V4V6PG4yIG15H1N7oFfdV/pub"; boolean configIsVisible = false; boolean layoutIsVisible = false; diff --git a/OpenBCI_GUI/W_Template.pde b/OpenBCI_GUI/W_Template.pde index 8b8f73452..b9209d78f 100644 --- a/OpenBCI_GUI/W_Template.pde +++ b/OpenBCI_GUI/W_Template.pde @@ -88,7 +88,7 @@ class W_template extends Widget { public void controlEvent(CallbackEvent theEvent) { //If using a TopNav object, ignore interaction with widget object (ex. widgetTemplateButton) if (!topNav.configSelector.isVisible && !topNav.layoutSelector.isVisible) { - openURLInBrowser("https://openbci.github.io/Documentation/docs/06Software/01-OpenBCISoftware/GUIWidgets#custom-widget"); + openURLInBrowser("https://docs.openbci.com/Software/OpenBCISoftware/GUIWidgets/#custom-widget"); } } }); diff --git a/README.md b/README.md index a8cd93d37..fcbc82d42 100644 --- a/README.md +++ b/README.md @@ -127,5 +127,5 @@ MIT [link_shop_cyton_daisy]: https://shop.openbci.com/collections/frontpage/products/cyton-daisy-biosensing-boards-16-channel [link_ptw]: https://www.pushtheworldllc.com [link_openbci]: http://www.openbci.com -[link_gui_widget_tutorial]: https://openbci.github.io/Documentation/docs/06Software/01-OpenBCISoftware/GUIWidgets#custom-widget -[link_gui_run_from_processing]: https://openbci.github.io/Documentation/docs/06Software/01-OpenBCISoftware/GUIDocs#running-the-openbci-gui-from-the-processing-ide +[link_gui_widget_tutorial]: https://docs.openbci.com/Software/OpenBCISoftware/GUIWidgets/#custom-widget +[link_gui_run_from_processing]: https://docs.openbci.com/Software/OpenBCISoftware/GUIDocs/#running-the-openbci-gui-from-the-processing-ide From 0f977770252f1f85d868bc50c829224b9e18545b Mon Sep 17 00:00:00 2001 From: "retiutut@icloud.com" Date: Fri, 3 Sep 2021 18:04:01 -0500 Subject: [PATCH 04/17] Show warning in footer when a new version of the GUI is available --- CHANGELOG.md | 2 +- OpenBCI_GUI/TopNav.pde | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 79f11848f..14e2162da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # v5.0.7 ### Improvements - +* Show warning in footer when a new version of the GUI is available #992 ### Bug Fixes * Fix GUI not running on some Macs due to high-dpi screen code #987 #990 diff --git a/OpenBCI_GUI/TopNav.pde b/OpenBCI_GUI/TopNav.pde index a98d9e08e..0a1805589 100644 --- a/OpenBCI_GUI/TopNav.pde +++ b/OpenBCI_GUI/TopNav.pde @@ -534,6 +534,11 @@ class TopNav { //Attempt to compare local and remote GUI versions when TopNav is instantiated //This will also set the description/help-text for this cp5 button final Boolean upToDate = guiVersionIsUpToDate(); + + if (!upToDate) { + outputWarn("Update Available! Press the \"Update\" button at the top of the GUI to download the latest version."); + } + updateGuiVersionButton.onRelease(new CallbackListener() { public void controlEvent(CallbackEvent theEvent) { if (upToDate == null) { @@ -542,7 +547,7 @@ class TopNav { if (!upToDate) { openURLInBrowser(guiLatestReleaseLocation); - outputInfo("Update GUI: Opening latest Github release page using default browser"); + outputInfo("Update GUI: Opening latest GUI release page using default browser"); } else { outputSuccess("Update GUI: Local OpenBCI GUI is up-to-date!"); } From adfcd8773354cd394199be8c9a807012b85a9522 Mon Sep 17 00:00:00 2001 From: "retiutut@icloud.com" Date: Tue, 7 Sep 2021 15:58:07 -0500 Subject: [PATCH 05/17] Stream multiple data types over LSL - Initial exhaustive testing is passing --- Networking-Test-Kit/LSL/lslStreamTest.py | 19 ++++++++------- .../LSL/lslStreamTest_3Streams.py | 24 +++++++++++-------- .../LSL/lslStreamTest_FFTplot.py | 3 ++- OpenBCI_GUI/W_Networking.pde | 2 +- 4 files changed, 27 insertions(+), 21 deletions(-) diff --git a/Networking-Test-Kit/LSL/lslStreamTest.py b/Networking-Test-Kit/LSL/lslStreamTest.py index 1b955aa98..d7cb303b5 100644 --- a/Networking-Test-Kit/LSL/lslStreamTest.py +++ b/Networking-Test-Kit/LSL/lslStreamTest.py @@ -5,11 +5,11 @@ # first resolve an EEG stream on the lab network print("looking for an EEG stream...") -streams = resolve_stream('type', 'FOCUS') +streams = resolve_stream('type', 'EEG') # create a new inlet to read from the stream inlet = StreamInlet(streams[0]) -duration = 2 +duration = 5 sleep(1) @@ -18,17 +18,18 @@ def testLSLSamplingRate(): totalNumSamples = 0 validSamples = 0 numChunks = 0 + print( "Testing Sampling Rates..." ) while time.time() <= start + duration: # get chunks of samples - samples, timestamp = inlet.pull_chunk() - if samples: + chunk, timestamp = inlet.pull_chunk() + if chunk: numChunks += 1 - print( len(samples) ) - totalNumSamples += len(samples) - # print(samples); - for sample in samples: - print(sample) + # print( len(chunk) ) + totalNumSamples += len(chunk) + # print(chunk); + for sample in chunk: + # print(sample) validSamples += 1 print( "Number of Chunks and Samples == {} , {}".format(numChunks, totalNumSamples) ) diff --git a/Networking-Test-Kit/LSL/lslStreamTest_3Streams.py b/Networking-Test-Kit/LSL/lslStreamTest_3Streams.py index 7e9acf03b..73d7ed21b 100644 --- a/Networking-Test-Kit/LSL/lslStreamTest_3Streams.py +++ b/Networking-Test-Kit/LSL/lslStreamTest_3Streams.py @@ -10,6 +10,7 @@ import time numStreams = 3 +duration_seconds = 20 # first resolve an EEG stream on the lab network print("looking for an EEG stream...") stream_1 = resolve_stream('type', 'EEG') @@ -22,13 +23,12 @@ intlet_3 = StreamInlet(stream_3[0]) def testLSLSamplingRates(): - print( "Testing Sampling Rates..." ) + print( "Testing Sampling Rates for {} seconds".format(duration_seconds) ) start = time.time() num_samples_1 = 0 num_samples_2 = 0 num_samples_3 = 0 - duration_seconds = 5 - while time.time() < start + 5: + while time.time() < start + duration_seconds: # get a new sample (you can also omit the timestamp part if you're not # interested in it) for i in range(numStreams): @@ -36,21 +36,25 @@ def testLSLSamplingRates(): chunk, timestamps = inlet.pull_chunk() if timestamps: for sample in chunk: - num_samples_1 += 1 + if sample: + num_samples_1 += 1 + #print(sample) elif i == 1: chunk, timestamps_2 = intlet_2.pull_chunk() - for sample in chunk: - print(sample) - num_samples_2 += 1 + if timestamps_2: + for sample in chunk: + num_samples_2 += 1 + #print(sample) elif i == 2: chunk, timestamps_3 = intlet_3.pull_chunk() if timestamps_3: for sample in chunk: num_samples_3 += 1 + #print(sample) #print("Stream", i + 1, " == ", chunk) - print( "Stream 1 Sampling Rate == ", num_samples_1 / 5, " | Type : EEG") - print( "Stream 2 Sampling Rate == ", num_samples_2 / 5, " | Type : AUX") - print( "Stream 3 Sampling Rate == ", num_samples_3 / 5, " | Type : FOCUS") + print( "Stream 1 Sampling Rate == ", num_samples_1 / duration_seconds, " | Type : EEG") + print( "Stream 2 Sampling Rate == ", num_samples_2 / duration_seconds, " | Type : AUX") + print( "Stream 3 Sampling Rate == ", num_samples_3 / duration_seconds, " | Type : FOCUS") testLSLSamplingRates() \ No newline at end of file diff --git a/Networking-Test-Kit/LSL/lslStreamTest_FFTplot.py b/Networking-Test-Kit/LSL/lslStreamTest_FFTplot.py index 70aa1aeab..6a072d35a 100644 --- a/Networking-Test-Kit/LSL/lslStreamTest_FFTplot.py +++ b/Networking-Test-Kit/LSL/lslStreamTest_FFTplot.py @@ -11,6 +11,7 @@ last_print = time.time() fps_counter = deque(maxlen=150) +duration = 5 # first resolve an EEG stream on the lab network print("looking for an EEG stream...") @@ -20,7 +21,7 @@ channel_data = {} -for i in range(5): # how many iterations. Eventually this would be a while True +for i in range(duration): # how many iterations. Eventually this would be a while True for i in range(16): # each of the 16 channels here sample, timestamp = inlet.pull_sample() diff --git a/OpenBCI_GUI/W_Networking.pde b/OpenBCI_GUI/W_Networking.pde index 014e02bc0..ad046c017 100644 --- a/OpenBCI_GUI/W_Networking.pde +++ b/OpenBCI_GUI/W_Networking.pde @@ -1385,7 +1385,7 @@ class Stream extends Thread { } Boolean checkForData() { - if (this.dataType.equals("TimeSeries") || this.dataType.equals("Accel/Aux")) { + if (this.dataType.equals("TimeSeries")) { return w_networking.newTimeSeriesDataToSend; } else { return true; From dc615c75d41c6a7eaf670431c55c0338d1a4695c Mon Sep 17 00:00:00 2001 From: "retiutut@icloud.com" Date: Fri, 17 Sep 2021 16:46:16 -0500 Subject: [PATCH 06/17] Add GUI-wide settings class to keep certain settings across sessions and app starts #997 --- CHANGELOG.md | 4 +- OpenBCI_GUI/ADS1299SettingsController.pde | 2 +- OpenBCI_GUI/CustomCp5Classes.pde | 3 +- OpenBCI_GUI/GuiSettings.pde | 116 ++++++++++++++++++++++ OpenBCI_GUI/Interactivity.pde | 2 +- OpenBCI_GUI/OpenBCI_GUI.pde | 12 ++- OpenBCI_GUI/SessionSettings.pde | 11 -- OpenBCI_GUI/TopNav.pde | 12 +-- 8 files changed, 137 insertions(+), 25 deletions(-) create mode 100644 OpenBCI_GUI/GuiSettings.pde diff --git a/CHANGELOG.md b/CHANGELOG.md index 14e2162da..e88cd65e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,12 @@ # v5.0.7 ### Improvements -* Show warning in footer when a new version of the GUI is available #992 +* Show info in footer when a new version of the GUI is available #992 +* Add GUI-wide settings class to keep certain settings across sessions and app starts #997 ### Bug Fixes * Fix GUI not running on some Macs due to high-dpi screen code #987 #990 +* Fix streaming multiple data types over LSL #971 # v5.0.6 diff --git a/OpenBCI_GUI/ADS1299SettingsController.pde b/OpenBCI_GUI/ADS1299SettingsController.pde index 687701c66..1e8edb284 100644 --- a/OpenBCI_GUI/ADS1299SettingsController.pde +++ b/OpenBCI_GUI/ADS1299SettingsController.pde @@ -138,7 +138,7 @@ class ADS1299SettingsController { } } - boolean showCustomCommandUI = settings.expertModeToggle; + boolean showCustomCommandUI = guiSettings.getExpertModeBoolean(); //Draw background behind command buttons pushStyle(); diff --git a/OpenBCI_GUI/CustomCp5Classes.pde b/OpenBCI_GUI/CustomCp5Classes.pde index f8f6490a1..6159b5b1a 100644 --- a/OpenBCI_GUI/CustomCp5Classes.pde +++ b/OpenBCI_GUI/CustomCp5Classes.pde @@ -90,7 +90,8 @@ class ButtonHelpText{ } public void draw(){ - if (!isVisible || settings.expertModeToggle) { + //When using expert mode, disable help text over UI objects + if (!isVisible || guiSettings.getExpertModeBoolean()) { return; } diff --git a/OpenBCI_GUI/GuiSettings.pde b/OpenBCI_GUI/GuiSettings.pde new file mode 100644 index 000000000..8138a55d7 --- /dev/null +++ b/OpenBCI_GUI/GuiSettings.pde @@ -0,0 +1,116 @@ +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import java.io.*; + + +interface GuiSettingsEnum { + public String getName(); +} + +enum ExpertModeEnum implements GuiSettingsEnum { + ON("Active", true), + OFF("Inactive", false); + + private String name; + private boolean val; + + ExpertModeEnum(String _name, boolean _val) { + this.name = _name; + this.val = _val; + } + + @Override + public String getName() { + return name; + } + + public boolean getBooleanValue() { + return val; + } +} + +public class GuiSettingsValues { + public ExpertModeEnum expertMode; + + public GuiSettingsValues() { + } +} + +class GuiSettings { + + public GuiSettingsValues values; + private String filename; + + GuiSettings(String settingsDirectory) { + + values = new GuiSettingsValues(); + values.expertMode = ExpertModeEnum.OFF; + + StringBuilder settingsFilename = new StringBuilder(settingsDirectory); + settingsFilename.append("GuiWideSettings.txt"); + filename = settingsFilename.toString(); + File fileToCheck = new File(filename); + boolean fileExists = fileToCheck.exists(); + if (fileExists) { + loadSettingsValues(); + println("OpenBCI_GUI::Settings: Found and loaded existing GUI settings from."); + } else { + println("OpenBCI_GUI::Settings: Creating new GUI default settings file."); + saveToFile(); + } + } + + public boolean loadSettingsValues() { + try { + File file = new File(filename); + StringBuilder fileContents = new StringBuilder((int)file.length()); + Scanner scanner = new Scanner(file); + while(scanner.hasNextLine()) { + fileContents.append(scanner.nextLine() + System.lineSeparator()); + } + Gson gson = new Gson(); + values = gson.fromJson(fileContents.toString(), GuiSettingsValues.class); + return true; + } catch (IOException e) { + e.printStackTrace(); + outputWarn("OpenBCI_GUI::Settings: Error loading GUI-wide settings from file. Attempting to create a new one."); + return false; + } + } + + public String getJson() { + Gson gson = new GsonBuilder().setPrettyPrinting().create(); + return gson.toJson(values); + } + + public boolean saveToFile() { + String json = getJson(); + try { + FileWriter writer = new FileWriter(filename); + writer.write(json); + writer.close(); + println("OpenBCI_GUI::Settings: Successfully saved GUI-wide settings to file!"); + return true; + } catch (IOException e) { + e.printStackTrace(); + outputWarn("OpenBCI_GUI::Settings: Error saving GUI-wide settings to file. Please make an issue on GitHub."); + return false; + } + } + + //Call this method at the end of GUI main Setup in OpenBCI_GUI.pde to make sure everything exists + public void applySettingsToFrontEnd() { + topNav.configSelector.toggleExpertModeFrontEnd(values.expertMode.getBooleanValue()); + } + + public void setExpertMode(ExpertModeEnum val) { + values.expertMode = val; + saveToFile(); + } + + + public boolean getExpertModeBoolean() { + return values.expertMode.getBooleanValue(); + } + +} \ No newline at end of file diff --git a/OpenBCI_GUI/Interactivity.pde b/OpenBCI_GUI/Interactivity.pde index 6cfa6ceb4..614f8b378 100644 --- a/OpenBCI_GUI/Interactivity.pde +++ b/OpenBCI_GUI/Interactivity.pde @@ -31,7 +31,7 @@ synchronized void keyPressed() { boolean anyActiveTextfields = isNetworkingTextActive() || textFieldIsActive; if(!controlPanel.isOpen && !anyActiveTextfields){ //don't parse the key if the control panel is open - if (settings.expertModeToggle || key == ' ') { //Check if Expert Mode is On or Spacebar has been pressed + if (guiSettings.getExpertModeBoolean() || key == ' ') { //Check if Expert Mode is On or Spacebar has been pressed if ((int(key) >=32) && (int(key) <= 126)) { //32 through 126 represent all the usual printable ASCII characters parseKey(key); } diff --git a/OpenBCI_GUI/OpenBCI_GUI.pde b/OpenBCI_GUI/OpenBCI_GUI.pde index f7e20c398..1c257aa33 100644 --- a/OpenBCI_GUI/OpenBCI_GUI.pde +++ b/OpenBCI_GUI/OpenBCI_GUI.pde @@ -279,8 +279,9 @@ static CustomOutputStream outputStream; public final static String stopButton_pressToStop_txt = "Stop Data Stream"; public final static String stopButton_pressToStart_txt = "Start Data Stream"; -SessionSettings settings; DirectoryManager directoryManager; +SessionSettings settings; +GuiSettings guiSettings; final int navBarHeight = 32; TopNav topNav; @@ -393,6 +394,7 @@ void setup() { // Copy sample data to the Users' Documents folder + create Recordings folder directoryManager.init(); settings = new SessionSettings(); + guiSettings = new GuiSettings(directoryManager.getSettingsPath()); userPlaybackHistoryFile = directoryManager.getSettingsPath()+"UserPlaybackHistory.json"; //open window @@ -446,6 +448,9 @@ void delayedSetup() { setupComplete = true; // signal that the setup thread has finished println("OpenBCI_GUI::Setup: Setup is complete!"); } + + //Apply GUI-wide settings to front end at the end of setup + guiSettings.applySettingsToFrontEnd(); } //====================== END-OF-SETUP ==========================// @@ -647,8 +652,9 @@ void initSystem() { settings.init(); settings.initCheckPointFive(); } else if (eegDataSource == DATASOURCE_GALEA) { - //After TopNav has been instantiated, default to Expert mode for Galea - topNav.configSelector.toggleExpertMode(true); + //After TopNav has been instantiated, force Expert mode for Galea by default + topNav.configSelector.toggleExpertModeFrontEnd(true); + guiSettings.setExpertMode(ExpertModeEnum.ON); } //Make sure topNav buttons draw in the correct spot diff --git a/OpenBCI_GUI/SessionSettings.pde b/OpenBCI_GUI/SessionSettings.pde index a6fb91bfa..735e73d1a 100644 --- a/OpenBCI_GUI/SessionSettings.pde +++ b/OpenBCI_GUI/SessionSettings.pde @@ -25,9 +25,6 @@ // -- read the comments // -- once you find the right place to add your setting, you can copy the surrounding style // -- uses JSON keys -// -- Example: Expert Mode is a global boolean, so we include it under kJSONKeySettings -// -- We use one variable to load from JSON: loadExpertModeToggle -// -- And another variable to use in the GUI and with saving to JSON: expertModeToggle // -- Example2: GUI version and settings version // -- Requires new JSON key 'version` and settingsVersion // @@ -252,8 +249,6 @@ class SessionSettings { int loadFramerate; int loadDatasource; boolean dataSourceError = false; - //used globally to track and determine if expertMode is on or off - public boolean expertModeToggle = false; String saveDialogName; //Used when Save button is pressed String loadDialogName; //Used when Load button is pressed @@ -366,7 +361,6 @@ class SessionSettings { //Make a second JSON object within our JSONArray to store Global settings for the GUI JSONObject saveGlobalSettings = new JSONObject(); - saveGlobalSettings.setBoolean("Expert Mode", expertModeToggle); saveGlobalSettings.setInt("Current Layout", currentLayout); saveGlobalSettings.setInt("Notch", dataProcessing.bsRange.getIndex()); saveGlobalSettings.setInt("Bandpass Filter", dataProcessing.bpRange.getIndex()); @@ -587,7 +581,6 @@ class SessionSettings { //Load more global settings after this line, if needed int loadNotchSetting = loadGlobalSettings.getInt("Notch"); int loadBandpassSetting = loadGlobalSettings.getInt("Bandpass Filter"); - Boolean loadExpertModeToggle = loadGlobalSettings.getBoolean("Expert Mode"); Boolean loadDataSmoothingSetting = (currentBoard instanceof SmoothingCapableBoard) ? loadGlobalSettings.getBoolean("Data Smoothing") : null; //get the FFT settings @@ -763,10 +756,6 @@ class SessionSettings { topNav.updateSmoothingButtonText(); } - //Apply Expert Mode toggle - //This should not be loaded with other session settings - RW Jan 2021 - //topNav.configSelector.toggleExpertMode(loadExpertModeToggle); - //Load and apply all of the settings that are in dropdown menus. It's a bit much, so it has it's own function below. loadApplyWidgetDropdownText(); diff --git a/OpenBCI_GUI/TopNav.pde b/OpenBCI_GUI/TopNav.pde index 0a1805589..64448c50d 100644 --- a/OpenBCI_GUI/TopNav.pde +++ b/OpenBCI_GUI/TopNav.pde @@ -933,11 +933,13 @@ class ConfigSelector { expertMode.onRelease(new CallbackListener() { public void controlEvent(CallbackEvent theEvent) { toggleVisibility(); - toggleExpertMode(!settings.expertModeToggle); - String outputMsg = settings.expertModeToggle ? + boolean isActive = !guiSettings.getExpertModeBoolean(); + toggleExpertModeFrontEnd(isActive); + String outputMsg = isActive ? "Expert Mode ON: All keyboard shortcuts and features are enabled!" : "Expert Mode OFF: Use spacebar to start/stop the data stream."; output(outputMsg); + guiSettings.setExpertMode(isActive ? ExpertModeEnum.ON : ExpertModeEnum.OFF); } }); expertMode.setDescription("Expert Mode enables advanced keyboard shortcuts and access to all GUI features."); @@ -1022,17 +1024,13 @@ class ConfigSelector { clearAllSettingsYes.setDescription("Clicking 'Yes' will delete all user settings and stop the session if running."); } - public void toggleExpertMode(boolean b) { + public void toggleExpertModeFrontEnd(boolean b) { if (b) { expertMode.getCaptionLabel().setText("Turn Expert Mode Off"); expertMode.setColorBackground(BUTTON_EXPERTPURPLE); - println("GUI Settings: Expert Mode On"); - settings.expertModeToggle = true; } else { expertMode.getCaptionLabel().setText("Turn Expert Mode On"); expertMode.setColorBackground(BUTTON_NOOBGREEN); - println("GUI Settings: Expert Mode Off"); - settings.expertModeToggle = false; } } } From bac268c594dc17d5ba8e413a0bc0896aef5772bc Mon Sep 17 00:00:00 2001 From: "retiutut@icloud.com" Date: Fri, 17 Sep 2021 22:25:34 -0500 Subject: [PATCH 07/17] remove some spaces in topnav.pde --- OpenBCI_GUI/TopNav.pde | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenBCI_GUI/TopNav.pde b/OpenBCI_GUI/TopNav.pde index 64448c50d..2fffdc902 100644 --- a/OpenBCI_GUI/TopNav.pde +++ b/OpenBCI_GUI/TopNav.pde @@ -967,7 +967,7 @@ class ConfigSelector { loadSessionSettings.setDescription("Expert Mode enables advanced keyboard shortcuts and access to all GUI features."); } - private void createDefaultSettingsButton(String name, String text, int _x, int _y, int _w, int _h) { + private void createDefaultSettingsButton(String name, String text, int _x, int _y, int _w, int _h) { defaultSessionSettings = createButton(settings_cp5, name, text, _x, _y, _w, _h); defaultSessionSettings.onRelease(new CallbackListener() { public void controlEvent(CallbackEvent theEvent) { @@ -978,7 +978,7 @@ class ConfigSelector { defaultSessionSettings.setDescription("Expert Mode enables advanced keyboard shortcuts and access to all GUI features."); } - private void createClearAllSettingsButton(String name, String text, int _x, int _y, int _w, int _h) { + private void createClearAllSettingsButton(String name, String text, int _x, int _y, int _w, int _h) { clearAllGUISettings = createButton(settings_cp5, name, text, _x, _y, _w, _h, p5, 12, BUTTON_CAUTIONRED, WHITE); clearAllGUISettings.onRelease(new CallbackListener() { public void controlEvent(CallbackEvent theEvent) { @@ -992,7 +992,7 @@ class ConfigSelector { clearAllGUISettings.setDescription("This will clear all user settings and playback history. You will be asked to confirm."); } - private void createClearSettingsNoButton(String name, String text, int _x, int _y, int _w, int _h) { + private void createClearSettingsNoButton(String name, String text, int _x, int _y, int _w, int _h) { clearAllSettingsNo = createButton(settings_cp5, name, text, _x, _y, _w, _h); clearAllSettingsNo.onRelease(new CallbackListener() { public void controlEvent(CallbackEvent theEvent) { @@ -1005,7 +1005,7 @@ class ConfigSelector { }); } - private void createClearSettingsYesButton(String name, String text, int _x, int _y, int _w, int _h) { + private void createClearSettingsYesButton(String name, String text, int _x, int _y, int _w, int _h) { clearAllSettingsYes = createButton(settings_cp5, name, text, _x, _y, _w, _h); clearAllSettingsYes.onRelease(new CallbackListener() { public void controlEvent(CallbackEvent theEvent) { From 23617375fb2d4e7793f226fc8db910c6abfdb309 Mon Sep 17 00:00:00 2001 From: "retiutut@icloud.com" Date: Sat, 18 Sep 2021 20:43:14 -0500 Subject: [PATCH 08/17] Save GUI-wide settings as .json instead of txt --- OpenBCI_GUI/GuiSettings.pde | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/OpenBCI_GUI/GuiSettings.pde b/OpenBCI_GUI/GuiSettings.pde index 8138a55d7..01e90c2e0 100644 --- a/OpenBCI_GUI/GuiSettings.pde +++ b/OpenBCI_GUI/GuiSettings.pde @@ -47,15 +47,15 @@ class GuiSettings { values.expertMode = ExpertModeEnum.OFF; StringBuilder settingsFilename = new StringBuilder(settingsDirectory); - settingsFilename.append("GuiWideSettings.txt"); + settingsFilename.append("GuiWideSettings.json"); filename = settingsFilename.toString(); File fileToCheck = new File(filename); boolean fileExists = fileToCheck.exists(); if (fileExists) { loadSettingsValues(); - println("OpenBCI_GUI::Settings: Found and loaded existing GUI settings from."); + println("OpenBCI_GUI::Settings: Found and loaded existing GUI-wide Settings from."); } else { - println("OpenBCI_GUI::Settings: Creating new GUI default settings file."); + println("OpenBCI_GUI::Settings: Creating new GUI-wide Settings file."); saveToFile(); } } @@ -74,6 +74,8 @@ class GuiSettings { } catch (IOException e) { e.printStackTrace(); outputWarn("OpenBCI_GUI::Settings: Error loading GUI-wide settings from file. Attempting to create a new one."); + //If there is an error, attempt to overwrite the file or create a new one + saveToFile(); return false; } } From e5a2fedf7dd87e6fbc0d043606aa66ed7ea55c40 Mon Sep 17 00:00:00 2001 From: "retiutut@icloud.com" Date: Sat, 18 Sep 2021 23:08:18 -0500 Subject: [PATCH 09/17] Code Review - Try modifying design pattern using input from Andrey --- OpenBCI_GUI/GuiSettings.pde | 12 +++++------- OpenBCI_GUI/OpenBCI_GUI.pde | 2 +- OpenBCI_GUI/TopNav.pde | 12 ++++++++---- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/OpenBCI_GUI/GuiSettings.pde b/OpenBCI_GUI/GuiSettings.pde index 01e90c2e0..8215c34d6 100644 --- a/OpenBCI_GUI/GuiSettings.pde +++ b/OpenBCI_GUI/GuiSettings.pde @@ -30,7 +30,7 @@ enum ExpertModeEnum implements GuiSettingsEnum { } public class GuiSettingsValues { - public ExpertModeEnum expertMode; + private ExpertModeEnum expertMode = ExpertModeEnum.OFF; public GuiSettingsValues() { } @@ -44,7 +44,6 @@ class GuiSettings { GuiSettings(String settingsDirectory) { values = new GuiSettingsValues(); - values.expertMode = ExpertModeEnum.OFF; StringBuilder settingsFilename = new StringBuilder(settingsDirectory); settingsFilename.append("GuiWideSettings.json"); @@ -53,7 +52,7 @@ class GuiSettings { boolean fileExists = fileToCheck.exists(); if (fileExists) { loadSettingsValues(); - println("OpenBCI_GUI::Settings: Found and loaded existing GUI-wide Settings from."); + println("OpenBCI_GUI::Settings: Found and loaded existing GUI-wide Settings from file."); } else { println("OpenBCI_GUI::Settings: Creating new GUI-wide Settings file."); saveToFile(); @@ -101,18 +100,17 @@ class GuiSettings { } //Call this method at the end of GUI main Setup in OpenBCI_GUI.pde to make sure everything exists - public void applySettingsToFrontEnd() { - topNav.configSelector.toggleExpertModeFrontEnd(values.expertMode.getBooleanValue()); + //Has to be in this class to make sure other classes exist + public void applySettings() { + topNav.configSelector.toggleExpertModeFrontEnd(getExpertModeBoolean()); } public void setExpertMode(ExpertModeEnum val) { values.expertMode = val; saveToFile(); } - public boolean getExpertModeBoolean() { return values.expertMode.getBooleanValue(); } - } \ No newline at end of file diff --git a/OpenBCI_GUI/OpenBCI_GUI.pde b/OpenBCI_GUI/OpenBCI_GUI.pde index 1c257aa33..6cbb0a0ff 100644 --- a/OpenBCI_GUI/OpenBCI_GUI.pde +++ b/OpenBCI_GUI/OpenBCI_GUI.pde @@ -450,7 +450,7 @@ void delayedSetup() { } //Apply GUI-wide settings to front end at the end of setup - guiSettings.applySettingsToFrontEnd(); + guiSettings.applySettings(); } //====================== END-OF-SETUP ==========================// diff --git a/OpenBCI_GUI/TopNav.pde b/OpenBCI_GUI/TopNav.pde index 2fffdc902..b8d41b69d 100644 --- a/OpenBCI_GUI/TopNav.pde +++ b/OpenBCI_GUI/TopNav.pde @@ -535,10 +535,6 @@ class TopNav { //This will also set the description/help-text for this cp5 button final Boolean upToDate = guiVersionIsUpToDate(); - if (!upToDate) { - outputWarn("Update Available! Press the \"Update\" button at the top of the GUI to download the latest version."); - } - updateGuiVersionButton.onRelease(new CallbackListener() { public void controlEvent(CallbackEvent theEvent) { if (upToDate == null) { @@ -553,6 +549,14 @@ class TopNav { } } }); + + if (upToDate == null) { + return; + } + + if (!upToDate) { + outputWarn("Update Available! Press the \"Update\" button at the top of the GUI to download the latest version."); + } } private void createTopNavSettingsButton(String text, int _x, int _y, int _w, int _h, PFont font, int _fontSize, color _bg, color _textColor) { From 595d1291f3077b0639e0271e41b077d4abffed2a Mon Sep 17 00:00:00 2001 From: "retiutut@icloud.com" Date: Sun, 19 Sep 2021 17:30:23 -0500 Subject: [PATCH 10/17] Remove 30 second window option from focus widget --- OpenBCI_GUI/FocusEnums.pde | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/OpenBCI_GUI/FocusEnums.pde b/OpenBCI_GUI/FocusEnums.pde index e6bfe7dd7..accf680ed 100644 --- a/OpenBCI_GUI/FocusEnums.pde +++ b/OpenBCI_GUI/FocusEnums.pde @@ -14,8 +14,7 @@ public enum FocusXLim implements FocusEnum { FIVE (0, 5, "5 sec"), TEN (1, 10, "10 sec"), - TWENTY (2, 20, "20 sec"), - THIRTY (3, 30, "30 sec"); + TWENTY (2, 20, "20 sec"); private int index; private int value; From f193378f90e19fa37cd7d59f8da5d79df5d2d2c5 Mon Sep 17 00:00:00 2001 From: "retiutut@icloud.com" Date: Sun, 19 Sep 2021 17:31:20 -0500 Subject: [PATCH 11/17] Edit changelog for removing 30 second window option in focus widget --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 14e2162da..2e7c30b59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ### Improvements * Show warning in footer when a new version of the GUI is available #992 +* Remove 30 second window option from Focus widget ### Bug Fixes * Fix GUI not running on some Macs due to high-dpi screen code #987 #990 From 3e9063bc41faf17c7d1d6e1c6284035bea83150e Mon Sep 17 00:00:00 2001 From: "retiutut@icloud.com" Date: Mon, 20 Sep 2021 12:00:00 -0500 Subject: [PATCH 12/17] Bump version to 5.0.7 --- OpenBCI_GUI/OpenBCI_GUI.pde | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenBCI_GUI/OpenBCI_GUI.pde b/OpenBCI_GUI/OpenBCI_GUI.pde index 6cbb0a0ff..b38aac20a 100644 --- a/OpenBCI_GUI/OpenBCI_GUI.pde +++ b/OpenBCI_GUI/OpenBCI_GUI.pde @@ -60,7 +60,7 @@ import http.requests.*; // Global Variables & Instances //------------------------------------------------------------------------ //Used to check GUI version in TopNav.pde and displayed on the splash screen on startup -final String localGUIVersionString = "v5.0.7-alpha.1"; +final String localGUIVersionString = "v5.0.7"; String localGUIVersionDate = "September 2021"; String guiLatestVersionGithubAPI = "https://api.github.com/repos/OpenBCI/OpenBCI_GUI/releases/latest"; String guiLatestReleaseLocation = "https://github.com/OpenBCI/OpenBCI_GUI/releases/latest"; From 2df845d34604661bde5fe29a27186a7b85d2f17a Mon Sep 17 00:00:00 2001 From: Richard Waltman Date: Mon, 20 Sep 2021 13:03:34 -0500 Subject: [PATCH 13/17] Update .travis.yml --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c81e354aa..b25d3eea6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,7 @@ jobs: branches: only: - master + - development before_install: - if [ "$TRAVIS_OS_NAME" = osx ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then openssl aes-256-cbc -K $encrypted_2f5d2771e3cb_key -iv $encrypted_2f5d2771e3cb_iv -in release_script/mac_only/Certificates.p12.enc -out release_script/mac_only/Certificates.p12 -d; fi @@ -68,4 +69,4 @@ after_success: notifications: email: on_success: never - on_failure: always \ No newline at end of file + on_failure: always From 9b534086cdf08bd6ae9c5c7448947bc93fd3f075 Mon Sep 17 00:00:00 2001 From: "retiutut@icloud.com" Date: Mon, 20 Sep 2021 13:11:39 -0500 Subject: [PATCH 14/17] Fix version not found in make-release.py --- OpenBCI_GUI/OpenBCI_GUI.pde | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenBCI_GUI/OpenBCI_GUI.pde b/OpenBCI_GUI/OpenBCI_GUI.pde index b38aac20a..8245b5f48 100644 --- a/OpenBCI_GUI/OpenBCI_GUI.pde +++ b/OpenBCI_GUI/OpenBCI_GUI.pde @@ -60,7 +60,7 @@ import http.requests.*; // Global Variables & Instances //------------------------------------------------------------------------ //Used to check GUI version in TopNav.pde and displayed on the splash screen on startup -final String localGUIVersionString = "v5.0.7"; +String localGUIVersionString = "v5.0.7"; String localGUIVersionDate = "September 2021"; String guiLatestVersionGithubAPI = "https://api.github.com/repos/OpenBCI/OpenBCI_GUI/releases/latest"; String guiLatestReleaseLocation = "https://github.com/OpenBCI/OpenBCI_GUI/releases/latest"; From 2a152daeb1c94fe5274c17444d7fdd87f025759b Mon Sep 17 00:00:00 2001 From: Richard Waltman Date: Tue, 28 Sep 2021 18:55:42 -0500 Subject: [PATCH 15/17] update changelog 5.0.7 Fixes #1001 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b671911a..940a9baf0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ * Remove 30 second window option from Focus widget ### Bug Fixes -* Fix GUI not running on some Macs due to high-dpi screen code #987 #990 +* Fix GUI not running on some Macs due to high-dpi screen code #987 #990 #1001 * Fix streaming multiple data types over LSL #971 # v5.0.6 From 94190a9bc2254501b1f91c3d5f072022a2be6ec5 Mon Sep 17 00:00:00 2001 From: Richard Waltman Date: Tue, 28 Sep 2021 19:01:47 -0500 Subject: [PATCH 16/17] Update appveyor processing download location to secure github download --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 5cc9d373a..f415c4dac 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -34,7 +34,7 @@ install: - mkdir %APPVEYOR_BUILD_FOLDER%\temp - cd %APPVEYOR_BUILD_FOLDER%\temp - - appveyor DownloadFile https://download.processing.org/processing-3.5.3-windows64.zip + - appveyor DownloadFile https://github.com/processing/processing/releases/download/processing-0269-3.5.3/processing-3.5.3-windows64.zip - 7z x processing-3.5.3-windows64.zip -y -aoa # cp libraries - mkdir %userprofile%\documents\processing\libraries From 2edced4d5d7c6c5c2242f5efcfe0e1945e4ea556 Mon Sep 17 00:00:00 2001 From: Richard Waltman Date: Tue, 28 Sep 2021 19:48:24 -0500 Subject: [PATCH 17/17] Further improvements to GUI Update Button logic --- CHANGELOG.md | 1 + OpenBCI_GUI/OpenBCI_GUI.pde | 1 + OpenBCI_GUI/TopNav.pde | 15 ++++++++++----- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 940a9baf0..4336d8ffd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ### Improvements * Show info in footer when a new version of the GUI is available #992 +* Further improvements to GUI Update Button logic * Add GUI-wide settings class to keep certain settings across sessions and app starts #997 * Remove 30 second window option from Focus widget diff --git a/OpenBCI_GUI/OpenBCI_GUI.pde b/OpenBCI_GUI/OpenBCI_GUI.pde index 8245b5f48..662590055 100644 --- a/OpenBCI_GUI/OpenBCI_GUI.pde +++ b/OpenBCI_GUI/OpenBCI_GUI.pde @@ -64,6 +64,7 @@ String localGUIVersionString = "v5.0.7"; String localGUIVersionDate = "September 2021"; String guiLatestVersionGithubAPI = "https://api.github.com/repos/OpenBCI/OpenBCI_GUI/releases/latest"; String guiLatestReleaseLocation = "https://github.com/OpenBCI/OpenBCI_GUI/releases/latest"; +Boolean guiIsUpToDate; PApplet ourApplet; diff --git a/OpenBCI_GUI/TopNav.pde b/OpenBCI_GUI/TopNav.pde index b8d41b69d..0bf18568e 100644 --- a/OpenBCI_GUI/TopNav.pde +++ b/OpenBCI_GUI/TopNav.pde @@ -533,15 +533,20 @@ class TopNav { updateGuiVersionButton = createTNButton("updateGuiVersionButton", text, _x, _y, _w, _h, font, _fontSize, _bg, _textColor); //Attempt to compare local and remote GUI versions when TopNav is instantiated //This will also set the description/help-text for this cp5 button - final Boolean upToDate = guiVersionIsUpToDate(); + //Do this check on app start and store as a global variable + guiIsUpToDate = guiVersionIsUpToDate(); updateGuiVersionButton.onRelease(new CallbackListener() { public void controlEvent(CallbackEvent theEvent) { - if (upToDate == null) { + //Perform check again when button is pressed. User may have connected to internet by now! + guiIsUpToDate = guiVersionIsUpToDate(); + + if (guiIsUpToDate == null) { + outputError("Update GUI: Unable to check for new version of GUI. Try again when connected to the internet."); return; } - if (!upToDate) { + if (!guiIsUpToDate) { openURLInBrowser(guiLatestReleaseLocation); outputInfo("Update GUI: Opening latest GUI release page using default browser"); } else { @@ -550,11 +555,11 @@ class TopNav { } }); - if (upToDate == null) { + if (guiIsUpToDate == null) { return; } - if (!upToDate) { + if (!guiIsUpToDate) { outputWarn("Update Available! Press the \"Update\" button at the top of the GUI to download the latest version."); } }