Skip to content

Commit

Permalink
Merge pull request #59 from nightscout/hotfix/calrecords
Browse files Browse the repository at this point in the history
Hotfix/calrecords
  • Loading branch information
ktind committed Nov 10, 2014
2 parents 70714a2 + 8c99e61 commit 7763114
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/src/main/AndroidManifest.xml
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.nightscout.android"
android:versionCode="14"
android:versionName="0.1.8">
android:versionCode="15"
android:versionName="0.1.9">

<uses-feature android:name="android.hardware.usb.host" />

Expand Down
5 changes: 2 additions & 3 deletions app/src/main/java/com/nightscout/android/dexcom/ReadData.java
Expand Up @@ -157,7 +157,6 @@ private <T> T readDataBasePage(int recordType, int page) {
payload.add(numOfPages);
writeCommand(Constants.READ_DATABASE_PAGES, payload);
byte[] readData = read(2122).getData();
ParsePage(readData, recordType);
return ParsePage(readData, recordType);
}

Expand Down Expand Up @@ -193,10 +192,10 @@ private ReadPacket read(int numOfBytes) {
// Add a 100ms delay for when multiple write/reads are occurring in series
Thread.sleep(100);

// TODO: this debug code to print at most 30 bytes of the read, should be removed after
// TODO: this debug code to print data of the read, should be removed after
// finding the source of the reading issue
String bytes = "";
int readAmount = len > 30 ? 30 : len;
int readAmount = len;
for (int i = 0; i < readAmount; i++) bytes += String.format("%02x", readData[i]) + " ";
Log.d(TAG, "Read data: " + bytes);
////////////////////////////////////////////////////////////////////////////////////////
Expand Down
Expand Up @@ -129,7 +129,13 @@ private void handleActionSync(int numOfPages) {
// TODO: need to check if numOfPages if valid on ReadData side
SensorRecord[] sensorRecords = readData.getRecentSensorRecords(numOfPages);
GlucoseDataSet[] glucoseDataSets = Utils.mergeGlucoseDataRecords(recentRecords, sensorRecords);
CalRecord[] calRecords = readData.getRecentCalRecords();

// FIXME: This is a workaround for the new Dexcom AP which seems to have a new format
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mContext);
CalRecord[] calRecords = new CalRecord[1];
if (prefs.getBoolean("cloud_cal_data", false)) {
calRecords = readData.getRecentCalRecords();
}

long timeSinceLastRecord = readData.getTimeSinceEGVRecord(recentRecords[recentRecords.length - 1]);
// TODO: determine if the logic here is correct. I suspect it assumes the last record was less than 5
Expand Down

0 comments on commit 7763114

Please sign in to comment.