Skip to content

Commit 2c04285

Browse files
neel1998CloudyPadmal
authored andcommitted
unstable oscilloscope bug fixed (#1923)
1 parent 2bbecd6 commit 2c04285

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

app/src/main/java/io/pslab/activity/OscilloscopeActivity.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -230,10 +230,10 @@ public void onClick(View v) {
230230
mainLayout = findViewById(R.id.oscilloscope_mail_layout);
231231

232232
channelIndexMap = new HashMap<>();
233-
channelIndexMap.put(CHANNEL.CH1.toString(), 0);
234-
channelIndexMap.put(CHANNEL.CH2.toString(), 1);
235-
channelIndexMap.put(CHANNEL.CH3.toString(), 2);
236-
channelIndexMap.put(CHANNEL.MIC.toString(), 3);
233+
channelIndexMap.put(CHANNEL.CH1.toString(), 1);
234+
channelIndexMap.put(CHANNEL.CH2.toString(), 2);
235+
channelIndexMap.put(CHANNEL.CH3.toString(), 3);
236+
channelIndexMap.put(CHANNEL.MIC.toString(), 4);
237237

238238
realm = LocalDataLog.with().getRealm();
239239
gpsLogger = new GPSLogger(this,
@@ -967,15 +967,15 @@ protected Void doInBackground(String... channels) {
967967
ArrayList<String[]> yDataString = new ArrayList<>();
968968
String[] xDataString = null;
969969
maxAmp = 0;
970+
scienceLab.captureTraces(4, samples, timeGap, channel, isTriggerSelected, null);
971+
Thread.sleep((long)(samples*timeGap*1e-3));
970972
for (int i = 0; i < noOfChannels; i++) {
971973
entries.add(new ArrayList<>());
972974
channel = channels[i];
973975
HashMap<String, double[]> data;
974976
if (triggerChannel.equals(channel))
975977
scienceLab.configureTrigger(channelIndexMap.get(channel), channel, trigger, null, null);
976-
scienceLab.captureTraces(1, samples, timeGap, channel, isTriggerSelected, null);
977-
data = scienceLab.fetchTrace(1);
978-
Thread.sleep((long) (1000 * 10 * 1e-3));
978+
data = scienceLab.fetchTrace(channelIndexMap.get(channel));
979979
xData = data.get("x");
980980
yData = data.get("y");
981981
int n = Math.min(xData.length, yData.length);

0 commit comments

Comments
 (0)