Skip to content

Commit c002eaf

Browse files
committed
Fix null pointer in ADS1299SettingsController and fix front end bug
1 parent 5843fad commit c002eaf

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

OpenBCI_GUI/ADS1299SettingsController.pde

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import org.apache.commons.lang3.tuple.Pair;
22

33

44
class ADS1299SettingsController {
5-
private PApplet _parentApplet;
5+
private PApplet parentApplet;
66
private boolean isVisible = false;
77
protected int x, y, w, h;
88
protected final int PADDING_3 = 3;
@@ -71,9 +71,9 @@ class ADS1299SettingsController {
7171
h = _h;
7272
channelBarHeight = _channelBarHeight;
7373

74-
_parentApplet = _parentApplet;
75-
hwsCp5 = new ControlP5(_parentApplet);
76-
hwsCp5.setGraphics(_parentApplet, 0,0);
74+
this.parentApplet = _parentApplet;
75+
hwsCp5 = new ControlP5(parentApplet);
76+
hwsCp5.setGraphics(parentApplet, 0,0);
7777
hwsCp5.setAutoDraw(false);
7878

7979
int colOffset = (w / CONTROL_BUTTON_COUNT) / 2;
@@ -180,7 +180,7 @@ class ADS1299SettingsController {
180180
toggleWidthAndHeight = DEFAULT_TOGGLE_WIDTH;
181181
}
182182

183-
hwsCp5.setGraphics(_parentApplet, 0, 0);
183+
hwsCp5.setGraphics(parentApplet, 0, 0);
184184

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

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

0 commit comments

Comments
 (0)