Merge remote-tracking branch 'refs/remotes/MilosKozak/dev'
Conflicts: app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/Autosens.java app/src/main/res/values/strings.xml
This commit is contained in:
commit
b0a9d74b49
|
@ -44,7 +44,7 @@ android {
|
|||
minSdkVersion 21
|
||||
targetSdkVersion 23
|
||||
versionCode 1100
|
||||
versionName "1.1c"
|
||||
versionName "1.1d"
|
||||
buildConfigField "String", "BUILDVERSION", generateGitBuild()
|
||||
}
|
||||
lintOptions {
|
||||
|
|
|
@ -197,7 +197,7 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_
|
|||
if (iob_data.basaliob) { basaliob = iob_data.basaliob; }
|
||||
else { basaliob = iob_data.iob - iob_data.bolussnooze; }
|
||||
|
||||
// generate predicted future BGs based on IOB, COB, and current absortpion rate
|
||||
// generate predicted future BGs based on IOB, COB, and current absorption rate
|
||||
|
||||
var COBpredBGs = [];
|
||||
var aCOBpredBGs = [];
|
||||
|
@ -347,6 +347,7 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_
|
|||
// use snoozeBG to more gradually ramp in any counteraction of the user's boluses
|
||||
// multiply by 2 to low-temp faster for increased hypo safety
|
||||
var insulinReq = 2 * Math.min(0, (snoozeBG - target_bg) / sens);
|
||||
insulinReq = round( insulinReq , 2);
|
||||
if (minDelta < 0 && minDelta > expectedDelta) {
|
||||
// if we're barely falling, newinsulinReq should be barely negative
|
||||
rT.reason += ", Snooze BG " + convert_bg(snoozeBG, profile);
|
||||
|
@ -374,9 +375,19 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_
|
|||
}
|
||||
}
|
||||
|
||||
var minutes_running;
|
||||
if (typeof currenttemp.duration == 'undefined' || currenttemp.duration == 0) {
|
||||
minutes_running = 30;
|
||||
} else if (typeof currenttemp.minutesrunning !== 'undefined'){
|
||||
// If the time the current temp is running is not defined, use default request duration of 30 minutes.
|
||||
minutes_running = currenttemp.minutesrunning;
|
||||
} else {
|
||||
minutes_running = 30 - currenttemp.duration;
|
||||
}
|
||||
|
||||
// if there is a low-temp running, and eventualBG would be below min_bg without it, let it run
|
||||
if (round_basal(currenttemp.rate, profile) < round_basal(basal, profile) ) {
|
||||
var lowtempimpact = (currenttemp.rate - basal) * (currenttemp.duration/60) * sens;
|
||||
var lowtempimpact = (currenttemp.rate - basal) * ((30-minutes_running)/60) * sens;
|
||||
var adjEventualBG = eventualBG + lowtempimpact;
|
||||
if ( adjEventualBG < min_bg ) {
|
||||
rT.reason += "letting low temp of " + currenttemp.rate + " run.";
|
||||
|
|
|
@ -96,12 +96,14 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
|
|||
addPreferencesFromResource(R.xml.pref_openapsma);
|
||||
if (MainApp.getSpecificPlugin(OpenAPSAMAPlugin.class).isEnabled(PluginBase.APS))
|
||||
addPreferencesFromResource(R.xml.pref_openapsama);
|
||||
addPreferencesFromResource(R.xml.pref_nightscout);
|
||||
addPreferencesFromResource(R.xml.pref_profile);
|
||||
if (Config.DANAR) {
|
||||
DanaRPlugin danaRPlugin = (DanaRPlugin) MainApp.getSpecificPlugin(DanaRPlugin.class);
|
||||
DanaRKoreanPlugin danaRKoreanPlugin = (DanaRKoreanPlugin) MainApp.getSpecificPlugin(DanaRKoreanPlugin.class);
|
||||
if (danaRPlugin.isEnabled(PluginBase.PUMP) || danaRKoreanPlugin.isEnabled(PluginBase.PUMP)) {
|
||||
addPreferencesFromResource(R.xml.pref_danar);
|
||||
}
|
||||
if (danaRPlugin.isEnabled(PluginBase.PROFILE) || danaRKoreanPlugin.isEnabled(PluginBase.PROFILE)) {
|
||||
addPreferencesFromResource(R.xml.pref_danarprofile);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ import android.content.SharedPreferences;
|
|||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.provider.Telephony;
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
import com.j256.ormlite.dao.Dao;
|
||||
import com.j256.ormlite.stmt.PreparedQuery;
|
||||
|
@ -33,7 +32,6 @@ import info.nightscout.androidaps.db.TempTarget;
|
|||
import info.nightscout.androidaps.db.Treatment;
|
||||
import info.nightscout.androidaps.events.EventNewBG;
|
||||
import info.nightscout.androidaps.events.EventNewBasalProfile;
|
||||
import info.nightscout.androidaps.events.EventTreatmentChange;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
|
@ -53,7 +51,6 @@ import info.nightscout.androidaps.plugins.TempTargetRange.events.EventTempTarget
|
|||
import info.nightscout.androidaps.receivers.DataReceiver;
|
||||
import info.nightscout.client.data.NSProfile;
|
||||
import info.nightscout.client.data.NSSgv;
|
||||
import info.nightscout.utils.ToastUtils;
|
||||
|
||||
|
||||
public class DataService extends IntentService {
|
||||
|
@ -388,7 +385,7 @@ public class DataService extends IntentService {
|
|||
String trstring = bundles.getString("treatment");
|
||||
JSONObject trJson = new JSONObject(trstring);
|
||||
String _id = trJson.getString("_id");
|
||||
removeTreatmentFromDb(_id);
|
||||
MainApp.getDbHelper().delete(_id);
|
||||
handleRemoveTempTargetRecord(trJson);
|
||||
}
|
||||
|
||||
|
@ -398,7 +395,7 @@ public class DataService extends IntentService {
|
|||
for (int i = 0; i < jsonArray.length(); i++) {
|
||||
JSONObject trJson = jsonArray.getJSONObject(i);
|
||||
String _id = trJson.getString("_id");
|
||||
removeTreatmentFromDb(_id);
|
||||
MainApp.getDbHelper().delete(_id);
|
||||
handleRemoveTempTargetRecord(trJson);
|
||||
}
|
||||
}
|
||||
|
@ -468,9 +465,9 @@ public class DataService extends IntentService {
|
|||
if (trJson.has("timeIndex")) {
|
||||
if (Config.logIncommingData)
|
||||
log.debug("ADD: timeIndex found: " + trstring);
|
||||
stored = findByTimeIndex(trJson.getLong("timeIndex"));
|
||||
stored = MainApp.getDbHelper().findTreatmentByTimeIndex(trJson.getLong("timeIndex"));
|
||||
} else {
|
||||
stored = findById(_id);
|
||||
stored = MainApp.getDbHelper().findTreatmentById(_id);
|
||||
}
|
||||
|
||||
if (stored != null) {
|
||||
|
@ -478,10 +475,9 @@ public class DataService extends IntentService {
|
|||
log.debug("ADD: Existing treatment: " + trstring);
|
||||
if (trJson.has("timeIndex")) {
|
||||
stored._id = _id;
|
||||
int updated = MainApp.getDbHelper().getDaoTreatments().update(stored);
|
||||
int updated = MainApp.getDbHelper().update(stored);
|
||||
if (Config.logIncommingData)
|
||||
log.debug("Records updated: " + updated);
|
||||
scheduleTreatmentChange();
|
||||
}
|
||||
} else {
|
||||
if (Config.logIncommingData)
|
||||
|
@ -506,14 +502,9 @@ public class DataService extends IntentService {
|
|||
treatment.mealBolus = false;
|
||||
}
|
||||
treatment.setTimeIndex(treatment.getTimeIndex());
|
||||
try {
|
||||
MainApp.getDbHelper().getDaoTreatments().createOrUpdate(treatment);
|
||||
if (Config.logIncommingData)
|
||||
log.debug("ADD: Stored treatment: " + treatment.log());
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
scheduleTreatmentChange();
|
||||
MainApp.getDbHelper().createOrUpdate(treatment);
|
||||
if (Config.logIncommingData)
|
||||
log.debug("ADD: Stored treatment: " + treatment.log());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -533,15 +524,15 @@ public class DataService extends IntentService {
|
|||
if (trJson.has("timeIndex")) {
|
||||
if (Config.logIncommingData)
|
||||
log.debug("ADD: timeIndex found: " + trstring);
|
||||
stored = findByTimeIndex(trJson.getLong("timeIndex"));
|
||||
stored = MainApp.getDbHelper().findTreatmentByTimeIndex(trJson.getLong("timeIndex"));
|
||||
} else {
|
||||
stored = findById(_id);
|
||||
stored = MainApp.getDbHelper().findTreatmentById(_id);
|
||||
}
|
||||
|
||||
if (stored != null) {
|
||||
if (Config.logIncommingData)
|
||||
log.debug("CHANGE: Removing old: " + trstring);
|
||||
removeTreatmentFromDb(_id);
|
||||
MainApp.getDbHelper().delete(_id);
|
||||
}
|
||||
|
||||
if (Config.logIncommingData)
|
||||
|
@ -567,16 +558,11 @@ public class DataService extends IntentService {
|
|||
treatment.mealBolus = false;
|
||||
}
|
||||
treatment.setTimeIndex(treatment.getTimeIndex());
|
||||
try {
|
||||
Dao.CreateOrUpdateStatus status = MainApp.getDbHelper().getDaoTreatments().createOrUpdate(treatment);
|
||||
if (Config.logIncommingData)
|
||||
log.debug("Records updated: " + status.getNumLinesChanged());
|
||||
if (Config.logIncommingData)
|
||||
log.debug("CHANGE: Stored treatment: " + treatment.log());
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
scheduleTreatmentChange();
|
||||
Dao.CreateOrUpdateStatus status = MainApp.getDbHelper().createOrUpdate(treatment);
|
||||
if (Config.logIncommingData)
|
||||
log.debug("Records updated: " + status.getNumLinesChanged());
|
||||
if (Config.logIncommingData)
|
||||
log.debug("CHANGE: Stored treatment: " + treatment.log());
|
||||
}
|
||||
|
||||
public void handleDanaRHistoryRecords(JSONObject trJson) throws JSONException, SQLException {
|
||||
|
@ -683,75 +669,10 @@ public class DataService extends IntentService {
|
|||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Treatment findById(String _id) {
|
||||
try {
|
||||
Dao<Treatment, Long> daoTreatments = MainApp.getDbHelper().getDaoTreatments();
|
||||
QueryBuilder<Treatment, Long> queryBuilder = daoTreatments.queryBuilder();
|
||||
Where where = queryBuilder.where();
|
||||
where.eq("_id", _id);
|
||||
queryBuilder.limit(10);
|
||||
PreparedQuery<Treatment> preparedQuery = queryBuilder.prepare();
|
||||
List<Treatment> trList = daoTreatments.query(preparedQuery);
|
||||
if (trList.size() != 1) {
|
||||
//log.debug("Treatment findById query size: " + trList.size());
|
||||
return null;
|
||||
} else {
|
||||
//log.debug("Treatment findById found: " + trList.get(0).log());
|
||||
return trList.get(0);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Treatment findByTimeIndex(Long timeIndex) {
|
||||
try {
|
||||
QueryBuilder<Treatment, String> qb = null;
|
||||
Dao<Treatment, Long> daoTreatments = MainApp.getDbHelper().getDaoTreatments();
|
||||
QueryBuilder<Treatment, Long> queryBuilder = daoTreatments.queryBuilder();
|
||||
Where where = queryBuilder.where();
|
||||
where.eq("timeIndex", timeIndex);
|
||||
queryBuilder.limit(10);
|
||||
PreparedQuery<Treatment> preparedQuery = queryBuilder.prepare();
|
||||
List<Treatment> trList = daoTreatments.query(preparedQuery);
|
||||
if (trList.size() != 1) {
|
||||
log.debug("Treatment findByTimeIndex query size: " + trList.size());
|
||||
return null;
|
||||
} else {
|
||||
log.debug("Treatment findByTimeIndex found: " + trList.get(0).log());
|
||||
return trList.get(0);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void removeTreatmentFromDb(String _id) throws SQLException {
|
||||
Treatment stored = findById(_id);
|
||||
if (stored != null) {
|
||||
log.debug("REMOVE: Existing treatment (removing): " + _id);
|
||||
int removed = MainApp.getDbHelper().getDaoTreatments().delete(stored);
|
||||
if (Config.logIncommingData)
|
||||
log.debug("Records removed: " + removed);
|
||||
scheduleTreatmentChange();
|
||||
} else {
|
||||
log.debug("REMOVE: Not stored treatment (ignoring): " + _id);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleNewSMS(Intent intent) {
|
||||
Bundle bundle = intent.getExtras();
|
||||
if (bundle == null) return;
|
||||
MainApp.bus().post(new EventNewSMS(bundle));
|
||||
}
|
||||
|
||||
public void scheduleTreatmentChange() {
|
||||
MainApp.bus().post(new EventTreatmentChange());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -6,8 +6,10 @@ import java.util.List;
|
|||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.db.BgReading;
|
||||
import info.nightscout.androidaps.db.Treatment;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.plugins.OpenAPSAMA.Autosens;
|
||||
import info.nightscout.androidaps.plugins.OpenAPSAMA.AutosensResult;
|
||||
import info.nightscout.androidaps.plugins.OpenAPSAMA.OpenAPSAMAPlugin;
|
||||
import info.nightscout.client.data.NSProfile;
|
||||
|
||||
/**
|
||||
|
@ -32,10 +34,12 @@ public class MealData {
|
|||
if (t > dia_ago && t <= now) {
|
||||
if (treatment.carbs >= 1) {
|
||||
carbs += treatment.carbs;
|
||||
AutosensResult result = Autosens.detectSensitivityandCarbAbsorption(bgReadings, t);
|
||||
double myCarbsAbsorbed = result.carbsAbsorbed;
|
||||
double myMealCOB = Math.max(0, carbs - myCarbsAbsorbed);
|
||||
mealCOB = Math.max(mealCOB, myMealCOB);
|
||||
if (MainApp.getSpecificPlugin(OpenAPSAMAPlugin.class).isEnabled(PluginBase.APS)) {
|
||||
AutosensResult result = Autosens.detectSensitivityandCarbAbsorption(bgReadings, t);
|
||||
double myCarbsAbsorbed = result.carbsAbsorbed;
|
||||
double myMealCOB = Math.max(0, carbs - myCarbsAbsorbed);
|
||||
mealCOB = Math.max(mealCOB, myMealCOB);
|
||||
}
|
||||
}
|
||||
if (treatment.insulin > 0 && treatment.mealBolus) {
|
||||
boluses += treatment.insulin;
|
||||
|
|
|
@ -20,10 +20,15 @@ import java.sql.SQLException;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.data.GlucoseStatus;
|
||||
import info.nightscout.androidaps.events.EventTreatmentChange;
|
||||
|
||||
public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||
private static Logger log = LoggerFactory.getLogger(DatabaseHelper.class);
|
||||
|
@ -37,6 +42,11 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
|
||||
private static final int DATABASE_VERSION = 5;
|
||||
|
||||
private long latestTreatmentChange = 0;
|
||||
|
||||
private static final ScheduledExecutorService worker = Executors.newSingleThreadScheduledExecutor();
|
||||
private static ScheduledFuture<?> scheduledPost = null;
|
||||
|
||||
public DatabaseHelper(Context context) {
|
||||
super(context, DATABASE_NAME, null, DATABASE_VERSION);
|
||||
onCreate(getWritableDatabase(), getConnectionSource());
|
||||
|
@ -117,6 +127,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
TableUtils.createTableIfNotExists(connectionSource, Treatment.class);
|
||||
TableUtils.createTableIfNotExists(connectionSource, BgReading.class);
|
||||
TableUtils.createTableIfNotExists(connectionSource, DanaRHistoryRecord.class);
|
||||
latestTreatmentChange = 0;
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -126,6 +137,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
try {
|
||||
TableUtils.dropTable(connectionSource, Treatment.class, true);
|
||||
TableUtils.createTableIfNotExists(connectionSource, Treatment.class);
|
||||
latestTreatmentChange = 0;
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -148,7 +160,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
return getDao(TempTarget.class);
|
||||
}
|
||||
|
||||
public Dao<Treatment, Long> getDaoTreatments() throws SQLException {
|
||||
private Dao<Treatment, Long> getDaoTreatments() throws SQLException {
|
||||
return getDao(Treatment.class);
|
||||
}
|
||||
|
||||
|
@ -168,7 +180,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
List<BgReading> bgList = null;
|
||||
|
||||
try {
|
||||
Dao<BgReading, Long> daoBgReadings = MainApp.getDbHelper().getDaoBgReadings();
|
||||
Dao<BgReading, Long> daoBgReadings = getDaoBgReadings();
|
||||
QueryBuilder<BgReading, Long> queryBuilder = daoBgReadings.queryBuilder();
|
||||
queryBuilder.orderBy("timeIndex", false);
|
||||
queryBuilder.limit(1L);
|
||||
|
@ -219,6 +231,131 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
return new ArrayList<BgReading>();
|
||||
}
|
||||
|
||||
// TREATMENT HANDLING
|
||||
|
||||
public boolean isDataUnchanged(long time) {
|
||||
if (time >= latestTreatmentChange) return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
public int update(Treatment treatment) {
|
||||
int updated = 0;
|
||||
try {
|
||||
updated = getDaoTreatments().update(treatment);
|
||||
latestTreatmentChange = treatment.getTimeIndex();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
scheduleTreatmentChange();
|
||||
return updated;
|
||||
}
|
||||
|
||||
public Dao.CreateOrUpdateStatus createOrUpdate(Treatment treatment) {
|
||||
Dao.CreateOrUpdateStatus status = null;
|
||||
try {
|
||||
status = getDaoTreatments().createOrUpdate(treatment);
|
||||
latestTreatmentChange = treatment.getTimeIndex();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
scheduleTreatmentChange();
|
||||
return status;
|
||||
}
|
||||
|
||||
public void create(Treatment treatment) {
|
||||
try {
|
||||
getDaoTreatments().create(treatment);
|
||||
latestTreatmentChange = treatment.getTimeIndex();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
scheduleTreatmentChange();
|
||||
}
|
||||
|
||||
public int delete(String _id) {
|
||||
Treatment stored = findTreatmentById(_id);
|
||||
int removed = 0;
|
||||
if (stored != null) {
|
||||
log.debug("REMOVE: Existing treatment (removing): " + _id);
|
||||
try {
|
||||
removed = getDaoTreatments().delete(stored);
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (Config.logIncommingData)
|
||||
log.debug("Records removed: " + removed);
|
||||
latestTreatmentChange = stored.getTimeIndex();
|
||||
scheduleTreatmentChange();
|
||||
} else {
|
||||
log.debug("REMOVE: Not stored treatment (ignoring): " + _id);
|
||||
}
|
||||
return removed;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Treatment findTreatmentById(String _id) {
|
||||
try {
|
||||
Dao<Treatment, Long> daoTreatments = getDaoTreatments();
|
||||
QueryBuilder<Treatment, Long> queryBuilder = daoTreatments.queryBuilder();
|
||||
Where where = queryBuilder.where();
|
||||
where.eq("_id", _id);
|
||||
queryBuilder.limit(10);
|
||||
PreparedQuery<Treatment> preparedQuery = queryBuilder.prepare();
|
||||
List<Treatment> trList = daoTreatments.query(preparedQuery);
|
||||
if (trList.size() != 1) {
|
||||
//log.debug("Treatment findTreatmentById query size: " + trList.size());
|
||||
return null;
|
||||
} else {
|
||||
//log.debug("Treatment findTreatmentById found: " + trList.get(0).log());
|
||||
return trList.get(0);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Treatment findTreatmentByTimeIndex(Long timeIndex) {
|
||||
try {
|
||||
QueryBuilder<Treatment, String> qb = null;
|
||||
Dao<Treatment, Long> daoTreatments = getDaoTreatments();
|
||||
QueryBuilder<Treatment, Long> queryBuilder = daoTreatments.queryBuilder();
|
||||
Where where = queryBuilder.where();
|
||||
where.eq("timeIndex", timeIndex);
|
||||
queryBuilder.limit(10);
|
||||
PreparedQuery<Treatment> preparedQuery = queryBuilder.prepare();
|
||||
List<Treatment> trList = daoTreatments.query(preparedQuery);
|
||||
if (trList.size() != 1) {
|
||||
log.debug("Treatment findTreatmentByTimeIndex query size: " + trList.size());
|
||||
return null;
|
||||
} else {
|
||||
log.debug("Treatment findTreatmentByTimeIndex found: " + trList.get(0).log());
|
||||
return trList.get(0);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static public void scheduleTreatmentChange() {
|
||||
class PostRunnable implements Runnable {
|
||||
public void run() {
|
||||
MainApp.bus().post(new EventTreatmentChange());
|
||||
scheduledPost = null;
|
||||
}
|
||||
}
|
||||
// prepare task for execution in 5 sec
|
||||
// cancel waiting task to prevent sending multiple posts
|
||||
if (scheduledPost != null)
|
||||
scheduledPost.cancel(false);
|
||||
Runnable task = new PostRunnable();
|
||||
final int sec = 5;
|
||||
scheduledPost = worker.schedule(task, sec, TimeUnit.SECONDS);
|
||||
|
||||
}
|
||||
|
||||
public List<Treatment> getTreatmentDataFromTime(long mills, boolean ascending) {
|
||||
try {
|
||||
Dao<Treatment, Long> daoTreatments = getDaoTreatments();
|
||||
|
|
|
@ -131,7 +131,7 @@ public class TempBasal {
|
|||
|
||||
public int getRealDuration() {
|
||||
Long msecs = getTimeEnd().getTime() - timeStart.getTime();
|
||||
return (int) (msecs / 60 / 1000);
|
||||
return Math.round(msecs / 60f / 1000);
|
||||
}
|
||||
|
||||
public long getMillisecondsFromStart() {
|
||||
|
@ -140,8 +140,8 @@ public class TempBasal {
|
|||
|
||||
public int getPlannedRemainingMinutes() {
|
||||
if (timeEnd != null) return 0;
|
||||
long remainingMin = (getPlannedTimeEnd().getTime() - new Date().getTime()) / 1000 / 60;
|
||||
return (remainingMin < 0) ? 0 : (int) remainingMin;
|
||||
float remainingMin = (getPlannedTimeEnd().getTime() - new Date().getTime()) / 1000f / 60;
|
||||
return (remainingMin < 0) ? 0 : Math.round(remainingMin);
|
||||
}
|
||||
|
||||
public boolean isInProgress() {
|
||||
|
|
|
@ -28,6 +28,9 @@ public interface PumpInterface {
|
|||
int setNewBasalProfile(NSProfile profile);
|
||||
boolean isThisProfileSet(NSProfile profile);
|
||||
|
||||
Date lastStatusTime();
|
||||
void updateStatus(String reason);
|
||||
|
||||
double getBaseBasalRate(); // base basal rate, not temp basal
|
||||
double getTempBasalAbsoluteRate();
|
||||
double getTempBasalRemainingMinutes();
|
||||
|
|
|
@ -132,7 +132,7 @@ public class ActionsFragment extends Fragment implements FragmentBase, View.OnCl
|
|||
break;
|
||||
case R.id.actions_temptarget:
|
||||
NewNSTreatmentDialog newTTDialog = new NewNSTreatmentDialog();
|
||||
final OptionsToShow temptarget = new OptionsToShow(R.id.careportal_temptarget, R.string.careportal_temptarget, false, false, false, false, true, false, false, false, false, true);
|
||||
final OptionsToShow temptarget = new OptionsToShow(R.id.careportal_temporarytarget, R.string.careportal_temporarytarget, false, false, false, false, true, false, false, false, false, true);
|
||||
temptarget.executeTempTarget = true;
|
||||
newTTDialog.setOptions(temptarget);
|
||||
newTTDialog.show(manager, "NewNSTreatmentDialog");
|
||||
|
|
|
@ -151,7 +151,7 @@ public class NewTempBasalDialog extends DialogFragment implements View.OnClickLi
|
|||
}
|
||||
if (!result.success) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setTitle(MainApp.sResources.getString(R.string.treatmentdeliveryerror));
|
||||
builder.setTitle(MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
|
||||
builder.setMessage(result.comment);
|
||||
builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), null);
|
||||
builder.show();
|
||||
|
|
|
@ -8,10 +8,8 @@ import android.view.LayoutInflater;
|
|||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.interfaces.FragmentBase;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialog;
|
||||
|
||||
public class CareportalFragment extends Fragment implements FragmentBase, View.OnClickListener {
|
||||
|
@ -44,7 +42,7 @@ public class CareportalFragment extends Fragment implements FragmentBase, View.O
|
|||
final OptionsToShow tempbasalend = new OptionsToShow(R.id.careportal_tempbasalend, R.string.careportal_tempbasalend, true, false, false, false, false, false, false, false, false, false);
|
||||
final OptionsToShow profileswitch = new OptionsToShow(R.id.careportal_profileswitch, R.string.careportal_profileswitch, true, false, false, false, false, false, false, true, false, false);
|
||||
final OptionsToShow openapsoffline = new OptionsToShow(R.id.careportal_openapsoffline, R.string.careportal_openapsoffline, false, false, false, false, true, false, false, false, false, false);
|
||||
final OptionsToShow temptarget = new OptionsToShow(R.id.careportal_temptarget, R.string.careportal_temptarget, false, false, false, false, true, false, false, false, false, true);
|
||||
final OptionsToShow temptarget = new OptionsToShow(R.id.careportal_temporarytarget, R.string.careportal_temporarytarget, false, false, false, false, true, false, false, false, false, true);
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
|
@ -69,7 +67,7 @@ public class CareportalFragment extends Fragment implements FragmentBase, View.O
|
|||
view.findViewById(R.id.careportal_tempbasalend).setOnClickListener(this);
|
||||
view.findViewById(R.id.careportal_tempbasalstart).setOnClickListener(this);
|
||||
view.findViewById(R.id.careportal_openapsoffline).setOnClickListener(this);
|
||||
view.findViewById(R.id.careportal_temptarget).setOnClickListener(this);
|
||||
view.findViewById(R.id.careportal_temporarytarget).setOnClickListener(this);
|
||||
return view;
|
||||
}
|
||||
|
||||
|
@ -132,7 +130,7 @@ public class CareportalFragment extends Fragment implements FragmentBase, View.O
|
|||
case R.id.careportal_openapsoffline:
|
||||
newDialog.setOptions(openapsoffline);
|
||||
break;
|
||||
case R.id.careportal_temptarget:
|
||||
case R.id.careportal_temporarytarget:
|
||||
newDialog.setOptions(temptarget);
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -44,7 +44,6 @@ import java.util.Date;
|
|||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.db.BgReading;
|
||||
import info.nightscout.androidaps.db.TempTarget;
|
||||
import info.nightscout.androidaps.events.EventNewBasalProfile;
|
||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||
|
@ -431,7 +430,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
|
|||
case R.id.careportal_openapsoffline:
|
||||
data.put("eventType", "OpenAPS Offline");
|
||||
break;
|
||||
case R.id.careportal_temptarget:
|
||||
case R.id.careportal_temporarytarget:
|
||||
data.put("eventType", "Temporary Target");
|
||||
if (!reasonSpinner.getSelectedItem().toString().equals(""))
|
||||
data.put("reason", reasonSpinner.getSelectedItem().toString());
|
||||
|
|
|
@ -48,7 +48,6 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
|
|||
EditText diaView;
|
||||
RadioButton mgdlView;
|
||||
RadioButton mmolView;
|
||||
EditText carView;
|
||||
EditText targetlowView;
|
||||
EditText targethighView;
|
||||
EditText percentageView;
|
||||
|
@ -74,7 +73,6 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
|
|||
diaView = (EditText) layout.findViewById(R.id.circadianpercentageprofile_dia);
|
||||
mgdlView = (RadioButton) layout.findViewById(R.id.circadianpercentageprofile_mgdl);
|
||||
mmolView = (RadioButton) layout.findViewById(R.id.circadianpercentageprofile_mmol);
|
||||
carView = (EditText) layout.findViewById(R.id.circadianpercentageprofile_car);
|
||||
targetlowView = (EditText) layout.findViewById(R.id.circadianpercentageprofile_targetlow);
|
||||
targethighView = (EditText) layout.findViewById(R.id.circadianpercentageprofile_targethigh);
|
||||
percentageView = (EditText) layout.findViewById(R.id.circadianpercentageprofile_percentage);
|
||||
|
@ -101,7 +99,6 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
|
|||
mgdlView.setChecked(circadianPercentageProfilePlugin.mgdl);
|
||||
mmolView.setChecked(circadianPercentageProfilePlugin.mmol);
|
||||
diaView.setText(circadianPercentageProfilePlugin.dia.toString());
|
||||
carView.setText(circadianPercentageProfilePlugin.car.toString());
|
||||
targetlowView.setText(circadianPercentageProfilePlugin.targetLow.toString());
|
||||
targethighView.setText(circadianPercentageProfilePlugin.targetHigh.toString());
|
||||
percentageView.setText("" + circadianPercentageProfilePlugin.percentage);
|
||||
|
@ -226,7 +223,6 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
|
|||
circadianPercentageProfilePlugin.percentage = SafeParse.stringToInt(percentageView.getText().toString());
|
||||
}
|
||||
circadianPercentageProfilePlugin.dia = SafeParse.stringToDouble(diaView.getText().toString());
|
||||
circadianPercentageProfilePlugin.car = SafeParse.stringToDouble(carView.getText().toString());
|
||||
circadianPercentageProfilePlugin.targetLow = SafeParse.stringToDouble(targetlowView.getText().toString());
|
||||
circadianPercentageProfilePlugin.targetHigh = SafeParse.stringToDouble(targethighView.getText().toString());
|
||||
circadianPercentageProfilePlugin.timeshift = SafeParse.stringToInt(timeshiftView.getText().toString());
|
||||
|
@ -236,7 +232,6 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
|
|||
};
|
||||
|
||||
diaView.addTextChangedListener(textWatch);
|
||||
carView.addTextChangedListener(textWatch);
|
||||
targetlowView.addTextChangedListener(textWatch);
|
||||
targethighView.addTextChangedListener(textWatch);
|
||||
percentageView.addTextChangedListener(textWatch);
|
||||
|
|
|
@ -36,7 +36,6 @@ public class CircadianPercentageProfilePlugin implements PluginBase, ProfileInte
|
|||
boolean mgdl;
|
||||
boolean mmol;
|
||||
Double dia;
|
||||
Double car;
|
||||
Double targetLow;
|
||||
Double targetHigh;
|
||||
public int percentage;
|
||||
|
@ -108,7 +107,6 @@ public class CircadianPercentageProfilePlugin implements PluginBase, ProfileInte
|
|||
editor.putBoolean(SETTINGS_PREFIX + "mmol", mmol);
|
||||
editor.putBoolean(SETTINGS_PREFIX + "mgdl", mgdl);
|
||||
editor.putString(SETTINGS_PREFIX + "dia", dia.toString());
|
||||
editor.putString(SETTINGS_PREFIX + "car", car.toString());
|
||||
editor.putString(SETTINGS_PREFIX + "targetlow", targetLow.toString());
|
||||
editor.putString(SETTINGS_PREFIX + "targethigh", targetHigh.toString());
|
||||
editor.putString(SETTINGS_PREFIX + "timeshift", timeshift + "");
|
||||
|
@ -150,13 +148,6 @@ public class CircadianPercentageProfilePlugin implements PluginBase, ProfileInte
|
|||
log.debug(e.getMessage());
|
||||
}
|
||||
else dia = 3d;
|
||||
if (settings.contains(SETTINGS_PREFIX + "car"))
|
||||
try {
|
||||
car = SafeParse.stringToDouble(settings.getString(SETTINGS_PREFIX + "car", "20"));
|
||||
} catch (Exception e) {
|
||||
log.debug(e.getMessage());
|
||||
}
|
||||
else car = 20d;
|
||||
if (settings.contains(SETTINGS_PREFIX + "targetlow"))
|
||||
try {
|
||||
targetLow = SafeParse.stringToDouble(settings.getString(SETTINGS_PREFIX + "targetlow", "80"));
|
||||
|
@ -236,9 +227,7 @@ public class CircadianPercentageProfilePlugin implements PluginBase, ProfileInte
|
|||
}
|
||||
profile.put("carbratio", icArray);
|
||||
|
||||
profile.put("carbs_hr", car);
|
||||
|
||||
JSONArray isfArray = new JSONArray();
|
||||
JSONArray isfArray = new JSONArray();
|
||||
for (int i = 0; i < 24; i++) {
|
||||
isfArray.put(new JSONObject().put("timeAsSeconds", i * 60 * 60).put("value", baseisf[(offset + i) % 24] * 100d / percentage));
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@ import org.json.JSONObject;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
|
||||
|
@ -46,7 +45,6 @@ import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
|
|||
import info.nightscout.androidaps.plugins.OpenAPSAMA.DetermineBasalResultAMA;
|
||||
import info.nightscout.androidaps.plugins.OpenAPSMA.DetermineBasalResultMA;
|
||||
import info.nightscout.androidaps.plugins.Overview.Dialogs.BolusProgressDialog;
|
||||
import info.nightscout.androidaps.plugins.Actions.dialogs.NewExtendedBolusDialog;
|
||||
import info.nightscout.androidaps.plugins.Overview.Notification;
|
||||
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
|
||||
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
||||
|
@ -82,7 +80,8 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
|||
public ConfigBuilderPlugin() {
|
||||
MainApp.bus().register(this);
|
||||
PowerManager powerManager = (PowerManager) MainApp.instance().getApplicationContext().getSystemService(Context.POWER_SERVICE);
|
||||
mWakeLock = powerManager.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "ConfigBuilderPlugin");;
|
||||
mWakeLock = powerManager.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "ConfigBuilderPlugin");
|
||||
;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -103,7 +102,7 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
|||
@Override
|
||||
public String getNameShort() {
|
||||
String name = MainApp.sResources.getString(R.string.configbuilder_shortname);
|
||||
if (!name.trim().isEmpty()){
|
||||
if (!name.trim().isEmpty()) {
|
||||
//only if translation exists
|
||||
return name;
|
||||
}
|
||||
|
@ -210,14 +209,14 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
|||
public void logPluginStatus() {
|
||||
for (PluginBase p : pluginList) {
|
||||
log.debug(p.getName() + ":" +
|
||||
(p.isEnabled(1) ? " GENERAL" : "") +
|
||||
(p.isEnabled(2) ? " TREATMENT" : "") +
|
||||
(p.isEnabled(3) ? " TEMPBASAL" : "") +
|
||||
(p.isEnabled(4) ? " PROFILE" : "") +
|
||||
(p.isEnabled(5) ? " APS" : "") +
|
||||
(p.isEnabled(6) ? " PUMP" : "") +
|
||||
(p.isEnabled(7) ? " CONSTRAINTS" : "") +
|
||||
(p.isEnabled(8) ? " LOOP" : "") +
|
||||
(p.isEnabled(1) ? " GENERAL" : "") +
|
||||
(p.isEnabled(2) ? " TREATMENT" : "") +
|
||||
(p.isEnabled(3) ? " TEMPBASAL" : "") +
|
||||
(p.isEnabled(4) ? " PROFILE" : "") +
|
||||
(p.isEnabled(5) ? " APS" : "") +
|
||||
(p.isEnabled(6) ? " PUMP" : "") +
|
||||
(p.isEnabled(7) ? " CONSTRAINTS" : "") +
|
||||
(p.isEnabled(8) ? " LOOP" : "") +
|
||||
(p.isEnabled(9) ? " BGSOURCE" : "")
|
||||
);
|
||||
}
|
||||
|
@ -373,6 +372,16 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
|||
return activePump.isThisProfileSet(profile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date lastStatusTime() {
|
||||
return activePump.lastStatusTime();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStatus(String reason) {
|
||||
activePump.updateStatus(reason);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseBasalRate() {
|
||||
return activePump.getBaseBasalRate();
|
||||
|
@ -434,15 +443,10 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
|||
t.carbs = (double) result.carbsDelivered; // with different carbTime record will come back from nightscout
|
||||
t.created_at = new Date();
|
||||
t.mealBolus = result.carbsDelivered > 0;
|
||||
try {
|
||||
MainApp.getDbHelper().getDaoTreatments().create(t);
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
MainApp.getDbHelper().create(t);
|
||||
t.setTimeIndex(t.getTimeIndex());
|
||||
t.carbs = (double) result.carbsDelivered;
|
||||
uploadBolusWizardRecord(t, glucose, glucoseType, carbTime, boluscalc);
|
||||
MainApp.bus().post(new EventTreatmentChange());
|
||||
}
|
||||
mWakeLock.release();
|
||||
return result;
|
||||
|
@ -486,21 +490,15 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
|||
t.carbs = (double) result.carbsDelivered;
|
||||
t.created_at = new Date();
|
||||
t.mealBolus = t.carbs > 0;
|
||||
try {
|
||||
MainApp.getDbHelper().getDaoTreatments().create(t);
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
MainApp.getDbHelper().create(t);
|
||||
t.setTimeIndex(t.getTimeIndex());
|
||||
t.sendToNSClient();
|
||||
MainApp.bus().post(new EventTreatmentChange());
|
||||
}
|
||||
mWakeLock.release();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void stopBolusDelivering() {
|
||||
activePump.stopBolusDelivering();
|
||||
|
@ -809,7 +807,7 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
|||
data.put("absolute", absolute);
|
||||
data.put("created_at", DateUtil.toISOString(new Date()));
|
||||
data.put("enteredBy", MainApp.instance().getString(R.string.app_name));
|
||||
data.put("notes", MainApp.sResources.getString(R.string.androidaps_tempbasalstartnote) + " " + absolute + "u/h " + durationInMinutes +" min"); // ECOR
|
||||
data.put("notes", MainApp.sResources.getString(R.string.androidaps_tempbasalstartnote) + " " + absolute + "u/h " + durationInMinutes + " min"); // ECOR
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("action", "dbAdd");
|
||||
bundle.putString("collection", "treatments");
|
||||
|
@ -839,7 +837,7 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
|||
data.put("percent", percent - 100);
|
||||
data.put("created_at", DateUtil.toISOString(new Date()));
|
||||
data.put("enteredBy", MainApp.instance().getString(R.string.app_name));
|
||||
data.put("notes", MainApp.sResources.getString(R.string.androidaps_tempbasalstartnote) + " " + percent + "% " + durationInMinutes +" min"); // ECOR
|
||||
data.put("notes", MainApp.sResources.getString(R.string.androidaps_tempbasalstartnote) + " " + percent + "% " + durationInMinutes + " min"); // ECOR
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("action", "dbAdd");
|
||||
bundle.putString("collection", "treatments");
|
||||
|
|
|
@ -271,6 +271,18 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date lastStatusTime() {
|
||||
return getDanaRPump().lastConnection;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStatus(String reason) {
|
||||
if (!isConnected() && !isConnecting()) {
|
||||
doConnect(reason);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseBasalRate() {
|
||||
return getDanaRPump().currentBasal;
|
||||
|
|
|
@ -124,7 +124,6 @@ public class DanaRPump {
|
|||
|
||||
SharedPreferences SP = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext());
|
||||
double dia = SafeParse.stringToDouble(SP.getString("danarprofile_dia", "3"));
|
||||
double car = SafeParse.stringToDouble(SP.getString("danarprofile_car", "20"));
|
||||
|
||||
try {
|
||||
json.put("defaultProfile", PROFILE_PREFIX + (activeProfile + 1));
|
||||
|
@ -139,8 +138,6 @@ public class DanaRPump {
|
|||
carbratios.put(new JSONObject().put("time", "22:00").put("timeAsSeconds", 22 * 3600).put("value", nightCIR));
|
||||
profile.put("carbratio", carbratios);
|
||||
|
||||
profile.put("carbs_hr", car);
|
||||
|
||||
JSONArray sens = new JSONArray();
|
||||
sens.put(new JSONObject().put("time", "00:00").put("timeAsSeconds", 0).put("value", nightCF));
|
||||
sens.put(new JSONObject().put("time", "06:00").put("timeAsSeconds", 6 * 3600).put("value", morningCF));
|
||||
|
|
|
@ -32,6 +32,7 @@ import info.nightscout.androidaps.db.Treatment;
|
|||
import info.nightscout.androidaps.events.EventAppExit;
|
||||
import info.nightscout.androidaps.events.EventInitializationChanged;
|
||||
import info.nightscout.androidaps.events.EventPreferenceChange;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.plugins.DanaR.DanaRPlugin;
|
||||
import info.nightscout.androidaps.plugins.DanaR.DanaRPump;
|
||||
import info.nightscout.androidaps.plugins.DanaR.SerialIOThread;
|
||||
|
@ -226,6 +227,8 @@ public class ExecutionService extends Service {
|
|||
if (!getPumpStatus()) {
|
||||
mSerialIOThread.disconnect("getPumpStatus failed");
|
||||
waitMsec(3000);
|
||||
if (!MainApp.getSpecificPlugin(DanaRPlugin.class).isEnabled(PluginBase.PUMP))
|
||||
return;
|
||||
getBTSocketForSelectedPump();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -271,6 +271,18 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date lastStatusTime() {
|
||||
return getDanaRPump().lastConnection;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStatus(String reason) {
|
||||
if (!isConnected() && !isConnecting()) {
|
||||
doConnect(reason);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseBasalRate() {
|
||||
return getDanaRPump().currentBasal;
|
||||
|
|
|
@ -117,7 +117,6 @@ public class DanaRKoreanPump {
|
|||
|
||||
SharedPreferences SP = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext());
|
||||
double dia = SafeParse.stringToDouble(SP.getString("danarprofile_dia", "3"));
|
||||
double car = SafeParse.stringToDouble(SP.getString("danarprofile_car", "20"));
|
||||
|
||||
try {
|
||||
json.put("defaultProfile", PROFILE_PREFIX + (activeProfile + 1));
|
||||
|
@ -132,8 +131,6 @@ public class DanaRKoreanPump {
|
|||
carbratios.put(new JSONObject().put("time", "22:00").put("timeAsSeconds", 22 * 3600).put("value", nightCIR));
|
||||
profile.put("carbratio", carbratios);
|
||||
|
||||
profile.put("carbs_hr", car);
|
||||
|
||||
JSONArray sens = new JSONArray();
|
||||
sens.put(new JSONObject().put("time", "00:00").put("timeAsSeconds", 0).put("value", nightCF));
|
||||
sens.put(new JSONObject().put("time", "06:00").put("timeAsSeconds", 6 * 3600).put("value", morningCF));
|
||||
|
|
|
@ -32,6 +32,7 @@ import info.nightscout.androidaps.db.Treatment;
|
|||
import info.nightscout.androidaps.events.EventAppExit;
|
||||
import info.nightscout.androidaps.events.EventInitializationChanged;
|
||||
import info.nightscout.androidaps.events.EventPreferenceChange;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.plugins.DanaR.comm.MessageBase;
|
||||
import info.nightscout.androidaps.plugins.DanaR.comm.MsgBolusProgress;
|
||||
import info.nightscout.androidaps.plugins.DanaR.comm.MsgBolusStart;
|
||||
|
@ -222,6 +223,8 @@ public class ExecutionService extends Service {
|
|||
if (!getPumpStatus()) {
|
||||
mSerialIOThread.disconnect("getPumpStatus failed");
|
||||
waitMsec(3000);
|
||||
if (!MainApp.getSpecificPlugin(DanaRKoreanPlugin.class).isEnabled(PluginBase.PUMP))
|
||||
return;
|
||||
getBTSocketForSelectedPump();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,6 @@ public class LocalProfileFragment extends Fragment implements FragmentBase {
|
|||
RadioButton mmolView;
|
||||
TimeListEdit icView;
|
||||
TimeListEdit isfView;
|
||||
EditText carView;
|
||||
TimeListEdit basalView;
|
||||
TimeListEdit targetView;
|
||||
Button profileswitchButton;
|
||||
|
@ -66,7 +65,6 @@ public class LocalProfileFragment extends Fragment implements FragmentBase {
|
|||
mmolView = (RadioButton) layout.findViewById(R.id.localprofile_mmol);
|
||||
icView = new TimeListEdit(getContext(), layout, R.id.localprofile_ic, MainApp.sResources.getString(R.string.nsprofileview_ic_label), getPlugin().ic, null, new DecimalFormat("0.0"), save);
|
||||
isfView = new TimeListEdit(getContext(), layout, R.id.localprofile_isf, MainApp.sResources.getString(R.string.nsprofileview_isf_label), getPlugin().isf, null, new DecimalFormat("0.0"), save);
|
||||
carView = (EditText) layout.findViewById(R.id.localprofile_car);
|
||||
basalView = new TimeListEdit(getContext(), layout, R.id.localprofile_basal, MainApp.sResources.getString(R.string.nsprofileview_basal_label), getPlugin().basal, null, new DecimalFormat("0.00"), save);
|
||||
targetView = new TimeListEdit(getContext(), layout, R.id.localprofile_target, MainApp.sResources.getString(R.string.nsprofileview_target_label), getPlugin().targetLow, getPlugin().targetHigh, new DecimalFormat("0.0"), save);
|
||||
profileswitchButton = (Button) layout.findViewById(R.id.localprofile_profileswitch);
|
||||
|
@ -81,7 +79,6 @@ public class LocalProfileFragment extends Fragment implements FragmentBase {
|
|||
mgdlView.setChecked(localProfilePlugin.mgdl);
|
||||
mmolView.setChecked(localProfilePlugin.mmol);
|
||||
diaView.setText(localProfilePlugin.dia.toString());
|
||||
carView.setText(localProfilePlugin.car.toString());
|
||||
|
||||
mgdlView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -128,13 +125,11 @@ public class LocalProfileFragment extends Fragment implements FragmentBase {
|
|||
public void onTextChanged(CharSequence s, int start,
|
||||
int before, int count) {
|
||||
localProfilePlugin.dia = SafeParse.stringToDouble(diaView.getText().toString());
|
||||
localProfilePlugin.car = SafeParse.stringToDouble(carView.getText().toString());
|
||||
localProfilePlugin.storeSettings();
|
||||
}
|
||||
};
|
||||
|
||||
diaView.addTextChangedListener(textWatch);
|
||||
carView.addTextChangedListener(textWatch);
|
||||
|
||||
onStatusEvent(null);
|
||||
|
||||
|
|
|
@ -37,7 +37,6 @@ public class LocalProfilePlugin implements PluginBase, ProfileInterface {
|
|||
Double dia;
|
||||
JSONArray ic;
|
||||
JSONArray isf;
|
||||
Double car;
|
||||
JSONArray basal;
|
||||
JSONArray targetLow;
|
||||
JSONArray targetHigh;
|
||||
|
@ -107,7 +106,6 @@ public class LocalProfilePlugin implements PluginBase, ProfileInterface {
|
|||
editor.putString("LocalProfile" + "dia", dia.toString());
|
||||
editor.putString("LocalProfile" + "ic", ic.toString());
|
||||
editor.putString("LocalProfile" + "isf", isf.toString());
|
||||
editor.putString("LocalProfile" + "car", car.toString());
|
||||
editor.putString("LocalProfile" + "basal", basal.toString());
|
||||
editor.putString("LocalProfile" + "targetlow", targetLow.toString());
|
||||
editor.putString("LocalProfile" + "targethigh", targetHigh.toString());
|
||||
|
@ -178,13 +176,6 @@ public class LocalProfilePlugin implements PluginBase, ProfileInterface {
|
|||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (settings.contains("LocalProfile" + "car"))
|
||||
try {
|
||||
car = SafeParse.stringToDouble(settings.getString("LocalProfile" + "car", "20"));
|
||||
} catch (Exception e) {
|
||||
log.debug(e.getMessage());
|
||||
}
|
||||
else car = 20d;
|
||||
if (settings.contains("LocalProfile" + "basal"))
|
||||
try {
|
||||
basal = new JSONArray(settings.getString("LocalProfile" + "basal", DEFAULTARRAY));
|
||||
|
@ -290,7 +281,6 @@ public class LocalProfilePlugin implements PluginBase, ProfileInterface {
|
|||
json.put("store", store);
|
||||
profile.put("dia", dia);
|
||||
profile.put("carbratio", ic);
|
||||
profile.put("carbs_hr", car);
|
||||
profile.put("sens", isf);
|
||||
profile.put("basal", basal);
|
||||
profile.put("target_low", targetLow);
|
||||
|
|
|
@ -136,6 +136,16 @@ public class MDIPlugin implements PluginBase, PumpInterface {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date lastStatusTime() {
|
||||
return new Date();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStatus(String reason) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseBasalRate() {
|
||||
return 0d;
|
||||
|
|
|
@ -23,7 +23,7 @@ import info.nightscout.utils.SafeParse;
|
|||
public class Autosens {
|
||||
private static Logger log = LoggerFactory.getLogger(Autosens.class);
|
||||
|
||||
public static AutosensResult detectSensitivityandCarbAbsorption(List<BgReading> glucose_data, long mealTime) {
|
||||
public static AutosensResult detectSensitivityandCarbAbsorption(List<BgReading> glucose_data, Long mealTime) {
|
||||
SharedPreferences SP = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext());
|
||||
NSProfile profile = MainApp.getConfigBuilder().getActiveProfile().getProfile();
|
||||
|
||||
|
@ -129,7 +129,7 @@ public class Autosens {
|
|||
//log.debug("TIME: " + new Date(bgTime).toString() + " BG: " + bg + " SENS: " + sens + " DELTA: " + delta + " AVGDELTA: " + avgDelta + " IOB: " + iob.iob + " ACTIVITY: " + iob.activity + " BGI: " + bgi + " DEVIATION: " + deviation);
|
||||
|
||||
// if bgTime is more recent than mealTime
|
||||
if (bgTime > mealTime) {
|
||||
if (mealTime != null && bgTime > mealTime) {
|
||||
// figure out how many carbs that represents
|
||||
// but always assume at least 3mg/dL/5m (default) absorption
|
||||
double ci = Math.max(deviation, SafeParse.stringToDouble(SP.getString("openapsama_min_5m_carbimpact", "3.0")));
|
||||
|
@ -138,60 +138,65 @@ public class Autosens {
|
|||
carbsAbsorbed += absorbed;
|
||||
}
|
||||
}
|
||||
//console.error("");
|
||||
log.debug(pastSensitivity);
|
||||
//console.log(JSON.stringify(avgDeltas));
|
||||
//console.log(JSON.stringify(bgis));
|
||||
Arrays.sort(avgDeltas);
|
||||
Arrays.sort(bgis);
|
||||
Arrays.sort(deviations);
|
||||
|
||||
for (double i = 0.9; i > 0.1; i = i - 0.02) {
|
||||
//console.error("p="+i.toFixed(2)+": "+percentile(avgDeltas, i).toFixed(2)+", "+percentile(bgis, i).toFixed(2)+", "+percentile(deviations, i).toFixed(2));
|
||||
if (percentile(deviations, (i + 0.02)) >= 0 && percentile(deviations, i) < 0) {
|
||||
double ratio = 1;
|
||||
String ratioLimit = "";
|
||||
String sensResult = "";
|
||||
|
||||
if (mealTime == null) {
|
||||
//console.error("");
|
||||
log.debug(pastSensitivity);
|
||||
//console.log(JSON.stringify(avgDeltas));
|
||||
//console.log(JSON.stringify(bgis));
|
||||
Arrays.sort(avgDeltas);
|
||||
Arrays.sort(bgis);
|
||||
Arrays.sort(deviations);
|
||||
|
||||
for (double i = 0.9; i > 0.1; i = i - 0.02) {
|
||||
//console.error("p="+i.toFixed(2)+": "+percentile(avgDeltas, i).toFixed(2)+", "+percentile(bgis, i).toFixed(2)+", "+percentile(deviations, i).toFixed(2));
|
||||
log.debug(Math.round(100 * i) + "% of non-meal deviations negative (target 45%-50%)");
|
||||
if (percentile(deviations, (i + 0.02)) >= 0 && percentile(deviations, i) < 0) {
|
||||
//console.error("p="+i.toFixed(2)+": "+percentile(avgDeltas, i).toFixed(2)+", "+percentile(bgis, i).toFixed(2)+", "+percentile(deviations, i).toFixed(2));
|
||||
log.debug(Math.round(100 * i) + "% of non-meal deviations negative (target 45%-50%)");
|
||||
}
|
||||
}
|
||||
}
|
||||
double pSensitive = percentile(deviations, 0.50);
|
||||
double pResistant = percentile(deviations, 0.45);
|
||||
//p30 = percentile(deviations, 0.3);
|
||||
double pSensitive = percentile(deviations, 0.50);
|
||||
double pResistant = percentile(deviations, 0.45);
|
||||
//p30 = percentile(deviations, 0.3);
|
||||
|
||||
// average = deviationSum / deviations.length;
|
||||
|
||||
//console.error("Mean deviation: "+average.toFixed(2));
|
||||
double basalOff = 0;
|
||||
//console.error("Mean deviation: "+average.toFixed(2));
|
||||
double basalOff = 0;
|
||||
|
||||
String sensResult = "";
|
||||
if (pSensitive < 0) { // sensitive
|
||||
basalOff = pSensitive * (60 / 5) / NSProfile.toMgdl(profile.getIsf(NSProfile.secondsFromMidnight()), profile.getUnits());
|
||||
sensResult = "Excess insulin sensitivity detected";
|
||||
} else if (pResistant > 0) { // resistant
|
||||
basalOff = pResistant * (60 / 5) / NSProfile.toMgdl(profile.getIsf(NSProfile.secondsFromMidnight()), profile.getUnits());
|
||||
sensResult = "Excess insulin resistance detected";
|
||||
} else {
|
||||
sensResult = "Sensitivity normal";
|
||||
}
|
||||
log.debug(sensResult);
|
||||
double ratio = 1 + (basalOff / profile.getMaxDailyBasal());
|
||||
if (pSensitive < 0) { // sensitive
|
||||
basalOff = pSensitive * (60 / 5) / NSProfile.toMgdl(profile.getIsf(NSProfile.secondsFromMidnight()), profile.getUnits());
|
||||
sensResult = "Excess insulin sensitivity detected";
|
||||
} else if (pResistant > 0) { // resistant
|
||||
basalOff = pResistant * (60 / 5) / NSProfile.toMgdl(profile.getIsf(NSProfile.secondsFromMidnight()), profile.getUnits());
|
||||
sensResult = "Excess insulin resistance detected";
|
||||
} else {
|
||||
sensResult = "Sensitivity normal";
|
||||
}
|
||||
log.debug(sensResult);
|
||||
ratio = 1 + (basalOff / profile.getMaxDailyBasal());
|
||||
|
||||
// don't adjust more than 1.5x
|
||||
double rawRatio = ratio;
|
||||
ratio = Math.max(ratio, SafeParse.stringToDouble(SP.getString("openapsama_autosens_min", "0.7")));
|
||||
ratio = Math.min(ratio, SafeParse.stringToDouble(SP.getString("openapsama_autosens_max", "1.2")));
|
||||
|
||||
String ratioLimit = "";
|
||||
if (ratio != rawRatio) {
|
||||
ratioLimit = "Ratio limited from " + rawRatio + " to " + ratio;
|
||||
log.debug(ratioLimit);
|
||||
}
|
||||
if (ratio != rawRatio) {
|
||||
ratioLimit = "Ratio limited from " + rawRatio + " to " + ratio;
|
||||
log.debug(ratioLimit);
|
||||
}
|
||||
|
||||
double newisf = Math.round(NSProfile.toMgdl(profile.getIsf(NSProfile.secondsFromMidnight()), profile.getUnits()) / ratio);
|
||||
if (ratio != 1) {
|
||||
log.debug("ISF adjusted from " + NSProfile.toMgdl(profile.getIsf(NSProfile.secondsFromMidnight()), profile.getUnits()) + " to " + newisf);
|
||||
double newisf = Math.round(NSProfile.toMgdl(profile.getIsf(NSProfile.secondsFromMidnight()), profile.getUnits()) / ratio);
|
||||
if (ratio != 1) {
|
||||
log.debug("ISF adjusted from " + NSProfile.toMgdl(profile.getIsf(NSProfile.secondsFromMidnight()), profile.getUnits()) + " to " + newisf);
|
||||
}
|
||||
//console.error("Basal adjustment "+basalOff.toFixed(2)+"U/hr");
|
||||
//console.error("Ratio: "+ratio*100+"%: new ISF: "+newisf.toFixed(1)+"mg/dL/U");
|
||||
}
|
||||
//console.error("Basal adjustment "+basalOff.toFixed(2)+"U/hr");
|
||||
//console.error("Ratio: "+ratio*100+"%: new ISF: "+newisf.toFixed(1)+"mg/dL/U");
|
||||
|
||||
AutosensResult output = new AutosensResult();
|
||||
output.ratio = Round.roundTo(ratio, 0.01);
|
||||
|
|
|
@ -20,6 +20,7 @@ import info.nightscout.androidaps.Constants;
|
|||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.data.GlucoseStatus;
|
||||
import info.nightscout.androidaps.data.MealData;
|
||||
import info.nightscout.androidaps.db.TempBasal;
|
||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderFragment;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
|
@ -212,7 +213,6 @@ public class DetermineBasalAdapterAMAJS {
|
|||
|
||||
mProfile = new V8Object(mV8rt);
|
||||
mProfile.add("max_iob", maxIob);
|
||||
mProfile.add("carbs_hr", profile.getCarbAbsorbtionRate());
|
||||
mProfile.add("dia", profile.getDia());
|
||||
mProfile.add("type", "current");
|
||||
mProfile.add("max_daily_basal", profile.getMaxDailyBasal());
|
||||
|
@ -235,6 +235,13 @@ public class DetermineBasalAdapterAMAJS {
|
|||
mCurrentTemp.add("temp", "absolute");
|
||||
mCurrentTemp.add("duration", pump.getTempBasalRemainingMinutes());
|
||||
mCurrentTemp.add("rate", pump.getTempBasalAbsoluteRate());
|
||||
|
||||
// as we have non default temps longer than 30 mintues
|
||||
TempBasal tempBasal = pump.getTempBasal();
|
||||
if(tempBasal != null){
|
||||
mCurrentTemp.add("minutesrunning", tempBasal.getRealDuration());
|
||||
}
|
||||
|
||||
mV8rt.add(PARAM_currentTemp, mCurrentTemp);
|
||||
|
||||
mIobData = mV8rt.executeArrayScript(IobTotal.convertToJSONArray(iobArray).toString());
|
||||
|
|
|
@ -31,6 +31,7 @@ import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateRes
|
|||
import info.nightscout.androidaps.plugins.TempTargetRange.TempTargetRangePlugin;
|
||||
import info.nightscout.client.data.NSProfile;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
import info.nightscout.utils.Profiler;
|
||||
import info.nightscout.utils.Round;
|
||||
import info.nightscout.utils.SafeParse;
|
||||
import info.nightscout.utils.ToastUtils;
|
||||
|
@ -178,9 +179,14 @@ public class OpenAPSAMAPlugin implements PluginBase, APSInterface {
|
|||
minBg = Round.roundTo(minBg, 0.1d);
|
||||
maxBg = Round.roundTo(maxBg, 0.1d);
|
||||
|
||||
Date start = new Date();
|
||||
Date startPart = new Date();
|
||||
IobTotal[] iobArray = IobTotal.calculateIobArrayInDia();
|
||||
Profiler.log(log, "calculateIobArrayInDia()", startPart);
|
||||
|
||||
startPart = new Date();
|
||||
MealData mealData = MainApp.getConfigBuilder().getActiveTreatments().getMealData();
|
||||
Profiler.log(log, "getMealData()", startPart);
|
||||
|
||||
maxIob = MainApp.getConfigBuilder().applyMaxIOBConstraints(maxIob);
|
||||
|
||||
|
@ -204,23 +210,28 @@ public class OpenAPSAMAPlugin implements PluginBase, APSInterface {
|
|||
maxIob = verifyHardLimits(maxIob, "maxIob", 0, 7);
|
||||
maxBasal = verifyHardLimits(maxBasal, "max_basal", 0.1, 10);
|
||||
|
||||
if (!checkOnlyHardLimits(profile.getCarbAbsorbtionRate(), "carbs_hr", 4, 100)) return;
|
||||
if (!checkOnlyHardLimits(profile.getDia(), "dia", 2, 7)) return;
|
||||
if (!checkOnlyHardLimits(profile.getIc(profile.secondsFromMidnight()), "carbratio", 2, 100)) return;
|
||||
if (!checkOnlyHardLimits(NSProfile.toMgdl(profile.getIsf(NSProfile.secondsFromMidnight()).doubleValue(), units), "sens", 2, 900)) return;
|
||||
if (!checkOnlyHardLimits(profile.getMaxDailyBasal(), "max_daily_basal", 0.1, 10)) return;
|
||||
if (!checkOnlyHardLimits(pump.getBaseBasalRate(), "current_basal", 0.01, 5)) return;
|
||||
|
||||
startPart = new Date();
|
||||
long oldestDataAvailable = MainApp.getConfigBuilder().getActiveTempBasals().oldestDataAvaialable();
|
||||
List<BgReading> bgReadings = MainApp.getDbHelper().getBgreadingsDataFromTime(Math.max(oldestDataAvailable, (long) (new Date().getTime() - 60 * 60 * 1000L * (24 + profile.getDia()))), false);
|
||||
log.debug("Limiting data to oldest available temps: " + new Date(oldestDataAvailable).toString() + " (" + bgReadings.size() + " records)");
|
||||
Profiler.log(log, "getBgreadingsDataFromTime()", startPart);
|
||||
|
||||
startPart = new Date();
|
||||
if(MainApp.getConfigBuilder().isAMAModeEnabled()){
|
||||
lastAutosensResult = Autosens.detectSensitivityandCarbAbsorption(bgReadings, new Date().getTime());
|
||||
lastAutosensResult = Autosens.detectSensitivityandCarbAbsorption(bgReadings, null);
|
||||
} else {
|
||||
lastAutosensResult = new AutosensResult();
|
||||
}
|
||||
Profiler.log(log, "detectSensitivityandCarbAbsorption()", startPart);
|
||||
Profiler.log(log, "AMA data gathering", start);
|
||||
|
||||
start = new Date();
|
||||
determineBasalAdapterAMAJS.setData(profile, maxIob, maxBasal, minBg, maxBg, targetBg, pump, iobArray, glucoseStatus, mealData,
|
||||
lastAutosensResult.ratio, //autosensDataRatio
|
||||
isTempTarget,
|
||||
|
@ -229,6 +240,7 @@ public class OpenAPSAMAPlugin implements PluginBase, APSInterface {
|
|||
|
||||
|
||||
DetermineBasalResultAMA determineBasalResultAMA = determineBasalAdapterAMAJS.invoke();
|
||||
Profiler.log(log, "AMA calculation", start);
|
||||
// Fix bug determine basal
|
||||
if (determineBasalResultAMA.rate == 0d && determineBasalResultAMA.duration == 0 && !MainApp.getConfigBuilder().isTempBasalInProgress())
|
||||
determineBasalResultAMA.changeRequested = false;
|
||||
|
|
|
@ -63,7 +63,6 @@ public class DetermineBasalAdapterMAJS {
|
|||
// Profile
|
||||
mProfile = new V8Object(mV8rt);
|
||||
mProfile.add("max_iob", 0);
|
||||
mProfile.add("carbs_hr", 0);
|
||||
mProfile.add("dia", 0);
|
||||
mProfile.add("type", "current");
|
||||
mProfile.add("max_daily_basal", 0);
|
||||
|
@ -230,7 +229,6 @@ public class DetermineBasalAdapterMAJS {
|
|||
String units = profile.getUnits();
|
||||
|
||||
mProfile.add("max_iob", maxIob);
|
||||
mProfile.add("carbs_hr", profile.getCarbAbsorbtionRate());
|
||||
mProfile.add("dia", profile.getDia());
|
||||
mProfile.add("type", "current");
|
||||
mProfile.add("max_daily_basal", profile.getMaxDailyBasal());
|
||||
|
|
|
@ -30,6 +30,7 @@ import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateRes
|
|||
import info.nightscout.androidaps.plugins.TempTargetRange.TempTargetRangePlugin;
|
||||
import info.nightscout.client.data.NSProfile;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
import info.nightscout.utils.Profiler;
|
||||
import info.nightscout.utils.Round;
|
||||
import info.nightscout.utils.SafeParse;
|
||||
import info.nightscout.utils.ToastUtils;
|
||||
|
@ -179,6 +180,7 @@ public class OpenAPSMAPlugin implements PluginBase, APSInterface {
|
|||
minBg = Round.roundTo(minBg, 0.1d);
|
||||
maxBg = Round.roundTo(maxBg, 0.1d);
|
||||
|
||||
Date start = new Date();
|
||||
TreatmentsInterface treatments = MainApp.getConfigBuilder().getActiveTreatments();
|
||||
TempBasalsInterface tempBasals = MainApp.getConfigBuilder().getActiveTempBasals();
|
||||
treatments.updateTotalIOB();
|
||||
|
@ -191,6 +193,7 @@ public class OpenAPSMAPlugin implements PluginBase, APSInterface {
|
|||
MealData mealData = treatments.getMealData();
|
||||
|
||||
maxIob = MainApp.getConfigBuilder().applyMaxIOBConstraints(maxIob);
|
||||
Profiler.log(log, "MA data gathering", start);
|
||||
|
||||
minBg = verifyHardLimits(minBg, "minBg", Constants.VERY_HARD_LIMIT_MIN_BG[0], Constants.VERY_HARD_LIMIT_MIN_BG[1]);
|
||||
maxBg = verifyHardLimits(maxBg, "maxBg", Constants.VERY_HARD_LIMIT_MAX_BG[0], Constants.VERY_HARD_LIMIT_MAX_BG[1]);
|
||||
|
@ -209,14 +212,15 @@ public class OpenAPSMAPlugin implements PluginBase, APSInterface {
|
|||
maxIob = verifyHardLimits(maxIob, "maxIob", 0, 7);
|
||||
maxBasal = verifyHardLimits(maxBasal, "max_basal", 0.1, 10);
|
||||
|
||||
if (!checkOnlyHardLimits(profile.getCarbAbsorbtionRate(), "carbs_hr", 4, 100)) return;
|
||||
if (!checkOnlyHardLimits(profile.getDia(), "dia", 2, 7)) return;
|
||||
if (!checkOnlyHardLimits(profile.getIc(profile.secondsFromMidnight()), "carbratio", 2, 100)) return;
|
||||
if (!checkOnlyHardLimits(NSProfile.toMgdl(profile.getIsf(NSProfile.secondsFromMidnight()).doubleValue(), units), "sens", 2, 900)) return;
|
||||
if (!checkOnlyHardLimits(profile.getMaxDailyBasal(), "max_daily_basal", 0.1, 10)) return;
|
||||
if (!checkOnlyHardLimits(pump.getBaseBasalRate(), "current_basal", 0.01, 5)) return;
|
||||
|
||||
start = new Date();
|
||||
determineBasalAdapterMAJS.setData(profile, maxIob, maxBasal, minBg, maxBg, targetBg, pump, iobTotal, glucoseStatus, mealData);
|
||||
Profiler.log(log, "MA calculation", start);
|
||||
|
||||
|
||||
DetermineBasalResultMA determineBasalResultMA = determineBasalAdapterMAJS.invoke();
|
||||
|
|
|
@ -81,7 +81,6 @@ import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotificati
|
|||
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
||||
import info.nightscout.androidaps.plugins.Overview.graphExtensions.PointsWithLabelGraphSeries;
|
||||
import info.nightscout.androidaps.plugins.Overview.graphExtensions.TimeAsXAxisLabelFormatter;
|
||||
import info.nightscout.androidaps.plugins.TempBasals.TempBasalsPlugin;
|
||||
import info.nightscout.androidaps.plugins.TempTargetRange.TempTargetRangePlugin;
|
||||
import info.nightscout.androidaps.plugins.TempTargetRange.events.EventTempTargetRangeChange;
|
||||
import info.nightscout.client.data.NSProfile;
|
||||
|
@ -613,7 +612,7 @@ public class OverviewFragment extends Fragment {
|
|||
public boolean onLongClick(View view) {
|
||||
view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
|
||||
NewNSTreatmentDialog newTTDialog = new NewNSTreatmentDialog();
|
||||
final OptionsToShow temptarget = new OptionsToShow(R.id.careportal_temptarget, R.string.careportal_temptarget, false, false, false, false, true, false, false, false, false, true);
|
||||
final OptionsToShow temptarget = new OptionsToShow(R.id.careportal_temporarytarget, R.string.careportal_temporarytarget, false, false, false, false, true, false, false, false, false, true);
|
||||
temptarget.executeTempTarget = true;
|
||||
newTTDialog.setOptions(temptarget);
|
||||
newTTDialog.show(getFragmentManager(), "NewNSTreatmentDialog");
|
||||
|
|
|
@ -48,7 +48,6 @@ public class SimpleProfileFragment extends Fragment implements FragmentBase {
|
|||
RadioButton mmolView;
|
||||
EditText icView;
|
||||
EditText isfView;
|
||||
EditText carView;
|
||||
EditText basalView;
|
||||
EditText targetlowView;
|
||||
EditText targethighView;
|
||||
|
@ -63,7 +62,6 @@ public class SimpleProfileFragment extends Fragment implements FragmentBase {
|
|||
mmolView = (RadioButton) layout.findViewById(R.id.simpleprofile_mmol);
|
||||
icView = (EditText) layout.findViewById(R.id.simpleprofile_ic);
|
||||
isfView = (EditText) layout.findViewById(R.id.simpleprofile_isf);
|
||||
carView = (EditText) layout.findViewById(R.id.simpleprofile_car);
|
||||
basalView = (EditText) layout.findViewById(R.id.simpleprofile_basalrate);
|
||||
targetlowView = (EditText) layout.findViewById(R.id.simpleprofile_targetlow);
|
||||
targethighView = (EditText) layout.findViewById(R.id.simpleprofile_targethigh);
|
||||
|
@ -82,7 +80,6 @@ public class SimpleProfileFragment extends Fragment implements FragmentBase {
|
|||
diaView.setText(simpleProfilePlugin.dia.toString());
|
||||
icView.setText(simpleProfilePlugin.ic.toString());
|
||||
isfView.setText(simpleProfilePlugin.isf.toString());
|
||||
carView.setText(simpleProfilePlugin.car.toString());
|
||||
basalView.setText(simpleProfilePlugin.basal.toString());
|
||||
targetlowView.setText(simpleProfilePlugin.targetLow.toString());
|
||||
targethighView.setText(simpleProfilePlugin.targetHigh.toString());
|
||||
|
@ -134,7 +131,6 @@ public class SimpleProfileFragment extends Fragment implements FragmentBase {
|
|||
simpleProfilePlugin.dia = SafeParse.stringToDouble(diaView.getText().toString());
|
||||
simpleProfilePlugin.ic = SafeParse.stringToDouble(icView.getText().toString());
|
||||
simpleProfilePlugin.isf = SafeParse.stringToDouble(isfView.getText().toString());
|
||||
simpleProfilePlugin.car = SafeParse.stringToDouble(carView.getText().toString());
|
||||
simpleProfilePlugin.basal = SafeParse.stringToDouble(basalView.getText().toString());
|
||||
simpleProfilePlugin.targetLow = SafeParse.stringToDouble(targetlowView.getText().toString());
|
||||
simpleProfilePlugin.targetHigh = SafeParse.stringToDouble(targethighView.getText().toString());
|
||||
|
@ -145,7 +141,6 @@ public class SimpleProfileFragment extends Fragment implements FragmentBase {
|
|||
diaView.addTextChangedListener(textWatch);
|
||||
icView.addTextChangedListener(textWatch);
|
||||
isfView.addTextChangedListener(textWatch);
|
||||
carView.addTextChangedListener(textWatch);
|
||||
basalView.addTextChangedListener(textWatch);
|
||||
targetlowView.addTextChangedListener(textWatch);
|
||||
targethighView.addTextChangedListener(textWatch);
|
||||
|
|
|
@ -34,7 +34,6 @@ public class SimpleProfilePlugin implements PluginBase, ProfileInterface {
|
|||
Double dia;
|
||||
Double ic;
|
||||
Double isf;
|
||||
Double car;
|
||||
Double basal;
|
||||
Double targetLow;
|
||||
Double targetHigh;
|
||||
|
@ -104,7 +103,6 @@ public class SimpleProfilePlugin implements PluginBase, ProfileInterface {
|
|||
editor.putString("SimpleProfile" + "dia", dia.toString());
|
||||
editor.putString("SimpleProfile" + "ic", ic.toString());
|
||||
editor.putString("SimpleProfile" + "isf", isf.toString());
|
||||
editor.putString("SimpleProfile" + "car", car.toString());
|
||||
editor.putString("SimpleProfile" + "basal", basal.toString());
|
||||
editor.putString("SimpleProfile" + "targetlow", targetLow.toString());
|
||||
editor.putString("SimpleProfile" + "targethigh", targetHigh.toString());
|
||||
|
@ -153,13 +151,6 @@ public class SimpleProfilePlugin implements PluginBase, ProfileInterface {
|
|||
log.debug(e.getMessage());
|
||||
}
|
||||
else isf = 200d;
|
||||
if (settings.contains("SimpleProfile" + "car"))
|
||||
try {
|
||||
car = SafeParse.stringToDouble(settings.getString("SimpleProfile" + "car", "20"));
|
||||
} catch (Exception e) {
|
||||
log.debug(e.getMessage());
|
||||
}
|
||||
else car = 20d;
|
||||
if (settings.contains("SimpleProfile" + "basal"))
|
||||
try {
|
||||
basal = SafeParse.stringToDouble(settings.getString("SimpleProfile" + "basal", "1"));
|
||||
|
@ -232,7 +223,6 @@ public class SimpleProfilePlugin implements PluginBase, ProfileInterface {
|
|||
json.put("store", store);
|
||||
profile.put("dia", dia);
|
||||
profile.put("carbratio", new JSONArray().put(new JSONObject().put("timeAsSeconds", 0).put("value", ic)));
|
||||
profile.put("carbs_hr", car);
|
||||
profile.put("sens", new JSONArray().put(new JSONObject().put("timeAsSeconds", 0).put("value", isf)));
|
||||
profile.put("basal", new JSONArray().put(new JSONObject().put("timeAsSeconds", 0).put("value", basal)));
|
||||
profile.put("target_low", new JSONArray().put(new JSONObject().put("timeAsSeconds", 0).put("value", targetLow)));
|
||||
|
|
|
@ -145,6 +145,16 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date lastStatusTime() {
|
||||
return new Date();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStatus(String reason) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseBasalRate() {
|
||||
NSProfile profile = MainApp.getConfigBuilder().getActiveProfile().getProfile();
|
||||
|
|
|
@ -104,6 +104,7 @@ public class PersistentNotificationPlugin implements PluginBase{
|
|||
|
||||
|
||||
String line1 = ctx.getString(R.string.noprofile);
|
||||
if (MainApp.getConfigBuilder().getActiveProfile() == null) return;
|
||||
NSProfile profile = MainApp.getConfigBuilder().getActiveProfile().getProfile();
|
||||
|
||||
|
||||
|
|
|
@ -7,12 +7,11 @@ package info.nightscout.androidaps.receivers;
|
|||
import android.app.AlarmManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.ServiceConnection;
|
||||
import android.os.IBinder;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.PowerManager;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -21,14 +20,12 @@ import java.util.Date;
|
|||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainActivity;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.plugins.DanaR.DanaRFragment;
|
||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||
import info.nightscout.androidaps.plugins.DanaR.DanaRPlugin;
|
||||
import info.nightscout.androidaps.plugins.DanaR.Services.ExecutionService;
|
||||
import info.nightscout.androidaps.plugins.DanaRKorean.DanaRKoreanPlugin;
|
||||
import info.nightscout.utils.ToastUtils;
|
||||
import info.nightscout.client.data.NSProfile;
|
||||
|
||||
public class KeepAliveReceiver extends BroadcastReceiver {
|
||||
private static Logger log = LoggerFactory.getLogger(KeepAliveReceiver.class);
|
||||
|
@ -39,32 +36,48 @@ public class KeepAliveReceiver extends BroadcastReceiver {
|
|||
PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "");
|
||||
wl.acquire();
|
||||
|
||||
log.debug("KeepAlive received");
|
||||
final DanaRPlugin danaRPlugin = (DanaRPlugin) MainApp.getSpecificPlugin(DanaRPlugin.class);
|
||||
if (danaRPlugin != null && Config.DANAR && danaRPlugin.isEnabled(PluginBase.PUMP)) {
|
||||
if (danaRPlugin.getDanaRPump().lastConnection.getTime() + 30 * 60 * 1000L < new Date().getTime() && !danaRPlugin.isConnected() && !danaRPlugin.isConnecting()) {
|
||||
|
||||
final PumpInterface pump = MainApp.getConfigBuilder();
|
||||
final NSProfile profile = MainApp.getConfigBuilder().getActiveProfile().getProfile();
|
||||
if (pump != null && profile != null) {
|
||||
boolean isBasalOutdated = false;
|
||||
boolean isStatusOutdated = false;
|
||||
|
||||
Date lastConnection = pump.lastStatusTime();
|
||||
if (lastConnection.getTime() + 30 * 60 * 1000L < new Date().getTime())
|
||||
isStatusOutdated = true;
|
||||
if (Math.abs(profile.getBasal(NSProfile.secondsFromMidnight()) - pump.getBaseBasalRate()) > pump.getPumpDescription().basalStep)
|
||||
isBasalOutdated = true;
|
||||
|
||||
SharedPreferences SP = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext());
|
||||
if (SP.getBoolean("syncprofiletopump", false) && !pump.isThisProfileSet(profile)) {
|
||||
Thread t = new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
danaRPlugin.doConnect("KeepAlive");
|
||||
pump.setNewBasalProfile(profile);
|
||||
}
|
||||
});
|
||||
t.start();
|
||||
}
|
||||
}
|
||||
final DanaRKoreanPlugin danaRKoreanPlugin = (DanaRKoreanPlugin) MainApp.getSpecificPlugin(DanaRKoreanPlugin.class);
|
||||
if (danaRKoreanPlugin != null && Config.DANAR && danaRKoreanPlugin.isEnabled(PluginBase.PUMP)) {
|
||||
if (danaRKoreanPlugin.getDanaRPump().lastConnection.getTime() + 30 * 60 * 1000L < new Date().getTime() && !danaRKoreanPlugin.isConnected() && !danaRKoreanPlugin.isConnecting()) {
|
||||
} else if (isStatusOutdated) {
|
||||
Thread t = new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
danaRKoreanPlugin.doConnect("KeepAlive");
|
||||
pump.updateStatus("KeepAlive. Status outdated.");
|
||||
}
|
||||
});
|
||||
t.start();
|
||||
} else if (isBasalOutdated) {
|
||||
Thread t = new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
pump.updateStatus("KeepAlive. Basal outdated.");
|
||||
}
|
||||
});
|
||||
t.start();
|
||||
}
|
||||
}
|
||||
|
||||
log.debug("KeepAlive received");
|
||||
wl.release();
|
||||
}
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ public class NSProfile {
|
|||
}
|
||||
return 3D;
|
||||
}
|
||||
|
||||
/*
|
||||
public Double getCarbAbsorbtionRate() {
|
||||
return getCarbAbsorbtionRate(getDefaultProfile());
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ public class NSProfile {
|
|||
}
|
||||
return 0D;
|
||||
}
|
||||
|
||||
*/
|
||||
// mmol or mg/dl
|
||||
public String getUnits() {
|
||||
return getUnits(getDefaultProfile());
|
||||
|
|
18
app/src/main/java/info/nightscout/utils/Profiler.java
Normal file
18
app/src/main/java/info/nightscout/utils/Profiler.java
Normal file
|
@ -0,0 +1,18 @@
|
|||
package info.nightscout.utils;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Created by mike on 29.01.2017.
|
||||
*/
|
||||
|
||||
public class Profiler {
|
||||
public Profiler(){}
|
||||
|
||||
static public void log(Logger log, String function, Date start) {
|
||||
long msec = new Date().getTime() - start.getTime();
|
||||
log.debug(">>> " + function + " <<< executed in " + msec + " miliseconds");
|
||||
}
|
||||
}
|
|
@ -198,10 +198,10 @@
|
|||
app:layout_row="5" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/careportal_temptarget"
|
||||
android:id="@+id/careportal_temporarytarget"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="70dp"
|
||||
android:text="@string/careportal_temptarget"
|
||||
android:text="@string/careportal_temporarytarget"
|
||||
app:layout_column="0"
|
||||
app:layout_columnWeight="1"
|
||||
app:layout_gravity="fill"
|
||||
|
|
|
@ -239,24 +239,6 @@
|
|||
android:inputType="numberDecimal" />
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/absorption_rate"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/circadianpercentageprofile_car"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_column="2"
|
||||
android:inputType="numberDecimal" />
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/linearBlockBackground"
|
||||
android:text="@string/units"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:background="@color/linearBlockBackground" />
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -42,56 +42,41 @@
|
|||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/linearBlockBackground"
|
||||
android:text="@string/dia"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:background="@color/linearBlockBackground" />
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/localprofile_dia"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textAlignment="center"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_width="70dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/localprofile_ic"></LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/localprofile_isf"></LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/absorption_rate"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:background="@color/linearBlockBackground" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/localprofile_car"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:textAlignment="center"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_width="70dp" />
|
||||
android:textAlignment="center" />
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:id="@+id/localprofile_ic"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/localprofile_basal"></LinearLayout>
|
||||
android:orientation="vertical" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/localprofile_isf"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:id="@+id/localprofile_target">
|
||||
android:orientation="vertical" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/localprofile_basal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/localprofile_target"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/dia"
|
||||
android:text="@string/dia"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<EditText
|
||||
|
@ -75,27 +75,15 @@
|
|||
android:inputType="numberDecimal" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/absorption_rate"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/simpleprofile_car"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/simpleprofile_basalrate_label"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/basal_rate"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/simpleprofile_basalrate"
|
||||
android:layout_width="100dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal" />
|
||||
|
||||
|
|
|
@ -205,7 +205,7 @@
|
|||
<string name="end_user_license_agreement_i_understand">РАЗБИРАМ И СЕ СЪГЛАСЯВАМ</string>
|
||||
<string name="language">Език</string>
|
||||
<string name="save">Сигурност</string>
|
||||
<string name="syncprofiletopump_title">Синхронизирай помпата с профила в Nightscout</string>
|
||||
<string name="syncprofiletopump_title">Синхронизирай помпата с профила</string>
|
||||
<string name="nobtadapter">Няма bluetooth адаптер</string>
|
||||
<string name="nightscout">Nightscout</string>
|
||||
<string name="dismiss">Разбрах</string>
|
||||
|
@ -230,7 +230,6 @@
|
|||
<string name="danar_valuenotsetproperly">Неправилно зададени стойности</string>
|
||||
<string name="danar_viewprofile">Виж профила</string>
|
||||
<string name="danarprofile">DanaR профил</string>
|
||||
<string name="danarprofile_car">Усвояване на въглехидрати гр./ч.</string>
|
||||
<string name="danarprofile_dia">DIA (Време на действие на инсулина) ч.:</string>
|
||||
<string name="danar_lastbolus">Последен болус:</string>
|
||||
<string name="danar_invalidinput">Неправилни входни данни</string>
|
||||
|
@ -348,7 +347,6 @@
|
|||
<string name="ns_upload_only">NS upload only (изключва синхронизацията)</string>
|
||||
<string name="ns_upload_only_enabled">Моля изключете "NS upload only" за да използвате това.</string>
|
||||
<string name="ns_upload_only_summary">NS upload only. Not effective on SGV unless a local source like xDrip is selected. Not effective on Profiles while NS-Profiles is used.</string>
|
||||
<string name="absorption_rate">Усвояване на ВХ (ч):</string>
|
||||
<string name="alert_dialog_storage_permission_text">Моля рестартирайте телефона или AndroidAPS, в противен случай информацията за грешки няма да се запише(важно за да се потвърди, че алгоритъмът работи правилно)</string>
|
||||
<string name="androidaps_tempbasalendnote">Край на временен базал</string>
|
||||
<string name="androidaps_tempbasalstartnote">Старт на временен базал</string>
|
||||
|
@ -395,7 +393,6 @@
|
|||
<string name="circadian_percentage_profile_shortname">"ППр "</string>
|
||||
<string name="careportal_shortname">"CaPr"</string>
|
||||
<string name="activity">Физ.активност</string>
|
||||
<string name="careportal_temptarget">Временна цел</string>
|
||||
<string name="danar_stats">DanaR статистика</string>
|
||||
<string name="danar_stats_basalrate">Базал</string>
|
||||
<string name="danar_stats_bolus">Болус</string>
|
||||
|
|
|
@ -202,7 +202,7 @@
|
|||
<string name="disconnected">Odpojeno</string>
|
||||
<string name="danar_bt_name_title">DanaR Bluetooth zařízení</string>
|
||||
<string name="danar_pump_settings">DanaR nastavení</string>
|
||||
<string name="syncprofiletopump_title">Synchronizovat NS profil do pumpy</string>
|
||||
<string name="syncprofiletopump_title">Synchronizovat profil do pumpy</string>
|
||||
<string name="nightscout">Nightscout</string>
|
||||
<string name="absolute">Absolutní</string>
|
||||
<string name="comment">Komentář</string>
|
||||
|
@ -240,8 +240,7 @@
|
|||
<string name="manual">Jiný</string>
|
||||
<string name="glucosetype_sensor">Senzor</string>
|
||||
<string name="danarprofile">DanaR profil</string>
|
||||
<string name="danarprofile_car">Rychlost absorbce sacharidů</string>
|
||||
<string name="danarprofile_dia">Rychlost inzulínu[h]</string>
|
||||
<string name="danarprofile_dia">Celková doba aktivity inzulínu[h]</string>
|
||||
<string name="failedupdatebasalprofile">Chyba při nastavení dočasného bazálu</string>
|
||||
<string name="danar_alarm">alarm</string>
|
||||
<string name="danar_basalhour">hodinový bazál</string>
|
||||
|
@ -323,7 +322,6 @@
|
|||
<string name="androidaps_start">AndroidAPS restartován</string>
|
||||
<string name="androidaps_tempbasalendnote">Dočasný bazál konec</string>
|
||||
<string name="androidaps_tempbasalstartnote">Dočasný bazál začátek</string>
|
||||
<string name="absorption_rate">Rychlost absorbce sacharidů:</string>
|
||||
<string name="alert_dialog_storage_permission_text">Prosím restartujte Váš telefon nebo restartujte AndroidAPS z nastavení systému jinak nebudou zaznamenány ladící informace (důležité pro sledování a kontrolu, zda algoritmus pracuje správně)</string>
|
||||
<string name="base_profile_label">Bazální profil:</string>
|
||||
<string name="batterydischarged">Baterie v pumpě vybitá</string>
|
||||
|
@ -419,4 +417,26 @@
|
|||
<string name="configbuilder_shortname">" "</string>
|
||||
<string name="circadian_percentage_profile_shortname">" "</string>
|
||||
<string name="careportal_shortname">" "</string>
|
||||
<string name="advancedsettings_title">Rozšířené nastavení</string>
|
||||
<string name="always_use_shortavg">Vždy používat krátkodobý průměrný rozdíl glykémií místo rozdílu posledních 2 hodnot</string>
|
||||
<string name="always_use_shortavg_summary">Výhodné, pokud data z xDripu obsahují velký šum</string>
|
||||
<string name="danar_stats">Statistika z pumpy</string>
|
||||
<string name="danar_stats_amount_days">Dní</string>
|
||||
<string name="danar_stats_cumulative_tdd">Kumulativní TDD</string>
|
||||
<string name="danar_stats_expweight">Exponenciálně vážené TDD</string>
|
||||
<string name="danar_stats_olddata_Message">Zastaralá data. Prosím načtěte je znovu</string>
|
||||
<string name="danar_stats_basalrate">Bazál</string>
|
||||
<string name="danar_stats_bolus">Bolus</string>
|
||||
<string name="danar_stats_date">Datum</string>
|
||||
<string name="danar_stats_ratio">Koef</string>
|
||||
<string name="danar_stats_tbb">Celk. denní bazál</string>
|
||||
<string name="danar_stats_tbb2">TBB * 2</string>
|
||||
<string name="danar_stats_tdd">TDD</string>
|
||||
<string name="danar_stats_warning_Message">Pravděpodobně nepřesné při používání bolusů k doplňování</string>
|
||||
<string name="danar_stats_weight">Váha</string>
|
||||
<string name="openapsama_autosens_adjusttargets">Povolit funkci Autosens měnit cílový rozsah</string>
|
||||
<string name="prefs_delta_title">Nastavení parametru delta BG</string>
|
||||
<string name="profile">Profil</string>
|
||||
<string name="short_tabtitles">Krátké názvy modulů</string>
|
||||
<string name="virtualpump_firmware_label">Firmware:</string>
|
||||
</resources>
|
||||
|
|
|
@ -221,7 +221,6 @@
|
|||
<string name="danar_viewprofile">Profil anzeigen</string>
|
||||
<string name="danarprofile">DanaR Profil Einstellungen</string>
|
||||
<string name="danarprofile_dia">DIA [h]</string>
|
||||
<string name="danarprofile_car">Kohlehydrahte Absorptionsrate</string>
|
||||
<string name="manual">Manuell</string>
|
||||
<string name="danar_dailyunits">Einheiten (Tag)</string>
|
||||
<string name="danar_invalidinput">ungültige Eingabe</string>
|
||||
|
@ -235,7 +234,7 @@
|
|||
<string name="hoursago">vor h </string>
|
||||
<string name="smscommunicator">SMS Kommunikator</string>
|
||||
<string name="smscommunicator_allowednumbers">erlaubte Telefonnummern</string>
|
||||
<string name="syncprofiletopump_title">Nightscout Profil zur Pumpe synchronisieren</string>
|
||||
<string name="syncprofiletopump_title">Profil zur Pumpe synchronisieren</string>
|
||||
<string name="waitingforpumpresult">auf Pumpenergebnis warten</string>
|
||||
<string name="nobtadapter">Kein Bluetoothadapter gefunden</string>
|
||||
<string name="smscommunicator_remotebolusnotallowed">Remote Bolus nicht erlaubt</string>
|
||||
|
@ -309,7 +308,6 @@
|
|||
<string name="button1">Knopf 1</string>
|
||||
<string name="button2">Knopf 2</string>
|
||||
<string name="button3">Knopf 3</string>
|
||||
<string name="absorption_rate">Absorptionsrate:</string>
|
||||
<string name="configbuilder">Config Builder</string>
|
||||
<string name="minago">vor %d min</string>
|
||||
<string name="actions_shortname">"AKT"</string>
|
||||
|
|
|
@ -209,7 +209,7 @@
|
|||
<string name="connecting">Conectando</string>
|
||||
<string name="connected">Conectado</string>
|
||||
<string name="disconnected">Desconectado</string>
|
||||
<string name="syncprofiletopump_title">Sincronizar perfil NS a bomba</string>
|
||||
<string name="syncprofiletopump_title">Sincronizar perfil a bomba</string>
|
||||
<string name="danar_pump_settings">Ajustes de la bomba DanaR</string>
|
||||
<string name="nightscout">Nightscout</string>
|
||||
<string name="end_user_license_agreement">Acuerdo de licencia de usuario final</string>
|
||||
|
@ -250,7 +250,6 @@
|
|||
<string name="careportal_temporarytargetcancel">Cancelar Objetivo temporal</string>
|
||||
<string name="danarprofile">Configuración perfil DanaR</string>
|
||||
<string name="danarprofile_dia">DIA [h]</string>
|
||||
<string name="danarprofile_car">Tasa de absorción de carbohidratos</string>
|
||||
<string name="failedupdatebasalprofile">No se pudo actualizar el perfil basal</string>
|
||||
<string name="danar_history">Historial</string>
|
||||
<string name="danar_historyreload">Recargar</string>
|
||||
|
@ -367,7 +366,6 @@
|
|||
<string name="button1">Botón 1</string>
|
||||
<string name="button2">Botón 2</string>
|
||||
<string name="button3">Botón 3</string>
|
||||
<string name="careportal_temptarget">Objetivo Temporal</string>
|
||||
<string name="danar_disableeasymode">Inhabilitar EasyUI modo en bomba</string>
|
||||
<string name="danar_enableextendedbolus">Habilitar bolos extendidos en bomba</string>
|
||||
<string name="danar_switchtouhmode">Cambio de modo de U/d a U/h en bomba</string>
|
||||
|
|
|
@ -211,7 +211,7 @@
|
|||
<string name="connecting">연결중</string>
|
||||
<string name="connected">연결됨</string>
|
||||
<string name="disconnected">연결 끊김</string>
|
||||
<string name="syncprofiletopump_title">NS 프로파일을 펌프에 동기화하기</string>
|
||||
<string name="syncprofiletopump_title">프로파일을 펌프에 동기화하기</string>
|
||||
<string name="danar_pump_settings">다나R 펌프 설정</string>
|
||||
<string name="nightscout">Nightscout</string>
|
||||
<string name="end_user_license_agreement">End User License Agreement</string>
|
||||
|
@ -253,7 +253,6 @@
|
|||
<string name="careportal_temporarytargetcancel">Temporary Target Cancel</string>
|
||||
<string name="danarprofile">DanaR 프로파일 설정</string>
|
||||
<string name="danarprofile_dia">인슐린활동시간(DIA) [h]</string>
|
||||
<string name="danarprofile_car">탄수화물 흡수속도 [g/hour]</string>
|
||||
<string name="failedupdatebasalprofile">기초주입 프로파일 갱신 실패</string>
|
||||
<string name="danar_history">History</string>
|
||||
<string name="danar_historyreload">Reload</string>
|
||||
|
@ -350,7 +349,6 @@
|
|||
<string name="mgdl">mg/dl</string>
|
||||
<string name="mmol">mmol/l</string>
|
||||
<string name="dia">DIA:</string>
|
||||
<string name="absorption_rate">Absorption rate:</string>
|
||||
<string name="target_range">Target range:</string>
|
||||
<string name="edit_base_basal">Edit Base-Basal:</string>
|
||||
<string name="edit_base_isf">Edit Base-ISF:</string>
|
||||
|
|
|
@ -116,6 +116,7 @@
|
|||
<string name="openapsma_disabled">Plugin is disabled</string>
|
||||
<string name="constraints_violation">Constraints violation</string>
|
||||
<string name="treatmentdeliveryerror">Bolus delivery error</string>
|
||||
<string name="tempbasaldeliveryerror">Tempbasal delivery error</string>
|
||||
<string name="overview_newtempbasal_basal_label">Basal value</string>
|
||||
<string name="overview_newtempbasal_percent_label">% (100% = current)</string>
|
||||
<string name="setbasalquestion">Accept new temp basal:</string>
|
||||
|
@ -222,7 +223,7 @@
|
|||
<string name="connecting">Connecting</string>
|
||||
<string name="connected">Connected</string>
|
||||
<string name="disconnected">Disconnected</string>
|
||||
<string name="syncprofiletopump_title">Sync Nightscout profile to pump</string>
|
||||
<string name="syncprofiletopump_title">Sync profile to pump</string>
|
||||
<string name="danar_pump_settings">DanaR pump settings</string>
|
||||
<string name="nightscout">Nightscout</string>
|
||||
<string name="end_user_license_agreement">End User License Agreement</string>
|
||||
|
@ -365,7 +366,6 @@
|
|||
<string name="mgdl">mg/dl</string>
|
||||
<string name="mmol">mmol/l</string>
|
||||
<string name="dia">DIA:</string>
|
||||
<string name="absorption_rate">Absorption rate:</string>
|
||||
<string name="target_range">Target range:</string>
|
||||
<string name="edit_base_basal">Edit Base-Basal:</string>
|
||||
<string name="edit_base_isf">Edit Base-ISF:</string>
|
||||
|
@ -455,6 +455,7 @@
|
|||
<string name="advancedsettings_title">Advanced Settings</string>
|
||||
<string name="virtualpump_firmware_label">Firmware:</string>
|
||||
<string formatted="false" name="danar_model">Model: %02X Protocol: %02X Code: %02X</string>
|
||||
<string name="profile">Profile</string>
|
||||
<string name="openapsama_max_daily_safety_multiplier">max_daily_safety_multiplier</string>
|
||||
<string name="openapsama_max_daily_safety_multiplier_summary">Default value: 3\nThis is a key OpenAPS safety cap. What this does is limit your basals to be 3x (in this people) your biggest basal rate. You likely will not need to change this, but you should be aware that’s what is discussed about “3x max daily; 4x current” for safety caps.</string>
|
||||
<string name="openapsama_current_basal_safety_multiplier">current_basal_safety_multiplier</string>
|
||||
|
|
|
@ -9,11 +9,6 @@
|
|||
android:numeric="decimal"
|
||||
android:dialogMessage="@string/danarprofile_dia_summary"
|
||||
android:title="@string/danarprofile_dia" />
|
||||
<EditTextPreference
|
||||
android:defaultValue=""
|
||||
android:key="danarprofile_car"
|
||||
android:numeric="decimal"
|
||||
android:title="@string/danarprofile_car" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<PreferenceCategory
|
||||
android:key="nigthscout"
|
||||
android:title="@string/nightscout">
|
||||
android:key="profile"
|
||||
android:title="@string/profile">
|
||||
|
||||
<SwitchPreference
|
||||
android:defaultValue="false"
|
|
@ -106,14 +106,6 @@
|
|||
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
|
||||
|
@ -122,8 +114,17 @@
|
|||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/23.0.1/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/23.0.1/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-base/7.3.0/jars" />
|
||||
|
@ -133,15 +134,12 @@
|
|||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/ustwo-clockwise-debug/jars" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-safeguard" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Android API 23 Platform" jdkType="Android SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
|
@ -155,4 +153,4 @@
|
|||
<orderEntry type="library" exported="" name="play-services-base-7.3.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="support-annotations-23.0.1" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
</module>
|
Loading…
Reference in a new issue