Re-add warning if pump time is off (needed for basal rates).

This commit is contained in:
Johannes Mockenhaupt 2017-12-08 11:56:04 +01:00
parent e286b9e3c2
commit d2f2266a2b
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1
2 changed files with 11 additions and 1 deletions

View file

@ -46,7 +46,6 @@ import info.nightscout.androidaps.plugins.Overview.events.EventOverviewBolusProg
import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.androidaps.plugins.PumpCombo.events.EventComboPumpUpdateGUI;
import info.nightscout.utils.DateUtil;
import info.nightscout.utils.SP;
import static de.jotomo.ruffy.spi.BolusProgressReporter.State.FINISHED;
@ -703,10 +702,20 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
}
checkAndResolveTbrMismatch(preCheckResult.state);
checkPumpTime(preCheckResult.state);
return null;
}
/** check pump time (main menu) and raise notification if clock is off by more than 2m
* (setting clock is not supported by ruffy) */
private void checkPumpTime(PumpState state) {
if (state.timestamp != 0 && Math.abs(state.timestamp - System.currentTimeMillis()) > 2 * 60 * 1000) {
Notification notification = new Notification(Notification.COMBO_PUMP_ALARM, MainApp.sResources.getString(R.string.combo_notification_check_time_date), Notification.NORMAL);
MainApp.bus().post(new EventNewNotification(notification));
}
}
private void notifyAboutPumpWarning(WarningOrErrorCode activeAlert) {
if (activeAlert.warningCode == null ||
(!activeAlert.warningCode.equals(PumpWarningCodes.CARTRIDGE_LOW)

View file

@ -830,6 +830,7 @@
<string name="combo_reservoir_low">Low</string>
<string name="combo_reservoir_empty">Empty</string>
<string name="combo_reservoir_normal">Normal</string>
<string name="combo_notification_check_time_date">Pump time is invalid, please update it on the pump</string>
<string name="combo_notification_check_time_date">Pump clock update needed</string>
<string name="combo_history">History</string>
<string name="combo_warning">Warning</string>