Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Logged data not shown for Gas Sensor. #2112

Merged
merged 2 commits into from
Oct 2, 2020
Merged
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -372,9 +372,10 @@ private void writeLogToFile(long timestamp, float ppmValue) {
}

private void visualizeData() {
double ppmValue = 0d;
if (scienceLab.isConnected()) {
double volt = scienceLab.getVoltage("CH1", 1);
double ppmValue = (volt / 3.3) * 1024.0;
ppmValue = (volt / 3.3) * 1024.0;
gasValue.setText(String.format(Locale.getDefault(), "%.2f", ppmValue));
gasSensorMeter.setWithTremble(false);
gasSensorMeter.setSpeedAt((float) ppmValue);
Expand All @@ -383,7 +384,6 @@ private void visualizeData() {
previousTimeElapsed = timeElapsed;
Entry entry = new Entry((float) timeElapsed, (float) ppmValue);
entries.add(entry);
writeLogToFile(System.currentTimeMillis(), (float) ppmValue);
LineDataSet dataSet = new LineDataSet(entries, getString(R.string.gas_sensor_unit));
dataSet.setDrawCircles(false);
dataSet.setDrawValues(false);
Expand All @@ -397,6 +397,7 @@ private void visualizeData() {
mChart.invalidate();
}
}
writeLogToFile(System.currentTimeMillis(), (float) ppmValue);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to cast the double to float? What if the variable is set to float in the first place?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

private void setupInstruments() {
Expand Down