postpone EventAutosensCalculationFinished
This commit is contained in:
parent
ab70d5b67d
commit
b52c1f3aa6
|
@ -2,6 +2,7 @@ package info.nightscout.androidaps.plugins.IobCobCalculator;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
|
import android.os.SystemClock;
|
||||||
import android.support.v4.util.LongSparseArray;
|
import android.support.v4.util.LongSparseArray;
|
||||||
|
|
||||||
import com.crashlytics.android.answers.CustomEvent;
|
import com.crashlytics.android.answers.CustomEvent;
|
||||||
|
@ -69,6 +70,7 @@ public class IobCobOref1Thread extends Thread {
|
||||||
public final void run() {
|
public final void run() {
|
||||||
mWakeLock.acquire();
|
mWakeLock.acquire();
|
||||||
try {
|
try {
|
||||||
|
log.debug("AUTOSENSDATA thread started: " + from);
|
||||||
if (MainApp.getConfigBuilder() == null) {
|
if (MainApp.getConfigBuilder() == null) {
|
||||||
log.debug("Aborting calculation thread (ConfigBuilder not ready): " + from);
|
log.debug("Aborting calculation thread (ConfigBuilder not ready): " + from);
|
||||||
return; // app still initializing
|
return; // app still initializing
|
||||||
|
@ -346,11 +348,14 @@ public class IobCobOref1Thread extends Thread {
|
||||||
log.debug(autosensData.toString());
|
log.debug(autosensData.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
new Thread(() -> {
|
||||||
|
SystemClock.sleep(1000);
|
||||||
MainApp.bus().post(new EventAutosensCalculationFinished(cause));
|
MainApp.bus().post(new EventAutosensCalculationFinished(cause));
|
||||||
log.debug("Finishing calculation thread: " + from);
|
}).start();
|
||||||
} finally {
|
} finally {
|
||||||
mWakeLock.release();
|
mWakeLock.release();
|
||||||
MainApp.bus().post(new EventIobCalculationProgress(""));
|
MainApp.bus().post(new EventIobCalculationProgress(""));
|
||||||
|
log.debug("AUTOSENSDATA thread ended: " + from);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ package info.nightscout.androidaps.plugins.IobCobCalculator;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
|
import android.os.SystemClock;
|
||||||
import android.support.v4.util.LongSparseArray;
|
import android.support.v4.util.LongSparseArray;
|
||||||
|
|
||||||
import com.crashlytics.android.answers.CustomEvent;
|
import com.crashlytics.android.answers.CustomEvent;
|
||||||
|
@ -68,6 +69,7 @@ public class IobCobThread extends Thread {
|
||||||
public final void run() {
|
public final void run() {
|
||||||
mWakeLock.acquire();
|
mWakeLock.acquire();
|
||||||
try {
|
try {
|
||||||
|
log.debug("AUTOSENSDATA thread started: " + from);
|
||||||
if (MainApp.getConfigBuilder() == null) {
|
if (MainApp.getConfigBuilder() == null) {
|
||||||
log.debug("Aborting calculation thread (ConfigBuilder not ready): " + from);
|
log.debug("Aborting calculation thread (ConfigBuilder not ready): " + from);
|
||||||
return; // app still initializing
|
return; // app still initializing
|
||||||
|
@ -273,11 +275,14 @@ public class IobCobThread extends Thread {
|
||||||
log.debug(autosensData.toString());
|
log.debug(autosensData.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
new Thread(() -> {
|
||||||
|
SystemClock.sleep(1000);
|
||||||
MainApp.bus().post(new EventAutosensCalculationFinished(cause));
|
MainApp.bus().post(new EventAutosensCalculationFinished(cause));
|
||||||
log.debug("Finishing calculation thread: " + from);
|
}).start();
|
||||||
} finally {
|
} finally {
|
||||||
mWakeLock.release();
|
mWakeLock.release();
|
||||||
MainApp.bus().post(new EventIobCalculationProgress(""));
|
MainApp.bus().post(new EventIobCalculationProgress(""));
|
||||||
|
log.debug("AUTOSENSDATA thread ended: " + from);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue