Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
88280fa
Refactor FFT settings variables across the GUI and Add GlobalFFTSetti…
retiutut Apr 3, 2025
0db7671
Fix FFT and BandPower widget dropdowns linked settings on frontend
retiutut Apr 4, 2025
31a20ad
Add SpectrogramEnums.pde for spectrogram settings
retiutut Apr 8, 2025
19a14e9
Refactor settings for TimeSeries, Accelerometer, Analog Read, and Dig…
retiutut Apr 10, 2025
2a9ba27
Refactor SessionSettings global variable to be named sessionSettings …
retiutut Apr 10, 2025
6b83bc3
Remove usage of pApplet from Widget class and instead use global exis…
retiutut Apr 10, 2025
43f91d6
Update variable name for WidgetManager and NAV_HEIGHT
retiutut Apr 10, 2025
bdd3dd9
Refactor locking/unlocking Widget Settings dropdowns when TopNav UIs …
retiutut Apr 10, 2025
b4c5fd1
Refactor WidgetManager to contain all Widgets
retiutut Apr 11, 2025
73e3926
Remove widgetName from the constructor of base Widget class
retiutut Apr 11, 2025
54ef837
Refactor WidgetManager even more for readability and maintainability
retiutut Apr 11, 2025
5a5053d
Remove widgetOptions ArrayList from WidgetManager
retiutut Apr 11, 2025
adeba05
Add functional WidgetWithSettings class using the new WidgetSettings …
retiutut Apr 14, 2025
3f9f6d6
Refactor and clean up SessionSettings.pde with initial Save/Load sett…
retiutut Apr 15, 2025
073205d
Remove mention of Ganglion in [ and ] keys in Interactivity.pde
retiutut Apr 17, 2025
074fff7
Add functional save/load widget settings with simpler method calls - …
retiutut Apr 18, 2025
93757b3
Add ability to save ChannelSelect settings to WidgetWithSettings clas…
retiutut Apr 18, 2025
b5d8c32
Refactor SessionSettings again after achieving functionality (for rea…
retiutut Apr 18, 2025
f1053e0
Add WidgetWithSettings to Accelerometer, AnalogRead, FFT, and BandPow…
retiutut Apr 24, 2025
8b68e6b
Remove HeadPlot widget due to multiple bugs, glitches, and performanc…
retiutut Apr 24, 2025
a29d9bc
Add WidgetWithSettings to EMG and EMGJoystick widgets
retiutut Apr 24, 2025
2a465c1
Add WidgetWithSettings to Spectrogram Widget and account for dual cha…
retiutut Apr 24, 2025
8a7e69a
Refactor Spectrogram Widget for readability and maintainability
retiutut Apr 24, 2025
c3ab090
Add WidgetWithSettings to Marker widget
retiutut Apr 25, 2025
ad4621f
Add WidgetWithSettings to Focus widget
retiutut Apr 25, 2025
cc2103b
Add FilterSettings to SessionSettings
retiutut Apr 25, 2025
5843fad
Add EMGSettings to SessionSettings
retiutut Apr 25, 2025
c002eaf
Fix null pointer in ADS1299SettingsController and fix front end bug
retiutut Apr 28, 2025
916b941
Add the option to switch band power widget to linear scale #1139
retiutut Apr 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions OpenBCI_GUI/ADS1299SettingsController.pde
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import org.apache.commons.lang3.tuple.Pair;


class ADS1299SettingsController {
private PApplet _parentApplet;
private PApplet parentApplet;
private boolean isVisible = false;
protected int x, y, w, h;
protected final int PADDING_3 = 3;
Expand Down Expand Up @@ -64,16 +64,16 @@ class ADS1299SettingsController {
protected int channelCount;
protected List<Integer> activeChannels;

ADS1299SettingsController(PApplet _parent, List<Integer> _activeChannels, int _x, int _y, int _w, int _h, int _channelBarHeight) {
ADS1299SettingsController(PApplet _parentApplet, List<Integer> _activeChannels, int _x, int _y, int _w, int _h, int _channelBarHeight) {
x = _x;
y = _y;
w = _w;
h = _h;
channelBarHeight = _channelBarHeight;

_parentApplet = _parent;
hwsCp5 = new ControlP5(_parentApplet);
hwsCp5.setGraphics(_parentApplet, 0,0);
this.parentApplet = _parentApplet;
hwsCp5 = new ControlP5(parentApplet);
hwsCp5.setGraphics(parentApplet, 0,0);
hwsCp5.setAutoDraw(false);

int colOffset = (w / CONTROL_BUTTON_COUNT) / 2;
Expand Down Expand Up @@ -180,7 +180,7 @@ class ADS1299SettingsController {
toggleWidthAndHeight = DEFAULT_TOGGLE_WIDTH;
}

hwsCp5.setGraphics(_parentApplet, 0, 0);
hwsCp5.setGraphics(parentApplet, 0, 0);

int colOffset = (w / CONTROL_BUTTON_COUNT) / 2;
int button_y = y + h + PADDING_3;
Expand Down Expand Up @@ -233,7 +233,7 @@ class ADS1299SettingsController {
dropdownY = int(y + (channelBarHeight * rowCount) + ((channelBarHeight - dropdownH) / 2));
final int buttonXIncrement = spaceBetweenButtons + dropdownW;

int toggleX = dropdownX + (dropdownW / 2) - (toggleWidthAndHeight);
int toggleX = dropdownX + (dropdownW / 2) - (toggleWidthAndHeight / 2);
channelSelectToggles[i].setPosition(toggleX, dropdownY);
channelSelectToggles[i].setSize(toggleWidthAndHeight, toggleWidthAndHeight);

Expand Down Expand Up @@ -750,8 +750,9 @@ void loadHardwareSettings(File selection) {
if (((ADS1299SettingsBoard)currentBoard).getADS1299Settings().loadSettingsValues(selection.getAbsolutePath())) {
outputSuccess("Hardware Settings Loaded!");
for (int i = 0; i < globalChannelCount; i++) {
w_timeSeries.adsSettingsController.updateChanSettingsDropdowns(i, currentBoard.isEXGChannelActive(i));
w_timeSeries.adsSettingsController.updateHasUnappliedSettings(i);
W_TimeSeries timeSeriesWidget = widgetManager.getTimeSeriesWidget();
timeSeriesWidget.adsSettingsController.updateChanSettingsDropdowns(i, currentBoard.isEXGChannelActive(i));
timeSeriesWidget.adsSettingsController.updateHasUnappliedSettings(i);
}
} else {
outputError("Failed to load Hardware Settings.");
Expand Down
84 changes: 84 additions & 0 deletions OpenBCI_GUI/AccelerometerEnums.pde
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
public enum AccelerometerVerticalScale implements IndexingInterface
{
AUTO (0, 0, "Auto"),
ONE_G (1, 1, "1 g"),
TWO_G (2, 2, "2 g"),
FOUR_G (3, 4, "4 g");

private int index;
private int value;
private String label;

AccelerometerVerticalScale(int _index, int _value, String _label) {
this.index = _index;
this.value = _value;
this.label = _label;
}

public int getValue() {
return value;
}

@Override
public String getString() {
return label;
}

@Override
public int getIndex() {
return index;
}

public int getHighestValue() {
int highestValue = 0;
for (AccelerometerVerticalScale scale : values()) {
if (scale.getValue() > highestValue) {
highestValue = scale.getValue();
}
}
return highestValue;
}
}

public enum AccelerometerHorizontalScale implements IndexingInterface
{
ONE_SEC (1, 1, "1 sec"),
THREE_SEC (2, 3, "3 sec"),
FIVE_SEC (3, 5, "5 sec"),
TEN_SEC (4, 10, "10 sec"),
TWENTY_SEC (5, 20, "20 sec");

private int index;
private int value;
private String label;

AccelerometerHorizontalScale(int _index, int _value, String _label) {
this.index = _index;
this.value = _value;
this.label = _label;
}

public int getValue() {
return value;
}

@Override
public String getString() {
return label;
}

@Override
public int getIndex() {
return index;
}

public int getHighestValue() {
int highestValue = 0;
for (AccelerometerHorizontalScale scale : values()) {
if (scale.getValue() > highestValue) {
highestValue = scale.getValue();
}
}
return highestValue;
}
}
67 changes: 67 additions & 0 deletions OpenBCI_GUI/AnalogReadEnums.pde
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
public enum AnalogReadVerticalScale implements IndexingInterface
{
AUTO (0, 0, "Auto"),
FIFTY (1, 50, "50 uV"),
ONE_HUNDRED (2, 100, "100 uV"),
TWO_HUNDRED (3, 200, "200 uV"),
FOUR_HUNDRED (4, 400, "400 uV"),
ONE_THOUSAND_FIFTY (5, 1050, "1050 uV"),
TEN_THOUSAND (6, 10000, "10000 uV");

private int index;
private int value;
private String label;

AnalogReadVerticalScale(int _index, int _value, String _label) {
this.index = _index;
this.value = _value;
this.label = _label;
}

public int getValue() {
return value;
}

@Override
public String getString() {
return label;
}

@Override
public int getIndex() {
return index;
}
}

public enum AnalogReadHorizontalScale implements IndexingInterface
{
ONE_SEC (1, 1, "1 sec"),
THREE_SEC (2, 3, "3 sec"),
FIVE_SEC (3, 5, "5 sec"),
TEN_SEC (4, 10, "10 sec"),
TWENTY_SEC (5, 20, "20 sec");

private int index;
private int value;
private String label;

AnalogReadHorizontalScale(int _index, int _value, String _label) {
this.index = _index;
this.value = _value;
this.label = _label;
}

public int getValue() {
return value;
}

@Override
public String getString() {
return label;
}

@Override
public int getIndex() {
return index;
}
}
56 changes: 56 additions & 0 deletions OpenBCI_GUI/BandPowerEnums.pde
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@

public enum BPLogLin implements IndexingInterface {
LOG (0, "Log"),
LINEAR (1, "Linear");

private int index;
private String label;

BPLogLin(int _index, String _label) {
this.index = _index;
this.label = _label;
}

@Override
public String getString() {
return label;
}

@Override
public int getIndex() {
return index;
}
}

public enum BPVerticalScale implements IndexingInterface {
SCALE_10 (0, 10, "10 uV"),
SCALE_50 (1, 50, "50 uV"),
SCALE_100 (2, 100, "100 uV"),
SCALE_500 (3, 500, "500 uV"),
SCALE_1000 (4, 1000, "1000 uV"),
SCALE_1500 (5, 1500, "1500 uV");

private int index;
private final int value;
private String label;

BPVerticalScale(int index, int value, String label) {
this.index = index;
this.value = value;
this.label = label;
}

public int getValue() {
return value;
}

@Override
public String getString() {
return label;
}

@Override
public int getIndex() {
return index;
}
}
29 changes: 20 additions & 9 deletions OpenBCI_GUI/ChannelSelect.pde
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ class ChannelSelect {
protected boolean channelSelectHover;
protected boolean isVisible;

ChannelSelect(PApplet _parent, int _x, int _y, int _w, int _navH) {
ChannelSelect(PApplet _parentApplet, int _x, int _y, int _w, int _navH) {
x = _x;
y = _y;
w = _w;
h = _navH;
navH = _navH;

//setup for checkboxes
cp5_chanSelect = new ControlP5(_parent);
cp5_chanSelect.setGraphics(_parent, 0, 0);
cp5_chanSelect = new ControlP5(_parentApplet);
cp5_chanSelect.setGraphics(_parentApplet, 0, 0);
cp5_chanSelect.setAutoDraw(false); //draw only when specified
}

Expand Down Expand Up @@ -66,8 +66,8 @@ class ChannelSelect {
popStyle();
}

public void screenResized(PApplet _parent) {
cp5_chanSelect.setGraphics(_parent, 0, 0);
public void screenResized(PApplet _parentApplet) {
cp5_chanSelect.setGraphics(_parentApplet, 0, 0);
}

public void mousePressed(boolean dropdownIsActive) {
Expand Down Expand Up @@ -111,8 +111,8 @@ class ExGChannelSelect extends ChannelSelect {
protected List<Toggle> channelButtons;
private List<Integer> activeChannels = new ArrayList<Integer>();

ExGChannelSelect(PApplet _parent, int _x, int _y, int _w, int _navH) {
super(_parent, _x, _y, _w, _navH);
ExGChannelSelect(PApplet _parentApplet, int _x, int _y, int _w, int _navH) {
super(_parentApplet, _x, _y, _w, _navH);
createButtons();
}

Expand Down Expand Up @@ -232,6 +232,17 @@ class ExGChannelSelect extends ChannelSelect {
return activeChannels;
}

public void updateChannelSelection(List<Integer> channels) {
// First deactivate all channels
deactivateAllButtons();

// Then activate only the selected channels
for (Integer channel : channels) {
if (channel >= 0 && channel < channelButtons.size()) {
setToggleState(channel, true); // Changed from toggleButton
}
}
}
}

class DualChannelSelector {
Expand Down Expand Up @@ -282,8 +293,8 @@ class DualExGChannelSelect extends ExGChannelSelect {

DualChannelSelector dualChannelSelector;

DualExGChannelSelect(PApplet _parent, int _x, int _y, int _w, int _navH, boolean isFirstRow) {
super(_parent, _x, _y, _w, _navH);
DualExGChannelSelect(PApplet _parentApplet, int _x, int _y, int _w, int _navH, boolean isFirstRow) {
super(_parentApplet, _x, _y, _w, _navH);
dualChannelSelector = new DualChannelSelector(isFirstRow);
}

Expand Down
4 changes: 2 additions & 2 deletions OpenBCI_GUI/Containers.pde
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ void drawContainers() {
if (widthOfLastScreen_C != width || heightOfLastScreen_C != height) {
setupContainers();
//setupVizs(); //container extension example (more below)
settings.widthOfLastScreen = width;
settings.heightOfLastScreen = height;
sessionSettings.widthOfLastScreen = width;
sessionSettings.heightOfLastScreen = height;
}
}

Expand Down
Loading