Skip to content
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