Retry reading/writing basal profile, cleanups, notes.
This commit is contained in:
parent
2d7a8a2e4d
commit
44ccbc06a0
|
@ -1,5 +1,6 @@
|
|||
**This software is part of a DIY solution and is not a product.
|
||||
You alone are responsible for what you do with it**
|
||||
**This software is part of a DIY solution and is not a product, but
|
||||
requires YOU to read, learn and understand the system and how to use it.
|
||||
You alone are responsible for what you do with it.**
|
||||
|
||||
Hardware requirements:
|
||||
- A Roche Accu-Chek Combo (any firmware, they all work)
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
- [ ] Pairing
|
||||
- [ ] Pairing works with `combo-scripter-v2` branch
|
||||
- [ ] Bolusing
|
||||
- [ ] Cancelling bolus at various stages and checking error message (if any) and check
|
||||
no bolus or a partial bolus was delivered
|
||||
|
@ -87,4 +89,6 @@
|
|||
- [ ] Pressing refresh while a low cartridge or low battery alarm is active
|
||||
must confirm the alarm, indicate the new status in the Combo tab and
|
||||
show a notification on the overview screen
|
||||
- [ ] Misc
|
||||
- [ ] Pump state is correctly uploaded to Nightscout
|
||||
|
||||
|
|
|
@ -234,7 +234,7 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
|||
MainApp.bus().post(new EventDismissNotification(Notification.FAILED_UDPATE_PROFILE));
|
||||
return PumpInterface.NOT_NEEDED;
|
||||
}
|
||||
CommandResult setResult = runCommand(MainApp.sResources.getString(R.string.combo_activity_setting_basal_profile), 0,
|
||||
CommandResult setResult = runCommand(MainApp.sResources.getString(R.string.combo_activity_setting_basal_profile), 2,
|
||||
() -> ruffyScripter.setBasalProfile(requestedBasalProfile));
|
||||
if (!setResult.success) {
|
||||
Notification notification = new Notification(Notification.FAILED_UDPATE_PROFILE, MainApp.sResources.getString(R.string.failedupdatebasalprofile), Notification.URGENT);
|
||||
|
@ -242,7 +242,7 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
|||
return PumpInterface.FAILED;
|
||||
}
|
||||
|
||||
CommandResult readResult = runCommand(MainApp.sResources.getString(R.string.combo_activity_setting_basal_profile), 0,
|
||||
CommandResult readResult = runCommand(MainApp.sResources.getString(R.string.combo_activity_setting_basal_profile), 2,
|
||||
ruffyScripter::readBasalProfile);
|
||||
|
||||
pump.basalProfile = readResult.basalProfile;
|
||||
|
@ -284,12 +284,12 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
|||
* 0.05 - if above 1U/h
|
||||
* */
|
||||
|
||||
if(rate < 1){
|
||||
if (rate < 1) {
|
||||
//round to 0.01 granularity;
|
||||
rate = Math.round(rate/0.01)*0.01;
|
||||
rate = Math.round(rate / 0.01) * 0.01;
|
||||
} else {
|
||||
//round to 0.05 granularity;
|
||||
rate = Math.round(rate/0.05)*0.05;
|
||||
rate = Math.round(rate / 0.05) * 0.05;
|
||||
}
|
||||
|
||||
basalProfile.hourlyRates[i] = rate;
|
||||
|
@ -337,7 +337,7 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
|||
}
|
||||
*/
|
||||
|
||||
// read basal profile into cache
|
||||
// read basal profile into cache and update pump profile if needed
|
||||
if (!pump.initialized) {
|
||||
CommandResult readBasalResult = runCommand("Reading basal profile", 2, ruffyScripter::readBasalProfile);
|
||||
if (!readBasalResult.success) {
|
||||
|
|
|
@ -9,10 +9,6 @@ public class BasalProfile {
|
|||
this.hourlyRates = new double[24];
|
||||
}
|
||||
|
||||
public BasalProfile( double[] hourlyRates) {
|
||||
this.hourlyRates = hourlyRates;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
|
@ -20,8 +16,8 @@ public class BasalProfile {
|
|||
|
||||
BasalProfile that = (BasalProfile) o;
|
||||
|
||||
for(int i = 0; i <= 23; i++) {
|
||||
if (Math.abs(hourlyRates[i] - that.hourlyRates[i]) > 0.01) {
|
||||
for(int i = 0; i < 24; i++) {
|
||||
if (Math.abs(hourlyRates[i] - that.hourlyRates[i]) > 0.001) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +32,7 @@ public class BasalProfile {
|
|||
@Override
|
||||
public String toString() {
|
||||
double total = 0d;
|
||||
for(int i = 0; i <= 23; i++) {
|
||||
for(int i = 0; i < 24; i++) {
|
||||
total += hourlyRates[i];
|
||||
}
|
||||
return "BasalProfile{" +
|
||||
|
|
Loading…
Reference in a new issue