Merge pull request #18 from jotomo/combo-scripter-v2

jan 16
This commit is contained in:
Simon Pauwels 2018-01-16 15:02:43 +01:00 committed by GitHub
commit 3c6a456ed4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 128 additions and 107 deletions

View file

@ -15,4 +15,7 @@ android:
script: script:
# Unit Test # Unit Test
- ./gradlew test - ./gradlew test jacocoTestReport
after_success:
- bash <(curl -s https://codecov.io/bash)

View file

@ -11,7 +11,10 @@ Hardware requirements:
Software to configure the pump. Software to configure the pump.
Roche sends out Smartpix devices and the configuration software Roche sends out Smartpix devices and the configuration software
free of charge to their customers upon request. free of charge to their customers upon request.
- A compatible phone: An Android phone with a phone running LineageOS 14.1 (formerly CyanogenMod) or Android 8.1 (Oreo) - A compatible phone: An Android phone with a phone running LineageOS 14.1 (formerly CyanogenMod) or Android 8.1 (Oreo).
For advanced users, it is possible to perform the pairing on a rooted phone and transfer it to another rooted
phone to use with ruffy/AAPS, which must also be rooted. This allows using phones with Android < 8.1 but
has not been widely tested: https://github.com/gregorybel/combo-pairing/blob/master/README.md
- To build AndroidAPS with Combo support you need the latest Android Studio 3 version - To build AndroidAPS with Combo support you need the latest Android Studio 3 version
Limitations: Limitations:
@ -57,15 +60,17 @@ Setup:
- Enable keylock (can also be set on the pump directly, see usage section on reasoning) - Enable keylock (can also be set on the pump directly, see usage section on reasoning)
- Get Android Studio 3 https://developer.android.com/studio/index.html - Get Android Studio 3 https://developer.android.com/studio/index.html
- Follow the link http://ruffy.AndroidAPS.org and clone via git (branch `combo-scripter-v2`) - Follow the link http://ruffy.AndroidAPS.org and clone via git (branch `combo-scripter-v2`)
- Pair the pump using ruffy, if it doesn't work after multiple attempts, switch to the `pairing` branch, pair, - Pair the pump using ruffy. If it doesn't work after multiple attempts, switch to the `pairing` branch,
then switch back the original branch. If the pump is already paired and pair the pump and then switch back the original branch.
can be controlled via ruffy, installing the above version is sufficient. If the pump is already paired and can be controlled via ruffy, installing the
`combo-scripter-v2` branch is sufficient.
If AAPS is already installed, switch to the MDI plugin to avoid the Combo If AAPS is already installed, switch to the MDI plugin to avoid the Combo
plugin from interfering with ruffy during the pairing process. plugin from interfering with ruffy during the pairing process.
Note that the pairing processing is somewhat fragile (but only has to be done once) Note that the pairing processing is somewhat fragile (but only has to be done once)
and may need a few attempts; and may need a few attempts; quickly acknowledge prompts and when starting over, remove the pump device
quickly acknowledge prompts and when starting over, remove the pump device from the bluetooth settings beforehand. Another option to try is to go to the bluetooth menu after
from the bluetooth settings beforehand. initiating the pairing process (this keeps the phone's bluetooth discoverable as long as the menu is displayed)
and switch back to ruffy after confirming the pairing on the pump, when the pump displays the authorization code.
When AAPS is using ruffy, the ruffy app can't be used. The easiest way is to just When AAPS is using ruffy, the ruffy app can't be used. The easiest way is to just
reboot the phone after the pairing process and let AAPS start ruffy in the background. reboot the phone after the pairing process and let AAPS start ruffy in the background.
- Clone AndroidAPS from https://github.com/jotomo/AndroidAPS (branch `combo-scripter-v2`) - Clone AndroidAPS from https://github.com/jotomo/AndroidAPS (branch `combo-scripter-v2`)

View file

@ -5,3 +5,5 @@
[![Gitter](https://badges.gitter.im/MilosKozak/AndroidAPS.svg)](https://gitter.im/MilosKozak/AndroidAPS?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Gitter](https://badges.gitter.im/MilosKozak/AndroidAPS.svg)](https://gitter.im/MilosKozak/AndroidAPS?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Build status](https://travis-ci.org/MilosKozak/AndroidAPS.svg?branch=master)](https://travis-ci.org/MilosKozak/AndroidAPS) [![Build status](https://travis-ci.org/MilosKozak/AndroidAPS.svg?branch=master)](https://travis-ci.org/MilosKozak/AndroidAPS)
[![codecov](https://codecov.io/gh/MilosKozak/AndroidAPS/branch/master/graph/badge.svg)](https://codecov.io/gh/MilosKozak/AndroidAPS)
dev: [![codecov](https://codecov.io/gh/MilosKozak/AndroidAPS/branch/dev/graph/badge.svg)](https://codecov.io/gh/MilosKozak/AndroidAPS)

View file

@ -1,14 +1,25 @@
buildscript { buildscript {
repositories { repositories {
maven { url 'https://maven.fabric.io/public' } maven { url 'https://maven.fabric.io/public' }
jcenter()
} }
dependencies { dependencies {
classpath 'io.fabric.tools:gradle:1.+' classpath 'io.fabric.tools:gradle:1.+'
classpath 'com.dicedmelon.gradle:jacoco-android:0.1.2'
} }
} }
apply plugin: 'com.android.application' apply plugin: "com.android.application"
apply plugin: 'io.fabric' apply plugin: "io.fabric"
apply plugin: "jacoco-android"
ext {
supportLibraryVersion = "23.4.0"
ormLiteVersion = "4.46"
powermockVersion = "1.7.3"
dexmakerVersion = "1.2"
}
repositories { repositories {
maven { url 'https://maven.fabric.io/public' } maven { url 'https://maven.fabric.io/public' }
@ -55,12 +66,16 @@ android {
} }
lintOptions { lintOptions {
disable 'MissingTranslation' disable 'MissingTranslation'
disable 'ExtraTranslation'
} }
buildTypes { buildTypes {
release { release {
minifyEnabled false minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
} }
debug {
testCoverageEnabled true
}
} }
productFlavors { productFlavors {
flavorDimensions "standard" flavorDimensions "standard"
@ -147,56 +162,58 @@ allprojects {
dependencies { dependencies {
wearApp project(':wear') wearApp project(':wear')
compile fileTree(include: ['*.jar'], dir: 'libs')
compile('com.crashlytics.sdk.android:crashlytics:2.6.7@aar') {
transitive = true;
}
compile('com.crashlytics.sdk.android:answers:1.3.12@aar') {
transitive = true;
}
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.android.support:gridlayout-v7:23.4.0'
compile "com.android.support:design:23.4.0"
compile "com.android.support:percent:23.4.0"
compile 'com.wdullaer:materialdatetimepicker:2.3.0'
compile 'com.squareup:otto:1.3.7'
compile 'com.j256.ormlite:ormlite-core:4.46'
compile 'com.j256.ormlite:ormlite-android:4.46'
compile('com.github.tony19:logback-android-classic:1.1.1-6') {
exclude group: 'com.google.android', module: 'android'
}
compile 'org.apache.commons:commons-lang3:3.6'
compile 'org.slf4j:slf4j-api:1.7.12'
compile 'com.jjoe64:graphview:4.0.1'
compile 'com.joanzapata.iconify:android-iconify-fontawesome:2.1.1'
compile 'com.google.android.gms:play-services-wearable:7.5.0'
compile 'junit:junit:4.12'
testCompile 'org.json:json:20140107'
testCompile 'org.mockito:mockito-core:2.7.22'
testCompile 'org.powermock:powermock-api-mockito2:1.7.3'
testCompile 'org.powermock:powermock-module-junit4-rule-agent:1.7.3'
testCompile 'org.powermock:powermock-module-junit4-rule:1.7.3'
testCompile 'org.powermock:powermock-module-junit4:1.7.3'
androidTestCompile 'org.mockito:mockito-core:2.7.22'
androidTestCompile 'com.google.dexmaker:dexmaker:1.2'
androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.2'
compile(name: 'android-edittext-validator-v1.3.4-mod', ext: 'aar')
compile('com.google.android:flexbox:0.3.0') {
exclude group: 'com.android.support'
}
compile('io.socket:socket.io-client:0.8.3') {
// excluding org.json which is provided by Android
exclude group: 'org.json', module: 'json'
}
compile 'com.google.code.gson:gson:2.7'
compile 'com.google.guava:guava:20.0'
compile project(path: ':ruffyscripter') compile project(path: ':ruffyscripter')
compile 'net.danlew:android.joda:2.9.9.1' compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'joda-time:joda-time:2.9.4.2' compile("com.crashlytics.sdk.android:crashlytics:2.6.7@aar") {
transitive = true;
}
compile("com.crashlytics.sdk.android:answers:1.3.12@aar") {
transitive = true;
}
compile "com.android.support:appcompat-v7:${supportLibraryVersion}"
compile "com.android.support:support-v4:${supportLibraryVersion}"
compile "com.android.support:cardview-v7:${supportLibraryVersion}"
compile "com.android.support:recyclerview-v7:${supportLibraryVersion}"
compile "com.android.support:gridlayout-v7:${supportLibraryVersion}"
compile "com.android.support:design:${supportLibraryVersion}"
compile "com.android.support:percent:${supportLibraryVersion}"
compile "com.wdullaer:materialdatetimepicker:2.3.0"
compile "com.squareup:otto:1.3.7"
compile "com.j256.ormlite:ormlite-core:${ormLiteVersion}"
compile "com.j256.ormlite:ormlite-android:${ormLiteVersion}"
compile("com.github.tony19:logback-android-classic:1.1.1-6") {
exclude group: "com.google.android", module: "android"
}
compile "org.apache.commons:commons-lang3:3.6"
compile "org.slf4j:slf4j-api:1.7.12"
compile "com.jjoe64:graphview:4.0.1"
compile "com.joanzapata.iconify:android-iconify-fontawesome:2.1.1"
compile "com.google.android.gms:play-services-wearable:7.5.0"
compile(name: "android-edittext-validator-v1.3.4-mod", ext: "aar")
compile("com.google.android:flexbox:0.3.0") {
exclude group: "com.android.support"
}
compile("io.socket:socket.io-client:0.8.3") {
// excluding org.json which is provided by Android
exclude group: "org.json", module: "json"
}
compile "com.google.code.gson:gson:2.7"
compile "com.google.guava:guava:20.0"
compile "net.danlew:android.joda:2.9.9.1"
testCompile "junit:junit:4.12"
testCompile "org.json:json:20140107"
testCompile "org.mockito:mockito-core:2.7.22"
testCompile "org.powermock:powermock-api-mockito2:${powermockVersion}"
testCompile "org.powermock:powermock-module-junit4-rule-agent:${powermockVersion}"
testCompile "org.powermock:powermock-module-junit4-rule:${powermockVersion}"
testCompile "org.powermock:powermock-module-junit4:${powermockVersion}"
testCompile "joda-time:joda-time:2.9.4.2"
androidTestCompile "org.mockito:mockito-core:2.7.22"
androidTestCompile "com.google.dexmaker:dexmaker:${dexmakerVersion}"
androidTestCompile "com.google.dexmaker:dexmaker-mockito:${dexmakerVersion}"
} }

View file

@ -631,7 +631,7 @@ public class ConfigBuilderPlugin implements PluginBase, ConstraintsInterface, Tr
@Override @Override
@Nullable @Nullable
public TemporaryBasal getTempBasalFromHistory(long time) { public TemporaryBasal getTempBasalFromHistory(long time) {
return activeTreatments.getTempBasalFromHistory(time); return activeTreatments != null ? activeTreatments.getTempBasalFromHistory(time) : null;
} }
@Override @Override

View file

@ -139,8 +139,8 @@ public class PersistentNotificationPlugin implements PluginBase {
} }
} }
if (MainApp.getConfigBuilder().isTempBasalInProgress()) {
TemporaryBasal activeTemp = MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis()); TemporaryBasal activeTemp = MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis());
if (activeTemp != null) {
line1 += " " + activeTemp.toStringShort(); line1 += " " + activeTemp.toStringShort();
} }

View file

@ -35,8 +35,6 @@ public class ComboFragment extends SubscriberFragment implements View.OnClickLis
private Button alertsButton; private Button alertsButton;
private Button tddsButton; private Button tddsButton;
private Button fullHistoryButton; private Button fullHistoryButton;
private TextView queueView;
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
@ -49,7 +47,6 @@ public class ComboFragment extends SubscriberFragment implements View.OnClickLis
reservoirView = (TextView) view.findViewById(R.id.combo_insulinstate); reservoirView = (TextView) view.findViewById(R.id.combo_insulinstate);
lastConnectionView = (TextView) view.findViewById(R.id.combo_lastconnection); lastConnectionView = (TextView) view.findViewById(R.id.combo_lastconnection);
tempBasalText = (TextView) view.findViewById(R.id.combo_temp_basal); tempBasalText = (TextView) view.findViewById(R.id.combo_temp_basal);
queueView = (TextView) view.findViewById(R.id.combo_queue);
refreshButton = (Button) view.findViewById(R.id.combo_refresh_button); refreshButton = (Button) view.findViewById(R.id.combo_refresh_button);
refreshButton.setOnClickListener(this); refreshButton.setOnClickListener(this);
@ -210,16 +207,6 @@ public class ComboFragment extends SubscriberFragment implements View.OnClickLis
} }
} }
tempBasalText.setText(tbrStr); tempBasalText.setText(tbrStr);
// TODO clean up & i18n or remove
// Queued activities
Spanned status = ConfigBuilderPlugin.getCommandQueue().spannedStatus();
if (status.toString().equals("")) {
queueView.setVisibility(View.GONE);
} else {
queueView.setVisibility(View.VISIBLE);
queueView.setText("Queued activities:\n" + status);
}
} }
}); });
} }

View file

@ -403,8 +403,10 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
@Override @Override
public double getTempBasalRemainingMinutesFromHistory() { public double getTempBasalRemainingMinutesFromHistory() {
if (isTempBasalInProgress()) TemporaryBasal activeTemp = getTempBasalFromHistory(System.currentTimeMillis());
return getTempBasalFromHistory(System.currentTimeMillis()).getPlannedRemainingMinutes(); if (activeTemp != null) {
return activeTemp.getPlannedRemainingMinutes();
}
return 0; return 0;
} }

View file

@ -182,10 +182,9 @@ public class StatuslinePlugin implements PluginBase {
//Temp basal //Temp basal
TreatmentsInterface treatmentsInterface = MainApp.getConfigBuilder(); TreatmentsInterface treatmentsInterface = MainApp.getConfigBuilder();
if (treatmentsInterface.isTempBasalInProgress()) {
TemporaryBasal activeTemp = treatmentsInterface.getTempBasalFromHistory(System.currentTimeMillis()); TemporaryBasal activeTemp = treatmentsInterface.getTempBasalFromHistory(System.currentTimeMillis());
if (activeTemp != null) {
status += activeTemp.toStringShort(); status += activeTemp.toStringShort();
} }
//IOB //IOB

View file

@ -336,14 +336,6 @@
android:layout_marginRight="20dp" android:layout_marginRight="20dp"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:background="@color/listdelimiter" /> android:background="@color/listdelimiter" />
<TextView
android:id="@+id/combo_queue"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text=""
android:textAlignment="center" />
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>

View file

@ -716,9 +716,9 @@
<string name="pump_errors_history">Fehlerprotokol</string> <string name="pump_errors_history">Fehlerprotokol</string>
<string name="combo_pump_state_label">Status</string> <string name="combo_pump_state_label">Status</string>
<string name="combo_pump_state_disconnected">Keine Verbindung zur Pumpe</string> <string name="combo_pump_state_disconnected">Keine Verbindung zur Pumpe</string>
<string name="combo_pump_state_suspended_by_user">Durch Benutzer gestoppt</string> <string name="combo_pump_state_suspended_by_user">Gestoppt (Benutzer)</string>
<string name="combo_pump_state_suspended_due_to_error">Wegen Fehler gestoppt</string> <string name="combo_pump_state_suspended_due_to_error">Gestoppt (Fehler)</string>
<string name="combo_pump_state_running">Normaler Betrieb</string> <string name="combo_pump_state_running">In Betrieb</string>
<string name="combo_tdds">TDDS</string> <string name="combo_tdds">TDDS</string>
<string name="combo_programming_bolus">Bolusabgabe wird vorbereitet</string> <string name="combo_programming_bolus">Bolusabgabe wird vorbereitet</string>
<string name="combo_pump_action_cancelling_tbr">TBR wird abgebrochen</string> <string name="combo_pump_action_cancelling_tbr">TBR wird abgebrochen</string>
@ -760,6 +760,7 @@
<string name="combo_no_tdd_data_note">Um die TDD-Statistik der Pumpe zu lesen, drücken Sie den TDDS Knopf lange.\nWARNUNG: Es gibt einen bekannten Fehler in der Pumpe der dazu führt, dass die Pumpe nach dieser Aktion erst wieder Verbindungen annimmt, wenn auf der Pumpe selbst ein Konpf gedrückt wird. Aus diesem Grund sollte diese Aktion nicht durchgeführt werden.</string> <string name="combo_no_tdd_data_note">Um die TDD-Statistik der Pumpe zu lesen, drücken Sie den TDDS Knopf lange.\nWARNUNG: Es gibt einen bekannten Fehler in der Pumpe der dazu führt, dass die Pumpe nach dieser Aktion erst wieder Verbindungen annimmt, wenn auf der Pumpe selbst ein Konpf gedrückt wird. Aus diesem Grund sollte diese Aktion nicht durchgeführt werden.</string>
<string name="combo_read_full_history_warning">Dies wird den gesamten Speicher und den Status der Pumpe auslesen sowie alle Einträge in „Meine Daten“ und die Basalrate. Boli und TBR werden unter Behandlungen gespeichert, sofern sie nicht bereits vorhanden sind. Dies kann zu doppelten Einträgen führen, wenn die Uhrzeit der Pumpe abweicht. Das Auslesen des Speichers ist normaler Weise für das Loopen unnötig und nur für besondere Umstände vorgesehen. Wenn Du es dennoch tun willst, drücke noch einmal länger den Button. ACHTUNG: Dies kann einen Fehler auslösen, der dazu führt, dass die Pumpe keine Verbindungsversuche mehr akzeptiert. Erst die Betätigung einer Taste an der Pumpe beendet diesen Zustand. Nach Möglichkeit sollte daher das Auslesen vermieden werden.</string> <string name="combo_read_full_history_warning">Dies wird den gesamten Speicher und den Status der Pumpe auslesen sowie alle Einträge in „Meine Daten“ und die Basalrate. Boli und TBR werden unter Behandlungen gespeichert, sofern sie nicht bereits vorhanden sind. Dies kann zu doppelten Einträgen führen, wenn die Uhrzeit der Pumpe abweicht. Das Auslesen des Speichers ist normaler Weise für das Loopen unnötig und nur für besondere Umstände vorgesehen. Wenn Du es dennoch tun willst, drücke noch einmal länger den Button. ACHTUNG: Dies kann einen Fehler auslösen, der dazu führt, dass die Pumpe keine Verbindungsversuche mehr akzeptiert. Erst die Betätigung einer Taste an der Pumpe beendet diesen Zustand. Nach Möglichkeit sollte daher das Auslesen vermieden werden.</string>
<string name="combo_read_full_history_confirmation">Möchtest Du wirklich den gesamten Speicher der Pumpe auslesen und die möglichen Konsequenzen des Vorgangs tragen?</string> <string name="combo_read_full_history_confirmation">Möchtest Du wirklich den gesamten Speicher der Pumpe auslesen und die möglichen Konsequenzen des Vorgangs tragen?</string>
<string name="combo_reservoir_level_insufficient_for_bolus">Nicht mehr genug Insulin im Reservoir für den Bolus</string>
<string name="yes">Ja</string> <string name="yes">Ja</string>
<string name="no">Nein</string> <string name="no">Nein</string>
<string name="overview_editquickwizard_usebg">BZ Berechnung</string> <string name="overview_editquickwizard_usebg">BZ Berechnung</string>

View file

@ -812,8 +812,6 @@
<string name="basalprofilenotaligned">Basal values not aligned to hours</string> <string name="basalprofilenotaligned">Basal values not aligned to hours</string>
<string name="zerovalueinprofile">Zero value in profile</string> <string name="zerovalueinprofile">Zero value in profile</string>
<string name="nolocaleprofilefound">Received profile switch from NS but profile doesn\'t exist localy</string> <string name="nolocaleprofilefound">Received profile switch from NS but profile doesn\'t exist localy</string>
<string name="bolusstopping">Stopping bolus delivery</string>
<string name="bolusstopped">Bolus delivery stopped</string>
<string name="combo_programming_bolus">Programming pump for bolusing</string> <string name="combo_programming_bolus">Programming pump for bolusing</string>
<string name="combo_refresh">Refresh</string> <string name="combo_refresh">Refresh</string>
<string name="combo_tdds">TDDS</string> <string name="combo_tdds">TDDS</string>
@ -831,8 +829,6 @@
<string name="combo_pump_action_setting_tbr">Setting TBR (%d%% / %d min)</string> <string name="combo_pump_action_setting_tbr">Setting TBR (%d%% / %d min)</string>
<string name="combo_pump_action_bolusing">Bolusing (%.1f U)</string> <string name="combo_pump_action_bolusing">Bolusing (%.1f U)</string>
<string name="combo_pump_action_refreshing">Refreshing</string> <string name="combo_pump_action_refreshing">Refreshing</string>
<string name="key_raise_urgent_alarms_as_android_notification" translatable="false">raise_urgent_alarms_as_android_notification</string>
<string name="raise_urgent_alarms_as_android_notification">Use system notifications for alerts</string>
<string name="combo_pump_never_connected">Never</string> <string name="combo_pump_never_connected">Never</string>
<string name="combo_pump_unsupported_operation">Requested operation not supported by pump</string> <string name="combo_pump_unsupported_operation">Requested operation not supported by pump</string>
<string name="combo_low_suspend_forced_notification">Unsafe usage: extended or multiwave boluses are active. Loop mode has been set to low-suspend only 6 hours. Only normal boluses are supported in loop mode</string> <string name="combo_low_suspend_forced_notification">Unsafe usage: extended or multiwave boluses are active. Loop mode has been set to low-suspend only 6 hours. Only normal boluses are supported in loop mode</string>
@ -848,7 +844,6 @@
<string name="combo_is_in_error_state">The pump is showing the error E%d: %s</string> <string name="combo_is_in_error_state">The pump is showing the error E%d: %s</string>
<string name="combo_no_alert_data_note">To read the pump\'s error history, long press the ALERTS button\n\nWARNING: this can trigger a bug which causes the pump to reject all connection attempts and requires pressing a button on the pump to recover and should therefore be avoided.</string> <string name="combo_no_alert_data_note">To read the pump\'s error history, long press the ALERTS button\n\nWARNING: this can trigger a bug which causes the pump to reject all connection attempts and requires pressing a button on the pump to recover and should therefore be avoided.</string>
<string name="combo_no_tdd_data_note">To read the pump\'s TDD history, long press the TDDS button\n\nWARNING: this can trigger a bug which causes the pump to reject all connection attempts and requires pressing a button on the pump to recover and should therefore be avoided.</string> <string name="combo_no_tdd_data_note">To read the pump\'s TDD history, long press the TDDS button\n\nWARNING: this can trigger a bug which causes the pump to reject all connection attempts and requires pressing a button on the pump to recover and should therefore be avoided.</string>
<string name="key_sync_profile_to_pump">sync_profile_to_pump</string>
<string name="combo_tdd_minimum">Minimum: %3.1f U</string> <string name="combo_tdd_minimum">Minimum: %3.1f U</string>
<string name="combo_tdd_average">Average: %3.1f U</string> <string name="combo_tdd_average">Average: %3.1f U</string>
<string name="combo_tdd_maximum">Maximum: %3.1f U</string> <string name="combo_tdd_maximum">Maximum: %3.1f U</string>
@ -865,5 +860,6 @@
<string name="combo_error_partial_bolus_delivered">Only %.2f U of the requested bolus of %.2f U was delivered due to an error. Please check the pump to verify this and take appropriate actions.</string> <string name="combo_error_partial_bolus_delivered">Only %.2f U of the requested bolus of %.2f U was delivered due to an error. Please check the pump to verify this and take appropriate actions.</string>
<string name="combo_error_bolus_verification_failed">Delivering the bolus and verifying the pump\'s history failed, please check the pump and manually create a bolus record using the Careportal tab if a bolus was delivered.</string> <string name="combo_error_bolus_verification_failed">Delivering the bolus and verifying the pump\'s history failed, please check the pump and manually create a bolus record using the Careportal tab if a bolus was delivered.</string>
<string name="combo_error_bolus_recovery_progress">Recovering from connection loss</string> <string name="combo_error_bolus_recovery_progress">Recovering from connection loss</string>
<string name="combo_reservoir_level_insufficient_for_bolus">Not enough insulin for bolus left in reservoir</string>
</resources> </resources>

View file

@ -14,18 +14,21 @@ public class RoundTest {
public void roundToTest() throws Exception { public void roundToTest() throws Exception {
assertEquals( 0.55d, Round.roundTo(0.54d, 0.05d), 0.00000001d ); assertEquals( 0.55d, Round.roundTo(0.54d, 0.05d), 0.00000001d );
assertEquals( 1d, Round.roundTo(1.49d, 1d), 0.00000001d ); assertEquals( 1d, Round.roundTo(1.49d, 1d), 0.00000001d );
assertEquals( 0d, Round.roundTo(0d, 1d), 0.00000001d );
} }
@Test @Test
public void floorToTest() throws Exception { public void floorToTest() throws Exception {
assertEquals( 0.5d, Round.floorTo(0.54d, 0.05d), 0.00000001d ); assertEquals( 0.5d, Round.floorTo(0.54d, 0.05d), 0.00000001d );
assertEquals( 1d, Round.floorTo(1.59d, 1d), 0.00000001d ); assertEquals( 1d, Round.floorTo(1.59d, 1d), 0.00000001d );
assertEquals( 0d, Round.floorTo(0d, 1d), 0.00000001d );
} }
@Test @Test
public void ceilToTest() throws Exception { public void ceilToTest() throws Exception {
assertEquals( 0.6d, Round.ceilTo(0.54d, 0.1d), 0.00000001d ); assertEquals( 0.6d, Round.ceilTo(0.54d, 0.1d), 0.00000001d );
assertEquals( 2d, Round.ceilTo(1.49999d, 1d), 0.00000001d ); assertEquals( 2d, Round.ceilTo(1.49999d, 1d), 0.00000001d );
assertEquals( 0d, Round.ceilTo(0d, 1d), 0.00000001d );
} }
} }

View file

@ -1,5 +1,10 @@
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
ext {
supportLibraryVersion = "23.0.1"
wearableVersion = "2.0.1"
}
def generateGitBuild = { -> def generateGitBuild = { ->
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
@ -60,12 +65,12 @@ allprojects {
dependencies { dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs') compile fileTree(include: ['*.jar'], dir: 'libs')
//compile 'com.ustwo.android:clockwise-wearable:1.0.2' compile files("libs/hellocharts-library-1.5.5.jar")
provided 'com.google.android.wearable:wearable:2.0.1' //compile "com.ustwo.android:clockwise-wearable:1.0.2"
compile 'com.google.android.support:wearable:2.0.1' provided "com.google.android.wearable:wearable:${wearableVersion}"
compile 'com.google.android.gms:play-services-wearable:7.3.0' compile "com.google.android.support:wearable:${wearableVersion}"
compile files('libs/hellocharts-library-1.5.5.jar') compile "com.google.android.gms:play-services-wearable:7.3.0"
compile(name:'ustwo-clockwise-debug', ext:'aar') compile(name:"ustwo-clockwise-debug", ext:"aar")
compile 'com.android.support:support-v4:23.0.1' compile "com.android.support:support-v4:23.0.1"
compile 'me.denley.wearpreferenceactivity:wearpreferenceactivity:0.5.0' compile "me.denley.wearpreferenceactivity:wearpreferenceactivity:0.5.0"
} }

View file

@ -178,7 +178,11 @@ public class Steampunk extends BaseWatchFace {
gridColor = ContextCompat.getColor(getApplicationContext(), R.color.grey_steampunk); gridColor = ContextCompat.getColor(getApplicationContext(), R.color.grey_steampunk);
basalBackgroundColor = ContextCompat.getColor(getApplicationContext(), R.color.basal_dark); basalBackgroundColor = ContextCompat.getColor(getApplicationContext(), R.color.basal_dark);
basalCenterColor = ContextCompat.getColor(getApplicationContext(), R.color.basal_dark); basalCenterColor = ContextCompat.getColor(getApplicationContext(), R.color.basal_dark);
if (Integer.parseInt(sharedPrefs.getString("chart_timeframe", "3")) < 3) {
pointSize = 2;
} else {
pointSize = 1; pointSize = 1;
}
setupCharts(); setupCharts();
} }
@ -237,7 +241,12 @@ public class Steampunk extends BaseWatchFace {
private void changeChartTimeframe() { private void changeChartTimeframe() {
int timeframe = Integer.parseInt(sharedPrefs.getString("chart_timeframe", "3")); int timeframe = Integer.parseInt(sharedPrefs.getString("chart_timeframe", "3"));
timeframe = (timeframe%5) + 1; timeframe = (timeframe%5) + 1;
if (timeframe < 3) {
pointSize = 2;
} else {
pointSize = 1;
}
setupCharts();
sharedPrefs.edit().putString("chart_timeframe", "" + timeframe).commit(); sharedPrefs.edit().putString("chart_timeframe", "" + timeframe).commit();
} }
} }