Minor cleanups around the Command queue.

This commit is contained in:
Johannes Mockenhaupt 2017-12-06 17:11:34 +01:00
parent 86b63cb27d
commit b0d55b09d4
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1
2 changed files with 7 additions and 7 deletions

View file

@ -80,7 +80,7 @@ public class CommandQueue {
return new PumpEnactResult().success(false).enacted(false).comment(MainApp.sResources.getString(R.string.executingrightnow));
}
public boolean isRunning(Command.CommandType type) {
private boolean isRunning(Command.CommandType type) {
if (performing != null && performing.commandType == type)
return true;
return false;
@ -161,10 +161,11 @@ public class CommandQueue {
// Notify Wear about upcoming bolus
MainApp.bus().post(new EventBolusRequested(detailedBolusInfo.insulin));
// Bring up bolus progress dialog
// Apply constraints
detailedBolusInfo.insulin = MainApp.getConfigBuilder().applyBolusConstraints(detailedBolusInfo.insulin);
detailedBolusInfo.carbs = MainApp.getConfigBuilder().applyCarbsConstraints((int) detailedBolusInfo.carbs);
// Bring up bolus progress dialog
BolusProgressDialog bolusProgressDialog = null;
if (detailedBolusInfo.context != null) {
bolusProgressDialog = new BolusProgressDialog();
@ -294,8 +295,8 @@ public class CommandQueue {
Profile.BasalValue[] basalValues = profile.getBasalValues();
PumpInterface pump = ConfigBuilderPlugin.getActivePump();
for (int index = 0; index < basalValues.length; index++) {
if (basalValues[index].value < pump.getPumpDescription().basalMinimumRate) {
for (Profile.BasalValue basalValue : basalValues) {
if (basalValue.value < pump.getPumpDescription().basalMinimumRate) {
Notification notification = new Notification(Notification.BASAL_VALUE_BELOW_MINIMUM, MainApp.sResources.getString(R.string.basalvaluebelowminimum), Notification.URGENT);
MainApp.bus().post(new EventNewNotification(notification));
if (callback != null)

View file

@ -26,9 +26,8 @@ import info.nightscout.utils.SP;
public class QueueThread extends Thread {
private static Logger log = LoggerFactory.getLogger(QueueThread.class);
CommandQueue queue;
private CommandQueue queue;
private long connectionStartTime = 0;
private boolean connectLogged = false;
private PowerManager.WakeLock mWakeLock;
@ -45,7 +44,7 @@ public class QueueThread extends Thread {
public final void run() {
mWakeLock.acquire();
MainApp.bus().post(new EventQueueChanged());
connectionStartTime = System.currentTimeMillis();
long connectionStartTime = System.currentTimeMillis();
try {
while (true) {