public static boolean isSlopeFlatEnough(BgReading bgReading) { return isSlopeFlatEnough(bgReading, 1); }
public static boolean isSlopeFlatEnough(BgReading bgReading) { return isSlopeFlatEnough(bgReading, 1); }
public static boolean isSlopeFlatEnough(BgReading bgReading) { return isSlopeFlatEnough(bgReading, 1); }
public static boolean isSlopeFlatEnough() { BgReading bgReading = BgReading.last(true); if (bgReading == null) return false; if (JoH.msSince(bgReading.timestamp) > Home.stale_data_millis()) { UserError.Log.d(TAG, "Slope cannot be flat enough as data is stale"); return false; } // TODO check if stale, check previous slope also, check that reading parameters also return isSlopeFlatEnough(bgReading); }
public static boolean isSlopeFlatEnough() { BgReading bgReading = BgReading.last(true); if (bgReading == null) return false; if (JoH.msSince(bgReading.timestamp) > Home.stale_data_millis()) { UserError.Log.d(TAG, "Slope cannot be flat enough as data is stale"); return false; } // TODO check if stale, check previous slope also, check that reading parameters also return isSlopeFlatEnough(bgReading); }
public static boolean isSlopeFlatEnough() { BgReading bgReading = BgReading.last(true); if (bgReading == null) return false; if (JoH.msSince(bgReading.timestamp) > Home.stale_data_millis()) { UserError.Log.d(TAG, "Slope cannot be flat enough as data is stale"); return false; } // TODO check if stale, check previous slope also, check that reading parameters also return isSlopeFlatEnough(bgReading); }
public static boolean shouldRequestCalibration(BgReading bgReading) { CalibrationRequest calibrationRequest = new Select() .from(CalibrationRequest.class) .where("requestIfAbove < ?", bgReading.calculated_value) .where("requestIfBelow > ?", bgReading.calculated_value) .executeSingle(); return (calibrationRequest != null && isSlopeFlatEnough(bgReading, 1)); }
public static boolean shouldRequestCalibration(BgReading bgReading) { CalibrationRequest calibrationRequest = new Select() .from(CalibrationRequest.class) .where("requestIfAbove < ?", bgReading.calculated_value) .where("requestIfBelow > ?", bgReading.calculated_value) .executeSingle(); return (calibrationRequest != null && isSlopeFlatEnough(bgReading, 1)); }
public static boolean shouldRequestCalibration(BgReading bgReading) { CalibrationRequest calibrationRequest = new Select() .from(CalibrationRequest.class) .where("requestIfAbove < ?", bgReading.calculated_value) .where("requestIfBelow > ?", bgReading.calculated_value) .executeSingle(); return (calibrationRequest != null && isSlopeFlatEnough(bgReading, 1)); }
@Override public void run() { Home.staticRefreshBGCharts(); // requires offset in past if ((Pref.getBooleanDefaultFalse("bluetooth_meter_for_calibrations_auto") && isSlopeFlatEnough())) { Log.d(TAG, "Slope flat enough for auto calibration"); if (!delay_calibration) { Home.startHomeWithExtra(xdrip.getAppContext(), Home.BLUETOOTH_METER_CALIBRATION, BgGraphBuilder.unitized_string_static(lastBloodTest.mgdl), Long.toString(time_since), "auto"); } else { Log.d(TAG, "Delaying calibration for later"); JoH.static_toast_long("Waiting for 15 minutes more sensor data for calibration"); } } else { if (Pref.getBooleanDefaultFalse("bluetooth_meter_for_calibrations")) { // manual calibration Home.startHomeWithExtra(xdrip.getAppContext(), Home.BLUETOOTH_METER_CALIBRATION, BgGraphBuilder.unitized_string_static(lastBloodTest.mgdl), Long.toString(time_since), "manual"); } else { Log.d(TAG, "Not flat enough slope for auto calibration and manual calibration not enabled"); } } } }, 500);
@Override public void run() { Home.staticRefreshBGCharts(); // requires offset in past if ((Pref.getBooleanDefaultFalse("bluetooth_meter_for_calibrations_auto") && isSlopeFlatEnough())) { Log.d(TAG, "Slope flat enough for auto calibration"); if (!delay_calibration) { Home.startHomeWithExtra(xdrip.getAppContext(), Home.BLUETOOTH_METER_CALIBRATION, BgGraphBuilder.unitized_string_static(lastBloodTest.mgdl), Long.toString(time_since), "auto"); } else { Log.d(TAG, "Delaying calibration for later"); JoH.static_toast_long("Waiting for 15 minutes more sensor data for calibration"); } } else { if (Pref.getBooleanDefaultFalse("bluetooth_meter_for_calibrations")) { // manual calibration Home.startHomeWithExtra(xdrip.getAppContext(), Home.BLUETOOTH_METER_CALIBRATION, BgGraphBuilder.unitized_string_static(lastBloodTest.mgdl), Long.toString(time_since), "manual"); } else { Log.d(TAG, "Not flat enough slope for auto calibration and manual calibration not enabled"); } } } }, 500);
&& (CalibrationRequest.isSlopeFlatEnough(BgReading.last(true)))) { Log.d("NOTIFICATIONS", "Calibration difference in hours: " + ((new Date().getTime() - calibrations.get(0).timestamp)) / (1000 * 60 * 60)); if ((!PowerStateReceiver.is_power_connected()) || (Pref.getBooleanDefaultFalse("calibration_alerts_while_charging"))) {
if (!CalibrationRequest.isSlopeFlatEnough(bgReading)) { Log.d(TAG, "opportunistic: Slope is not flat enough at: " + JoH.dateTimeText(bgReading.timestamp)); return;
if (!CalibrationRequest.isSlopeFlatEnough(bgReading)) { Log.d(TAG, "opportunistic: Slope is not flat enough at: " + JoH.dateTimeText(bgReading.timestamp)); return;
&& (CalibrationRequest.isSlopeFlatEnough(BgReading.last(true)))) { Log.d("NOTIFICATIONS", "Calibration difference in hours: " + ((new Date().getTime() - calibrations.get(0).timestamp)) / (1000 * 60 * 60)); if ((!PowerStateReceiver.is_power_connected()) || (Pref.getBooleanDefaultFalse("calibration_alerts_while_charging"))) {
&& (CalibrationRequest.isSlopeFlatEnough(BgReading.last(true)))) { Log.d("NOTIFICATIONS", "Calibration difference in hours: " + ((new Date().getTime() - calibrations.get(0).timestamp)) / (1000 * 60 * 60)); if ((!PowerStateReceiver.is_power_connected()) || (Pref.getBooleanDefaultFalse("calibration_alerts_while_charging"))) {