Skip to content
Snippets Groups Projects
Commit a264bacb authored by Pogman's avatar Pogman
Browse files

Merge branch 'develop_pazaan_fixes' of...

Merge branch 'develop_pazaan_fixes' of https://github.com/Pogman/640gAndroidUploader into develop_pazaan_fixes
parents a58dea4a ba5b8478
No related branches found
No related tags found
No related merge requests found
......@@ -750,19 +750,18 @@ public class MainActivity extends AppCompatActivity implements OnSharedPreferenc
// Get the most recently written CGM record for the active pump.
PumpStatusEvent pumpStatusData = null;
PumpInfo pump = getActivePump();
// ignoring activePump atm
//PumpInfo pump = getActivePump();
if (pump != null && pump.isValid() && pump.getPumpHistory().size() > 0) {
pumpStatusData = pump.getPumpHistory().last();
if (dataStore.getLastPumpStatus().getEventDate().getTime() > 0) {
pumpStatusData = dataStore.getLastPumpStatus();
}
// FIXME - grab the last item from the activePump's getPumpHistory
updateChart(mRealm.where(PumpStatusEvent.class)
.greaterThan("eventDate", new Date(System.currentTimeMillis() - 1000*60*60*24))
.findAllSorted("eventDate", Sort.ASCENDING));
if (pumpStatusData != null) {
String sgvString;
if (configurationStore.isMmolxl()) {
float fBgValue = (float) pumpStatusData.getSgv();
......
......@@ -111,7 +111,6 @@ public class MedtronicCnlIntentService extends IntentService {
short pumpBatteryLevel = dataStore.getLastPumpStatus().getBatteryPercentage();
if (timeLastGoodSGV != 0) {
timePollExpected = timeLastGoodSGV + POLL_PERIOD_MS + POLL_GRACE_PERIOD_MS + (POLL_PERIOD_MS * ((timePollStarted - 1000L - (timeLastGoodSGV + POLL_GRACE_PERIOD_MS)) / POLL_PERIOD_MS));
}
......
package info.nightscout.android.utils;
import com.bugfender.sdk.a.a.k.a;
import java.util.Date;
import info.nightscout.android.model.medtronicNg.PumpStatusEvent;
import io.realm.Realm;
/**
* Created by volker on 30.03.2017.
......@@ -27,7 +30,8 @@ public class DataStore {
PumpStatusEvent dummyStatus = new PumpStatusEvent();
dummyStatus.setEventDate(new Date(0));
instance.setLastPumpStatus(dummyStatus);
// bypass setter to avoid dealing with a real Realm object
instance.lastPumpStatus = dummyStatus;
}
return instance;
......@@ -38,7 +42,7 @@ public class DataStore {
}
public void setLastPumpStatus(PumpStatusEvent lastPumpStatus) {
this.lastPumpStatus = lastPumpStatus;
this.lastPumpStatus = Realm.getDefaultInstance().copyFromRealm(lastPumpStatus);
}
public int getUplooaderBatteryLevel() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment