Skip to content

Commit 8de8f49

Browse files
committed
Rename "smoothing" to "window" in EMG Settings #1158
1 parent 85a9860 commit 8de8f49

4 files changed

Lines changed: 21 additions & 22 deletions

File tree

OpenBCI_GUI/EmgSettings.pde

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ class EmgSettings {
2121
}
2222
Gson gson = new Gson();
2323
EmgSettingsValues tempValues = gson.fromJson(fileContents.toString(), EmgSettingsValues.class);
24-
if (tempValues.smoothing.length != channelCount) {
24+
if (tempValues.window.length != channelCount) {
2525
outputError("Emg Settings: Loaded EMG Settings file has different number of channels than the current board.");
2626
return false;
2727
}
2828
//Explicitely copy values over to avoid reference issues
2929
//(e.g. values = tempValues "nukes" the old values object)
30-
values.smoothing = tempValues.smoothing;
30+
values.window = tempValues.window;
3131
values.uvLimit = tempValues.uvLimit;
3232
values.creepIncreasing = tempValues.creepIncreasing;
3333
values.creepDecreasing = tempValues.creepDecreasing;

OpenBCI_GUI/EmgSettingsEnums.pde

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ interface EmgSettingsEnum {
33
public String getString();
44
}
55

6-
public enum EmgSmoothing implements EmgSettingsEnum
6+
public enum EmgWindow implements EmgSettingsEnum
77
{
88
ONE_HUNDREDTH_SECOND (0, "0.01 s", .01f),
99
ONE_TENTH_SECOND (1, "0.1 s", .1f),
@@ -18,7 +18,7 @@ public enum EmgSmoothing implements EmgSettingsEnum
1818
private String name;
1919
private float value;
2020

21-
EmgSmoothing(int index, String name, float value) {
21+
EmgWindow(int index, String name, float value) {
2222
this.index = index;
2323
this.name = name;
2424
this.value = value;

OpenBCI_GUI/EmgSettingsUI.pde

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ class EmgSettingsUI extends PApplet implements Runnable {
4242
public EmgSettingsValues emgSettingsValues;
4343

4444
private TextBox channelColumnLabel;
45-
private TextBox smoothLabel;
45+
private TextBox windowLabel;
4646
private TextBox uvLimitLabel;
4747
private TextBox creepIncLabel;
4848
private TextBox creepDecLabel;
4949
private TextBox minDeltaUvLabel;
5050
private TextBox lowLimitLabel;
5151

52-
private ScrollableList[] smoothLists;
52+
private ScrollableList[] windowLists;
5353
private ScrollableList[] uvLimitLists;
5454
private ScrollableList[] creepIncLists;
5555
private ScrollableList[] creepDecLists;
@@ -129,7 +129,7 @@ class EmgSettingsUI extends PApplet implements Runnable {
129129

130130
//Draw column labels
131131
channelColumnLabel.draw();
132-
smoothLabel.draw();
132+
windowLabel.draw();
133133
uvLimitLabel.draw();
134134
creepIncLabel.draw();
135135
creepDecLabel.draw();
@@ -154,7 +154,7 @@ class EmgSettingsUI extends PApplet implements Runnable {
154154
int colOffset = colWidth / 2;
155155
int labelY = y + HEADER_HEIGHT / 2;
156156
channelColumnLabel.setPosition(x + colOffset, labelY);
157-
smoothLabel.setPosition(x + colOffset + colWidth, labelY);
157+
windowLabel.setPosition(x + colOffset + colWidth, labelY);
158158
uvLimitLabel.setPosition(x + colOffset + colWidth*2, labelY);
159159
creepIncLabel.setPosition(x + colOffset + colWidth*3, labelY);
160160
creepDecLabel.setPosition(x + colOffset + colWidth*4, labelY);
@@ -244,8 +244,8 @@ class EmgSettingsUI extends PApplet implements Runnable {
244244
dropdownYPositions[i] = HEADER_HEIGHT + int(y + ((ROW_HEIGHT) * i) + (((ROW_HEIGHT) - DROPDOWN_HEIGHT) / 2));
245245
final int buttonXIncrement = DROPDOWN_SPACER + dropdownWidth;
246246

247-
smoothLists[i].setPosition(dropdownX, dropdownYPositions[i]);
248-
smoothLists[i].setSize(dropdownWidth, MAX_HEIGHT_ITEMS * DROPDOWN_HEIGHT);
247+
windowLists[i].setPosition(dropdownX, dropdownYPositions[i]);
248+
windowLists[i].setSize(dropdownWidth, MAX_HEIGHT_ITEMS * DROPDOWN_HEIGHT);
249249

250250
dropdownX += buttonXIncrement;
251251
uvLimitLists[i].setPosition(dropdownX, dropdownYPositions[i]);
@@ -292,7 +292,7 @@ class EmgSettingsUI extends PApplet implements Runnable {
292292
int colOffset = colWidth / 2;
293293
int labelY = y + HEADER_HEIGHT / 2;
294294
channelColumnLabel = new TextBox("Channel", x + colOffset, labelY, labelTxt, labelBG, 12, h3, CENTER, TOP);
295-
smoothLabel = new TextBox("Smooth", x + colOffset + colWidth, labelY, labelTxt, labelBG, 12, h3, CENTER, TOP);
295+
windowLabel = new TextBox("Window", x + colOffset + colWidth, labelY, labelTxt, labelBG, 12, h3, CENTER, TOP);
296296
uvLimitLabel = new TextBox("uV Limit", x + colOffset + colWidth*2, labelY, labelTxt, labelBG, 12, h3, CENTER, TOP);
297297
creepIncLabel = new TextBox("Creep +", x + colOffset + colWidth*3, labelY, labelTxt, labelBG, 12, h3, CENTER, TOP);
298298
creepDecLabel = new TextBox("Creep -", x + colOffset + colWidth*4, labelY, labelTxt, labelBG, 12, h3, CENTER, TOP);
@@ -306,7 +306,7 @@ class EmgSettingsUI extends PApplet implements Runnable {
306306
//the size and space of these buttons are dependendant on the size of the screen and full ChannelController
307307
verbosePrint("EmgChannelSettingsUI: Creating EMG channel setting UI objects...");
308308

309-
smoothLists = new ScrollableList[channelCount];
309+
windowLists = new ScrollableList[channelCount];
310310
uvLimitLists = new ScrollableList[channelCount];
311311
creepIncLists = new ScrollableList[channelCount];
312312
creepDecLists = new ScrollableList[channelCount];
@@ -318,7 +318,7 @@ class EmgSettingsUI extends PApplet implements Runnable {
318318
//Init dropdowns in reverse so that chan 1 draws on top of chan 2, etc.
319319
for (int i = channelCount - 1; i >= 0; i--) {
320320
int exgChannel = i;
321-
smoothLists[i] = createDropdown(exgChannel, "smooth_ch_"+(i+1), emgSettingsValues.smoothing[exgChannel].values(), emgSettingsValues.smoothing[exgChannel]);
321+
windowLists[i] = createDropdown(exgChannel, "smooth_ch_"+(i+1), emgSettingsValues.window[exgChannel].values(), emgSettingsValues.window[exgChannel]);
322322
uvLimitLists[i] = createDropdown(exgChannel, "uvLimit_ch_"+(i+1), emgSettingsValues.uvLimit[exgChannel].values(), emgSettingsValues.uvLimit[exgChannel]);
323323
creepIncLists[i] = createDropdown(exgChannel, "creep_inc_ch_"+(i+1), emgSettingsValues.creepIncreasing[exgChannel].values(), emgSettingsValues.creepIncreasing[exgChannel]);
324324
creepDecLists[i] = createDropdown(exgChannel, "creep_dec_ch_"+(i+1), emgSettingsValues.creepDecreasing[exgChannel].values(), emgSettingsValues.creepDecreasing[exgChannel]);
@@ -386,9 +386,8 @@ class EmgSettingsUI extends PApplet implements Runnable {
386386
EmgSettingsEnum myEnum = (EmgSettingsEnum)bob.get("value");
387387
verbosePrint("EmgSettings: " + (theEvent.getController()).getName() + " == " + myEnum.getString());
388388

389-
if (myEnum instanceof EmgSmoothing) {
390-
//verbosePrint("HardwareSettings: previousVal == " + emgSettingsValues.previousValues.gain[channel]);
391-
emgSettingsValues.smoothing[channel] = (EmgSmoothing)myEnum;
389+
if (myEnum instanceof EmgWindow) {
390+
emgSettingsValues.window[channel] = (EmgWindow)myEnum;
392391
} else if (myEnum instanceof EmgUVLimit) {
393392
emgSettingsValues.uvLimit[channel] = (EmgUVLimit)myEnum;
394393
} else if (myEnum instanceof EmgCreepIncreasing) {
@@ -437,15 +436,15 @@ class EmgSettingsUI extends PApplet implements Runnable {
437436
private void updateCp5Objects() {
438437
for (int i = 0; i < channelCount; i++) {
439438
//Fetch values from the EmgSettingsValues object
440-
EmgSmoothing updateSmoothing = emgSettingsValues.smoothing[i];
439+
EmgWindow updateSmoothing = emgSettingsValues.window[i];
441440
EmgUVLimit updateUVLimit = emgSettingsValues.uvLimit[i];
442441
EmgCreepIncreasing updateCreepIncreasing = emgSettingsValues.creepIncreasing[i];
443442
EmgCreepDecreasing updateCreepDecreasing = emgSettingsValues.creepDecreasing[i];
444443
EmgMinimumDeltaUV updateMinimumDeltaUV = emgSettingsValues.minimumDeltaUV[i];
445444
EmgLowerThresholdMinimum updateLowerThresholdMinimum = emgSettingsValues.lowerThresholdMinimum[i];
446445

447446
//Update the ScrollableLists
448-
smoothLists[i].getCaptionLabel().setText(updateSmoothing.getString());
447+
windowLists[i].getCaptionLabel().setText(updateSmoothing.getString());
449448
uvLimitLists[i].getCaptionLabel().setText(updateUVLimit.getString());
450449
creepIncLists[i].getCaptionLabel().setText(updateCreepIncreasing.getString());
451450
creepDecLists[i].getCaptionLabel().setText(updateCreepDecreasing.getString());

OpenBCI_GUI/EmgSettingsValues.pde

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
class EmgSettingsValues {
99

1010
//These values can be changed via dropdowns
11-
public EmgSmoothing[] smoothing;
11+
public EmgWindow[] window;
1212
public EmgUVLimit[] uvLimit;
1313
public EmgCreepIncreasing[] creepIncreasing;
1414
public EmgCreepDecreasing[] creepDecreasing;
@@ -27,7 +27,7 @@ class EmgSettingsValues {
2727

2828
channelCount = currentBoard.getNumEXGChannels();
2929

30-
smoothing = new EmgSmoothing[channelCount];
30+
window = new EmgWindow[channelCount];
3131
uvLimit = new EmgUVLimit[channelCount];
3232
creepIncreasing = new EmgCreepIncreasing[channelCount];
3333
creepDecreasing = new EmgCreepDecreasing[channelCount];
@@ -39,7 +39,7 @@ class EmgSettingsValues {
3939
lowerThreshold = new float[channelCount];
4040
averageuV = new float[channelCount];
4141

42-
Arrays.fill(smoothing, EmgSmoothing.ONE_SECOND);
42+
Arrays.fill(window, EmgWindow.ONE_SECOND);
4343
Arrays.fill(uvLimit, EmgUVLimit.TWO_HUNDRED_UV);
4444
Arrays.fill(creepIncreasing, EmgCreepIncreasing.POINT_9);
4545
Arrays.fill(creepDecreasing, EmgCreepDecreasing.POINT_99999);
@@ -55,7 +55,7 @@ class EmgSettingsValues {
5555
public void process(float[][] data_forDisplay_uV) {
5656
//looping over channels and analyzing input data
5757
for (int i = 0; i < channelCount; i++) {
58-
float averagePeriod = currentBoard.getSampleRate() * smoothing[i].getValue();
58+
float averagePeriod = currentBoard.getSampleRate() * window[i].getValue();
5959
int _uvLimit = uvLimit[i].getValue();
6060
float creepSpeedIncreasing = creepIncreasing[i].getValue();
6161
float creepSpeedDecreasing = creepDecreasing[i].getValue();

0 commit comments

Comments
 (0)