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

Raw-related Calibration logs shown only when raw is available #3646

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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 @@ -41,6 +41,7 @@

import static com.eveningoutpost.dexdrip.models.BgReading.isDataSuitableForDoubleCalibration;
import static com.eveningoutpost.dexdrip.calibrations.PluggableCalibration.newFingerStickData;
import static com.eveningoutpost.dexdrip.utils.DexCollectionType.getDexCollectionType;


class DexParameters extends SlopeParameters {
Expand Down Expand Up @@ -639,7 +640,7 @@ public static Calibration create(double bg, long timeoffset, Context context, bo
} else {
Log.d(TAG, "Follower mode or note so not processing calibration deeply");
}
} else {
} else if (SensorSanity.isRawCapable(getDexCollectionType())) { // Only if the sensor can provide raw values
final String msg = "Sensor data fails sanity test - Cannot Calibrate! raw:" + bgReading.raw_data;
UserError.Log.e(TAG, msg);
JoH.static_toast_long(msg);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.eveningoutpost.dexdrip.models;

import static com.eveningoutpost.dexdrip.utils.DexCollectionType.getDexCollectionType;

import com.eveningoutpost.dexdrip.Home;
import com.eveningoutpost.dexdrip.models.UserError.Log;
import com.eveningoutpost.dexdrip.utilitymodels.PersistentStore;
Expand All @@ -25,12 +27,16 @@ public class SensorSanity {

private static final String TAG = "SensorSanity";

public static boolean isRawCapable(DexCollectionType type) { // This is true only if the sensor can provide raw values
return (DexCollectionType.hasDexcomRaw(type) || DexCollectionType.hasLibre(type) || type == DexCollectionType.Medtrum);
}

public static boolean isRawValueSane(double raw_value) {
return isRawValueSane(raw_value, DexCollectionType.getDexCollectionType(), false);
return isRawValueSane(raw_value, getDexCollectionType(), false);
}

public static boolean isRawValueSane(double raw_value, boolean hard) {
return isRawValueSane(raw_value, DexCollectionType.getDexCollectionType(), hard);
return isRawValueSane(raw_value, getDexCollectionType(), hard);
}

public static boolean isRawValueSane(double raw_value, DexCollectionType type) {
Expand Down Expand Up @@ -71,7 +77,7 @@ public static boolean isRawValueSane(double raw_value, DexCollectionType type, b
else if (raw_value > DEXCOM_MAX_RAW) state = false;
}

if (!state) {
if (!state && isRawCapable(type)) {
if (JoH.ratelimit("sanity-failure", 20)) {
final String msg = "Sensor Raw Data Sanity Failure: " + raw_value;
UserError.Log.e(TAG, msg);
Expand Down
Loading