Skip to content

Commit ae68cb4

Browse files
authored
Merge pull request #86 from ShimmerEngineering/JA-80
JA-80 Minor fix for mCurrentLEDStatus not being set
2 parents 6079652 + e8d8585 commit ae68cb4

2 files changed

Lines changed: 22 additions & 3 deletions

File tree

ShimmerDriver/src/main/java/com/shimmerresearch/bluetooth/ShimmerBluetooth.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1886,9 +1886,7 @@ else if(currentCommand==SET_GYRO_TEMP_VREF_COMMAND) {
18861886
mConfigByte0=mTempByteValue;
18871887
}
18881888
else if(currentCommand==SET_BLINK_LED) {
1889-
if(((byte[])getListofInstructions().get(0)).length>2){
1890-
mCurrentLEDStatus=(int)((byte[])getListofInstructions().get(0))[1];
1891-
}
1889+
mCurrentLEDStatus=(int)((byte[])getListofInstructions().get(0))[1];
18921890
}
18931891
else if(currentCommand==TEST_CONNECTION_COMMAND) {
18941892
//DO Nothing

ShimmerPCBasicExamples/src/main/java/com/shimmerresearch/simpleexamples/SensorMapsExample.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import java.io.IOException;
4040
import java.util.ArrayList;
4141
import java.util.List;
42+
import java.util.Random;
4243
import java.awt.Canvas;
4344
import java.awt.Graphics2D;
4445
import java.awt.Image;
@@ -99,6 +100,26 @@ public void actionPerformed(ActionEvent e) {
99100
btnDisconnect.setBounds(415, 90, 187, 31);
100101
frame.getContentPane().add(btnDisconnect);
101102

103+
JButton btnSetBlinkLED = new JButton("Set Blink LED (Random)");
104+
btnSetBlinkLED.addActionListener(new ActionListener() {
105+
public void actionPerformed(ActionEvent arg0) {
106+
try {
107+
Random random = new Random();
108+
int ledvalue = random.nextInt(3-0)+0;
109+
System.out.println("LED Value to Write: " + ledvalue);
110+
shimmer.writeLEDCommand(ledvalue);
111+
Thread.sleep(400);//make sure to wait for the cmd to be written.
112+
int currentledvalue = shimmer.getCurrentLEDStatus();
113+
System.out.println("Current ED Value: " + currentledvalue);
114+
} catch (Exception e) {
115+
116+
}
117+
}
118+
});
119+
btnSetBlinkLED.setBounds(625, 90, 187, 31);
120+
frame.getContentPane().add(btnSetBlinkLED);
121+
122+
102123
JLabel lblShimmerStatus = new JLabel("Shimmer Status");
103124
lblShimmerStatus.setBounds(10, 139, 144, 23);
104125
frame.getContentPane().add(lblShimmerStatus);

0 commit comments

Comments
 (0)