another cob fix

This commit is contained in:
Milos Kozak 2018-01-01 14:38:37 +01:00
parent d27d1b1821
commit d2753e0dad
5 changed files with 6 additions and 6 deletions

View file

@ -80,7 +80,7 @@ public class QuickWizardEntry {
// COB
double cob = 0d;
AutosensData autosensData = IobCobCalculatorPlugin.getAutosensData(System.currentTimeMillis());
AutosensData autosensData = IobCobCalculatorPlugin.getLastAutosensData();
if (autosensData != null && useCOB() == YES) {
cob = autosensData.cob;
}

View file

@ -560,7 +560,7 @@ public class IobCobCalculatorPlugin implements PluginBase {
if (autosensDataTable.size() < 1)
return null;
AutosensData data = autosensDataTable.valueAt(autosensDataTable.size() - 1);
if (data.time < System.currentTimeMillis() - 5 * 60 * 1000) {
if (data.time < System.currentTimeMillis() - 11 * 60 * 1000) {
return null;
} else {
return data;

View file

@ -458,9 +458,9 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
// COB
Double c_cob = 0d;
if (cobCheckbox.isChecked()) {
AutosensData autosensData = IobCobCalculatorPlugin.getAutosensData(System.currentTimeMillis());
AutosensData autosensData = IobCobCalculatorPlugin.getLastAutosensData();
if(autosensData != null && autosensData.time > System.currentTimeMillis() - 11 * 60 * 1000L) {
if(autosensData != null) {
c_cob = autosensData.cob;
}
}

View file

@ -1198,7 +1198,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
// cob
if (cobView != null) { // view must not exists
String cobText = "";
AutosensData autosensData = IobCobCalculatorPlugin.getAutosensData(System.currentTimeMillis());
AutosensData autosensData = IobCobCalculatorPlugin.getLastAutosensData();
if (autosensData != null)
cobText = (int) autosensData.cob + " g";
cobView.setText(cobText);

View file

@ -654,7 +654,7 @@ public class WatchUpdaterService extends WearableListenerService implements
private String generateCOBString() {
String cobStringResult = "--";
AutosensData autosensData = IobCobCalculatorPlugin.getAutosensData(System.currentTimeMillis());
AutosensData autosensData = IobCobCalculatorPlugin.getLastAutosensData();
if (autosensData != null) {
cobStringResult = (int) autosensData.cob + "g";
}