Merge remote-tracking branch 'origin/dev' into combo-scripter-v2

* origin/dev:
  remove unused imports
  adapt wear actions to command queue
  RS report unsupported firmware
  removing the whole if() statement
  fix NPE when profile not loaded
  fix of extended bolus size
  Added profile's target BG in NSClient mode
This commit is contained in:
Johannes Mockenhaupt 2017-12-09 19:51:07 +01:00
commit 471beae14c
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1
7 changed files with 21 additions and 15 deletions

View file

@ -976,9 +976,6 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
tempTargetView.setText(Profile.toTargetRangeString(profile.getTargetLow(), profile.getTargetHigh(), units, units));
tempTargetView.setVisibility(View.VISIBLE);
}
if ((Config.NSCLIENT || Config.G5UPLOADER) && tempTarget == null) {
tempTargetView.setVisibility(View.GONE);
}
// **** Temp button ****
if (acceptTempLayout != null) {

View file

@ -230,7 +230,7 @@ public class PointsWithLabelGraphSeries<E extends DataPointWithLabelInterface> e
Rect bounds = new Rect((int)endX, (int)endY + 3, (int) (xpluslength), (int) endY + 8);
mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
canvas.drawRect(bounds, mPaint);
mPaint.setTextSize((int) (scaledTextSize * 2.5));
mPaint.setTextSize((float) (scaledTextSize));
mPaint.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.NORMAL));
mPaint.setFakeBoldText(true);
canvas.drawText(value.getLabel(), endX, endY, mPaint);
@ -282,7 +282,7 @@ public class PointsWithLabelGraphSeries<E extends DataPointWithLabelInterface> e
mPaint.setStrokeWidth(0);
if (value.getLabel() != null) {
mPaint.setStrokeWidth(0);
mPaint.setTextSize((int) (scaledTextSize * 3));
mPaint.setTextSize((float) (scaledTextSize * 1.2));
mPaint.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));
Rect bounds = new Rect();
mPaint.getTextBounds(value.getLabel(), 0, value.getLabel().length(), bounds);
@ -312,7 +312,7 @@ public class PointsWithLabelGraphSeries<E extends DataPointWithLabelInterface> e
mPaint.setStrokeWidth(0);
if (value.getLabel() != null) {
mPaint.setStrokeWidth(0);
mPaint.setTextSize(scaledTextSize * 3);
mPaint.setTextSize((float) (scaledTextSize * 1.5));
mPaint.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));
Rect bounds = new Rect();
mPaint.getTextBounds(value.getLabel(), 0, value.getLabel().length(), bounds);

View file

@ -56,6 +56,7 @@ public class Notification {
public static final int COMBO_PUMP_ALARM = 25;
public static final int PUMP_UNREACHABLE = 26;
public static final int BG_READINGS_MISSED = 27;
public static final int UNSUPPORTED_FIRMWARE = 28;
public int id;
public Date date;

View file

@ -6,6 +6,10 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
public class DanaRS_Packet_General_Get_Pump_Check extends DanaRS_Packet {
@ -37,6 +41,10 @@ public class DanaRS_Packet_General_Get_Pump_Check extends DanaRS_Packet {
log.debug("Protocol: " + String.format("%02X ", pump.protocol));
log.debug("Product Code: " + String.format("%02X ", pump.productCode));
}
if (pump.productCode < 2) {
MainApp.bus().post(new EventNewNotification(new Notification(Notification.UNSUPPORTED_FIRMWARE, MainApp.sResources.getString(R.string.unsupportedfirmware), Notification.URGENT)));
}
}
@Override

View file

@ -1,6 +1,5 @@
package info.nightscout.androidaps.plugins.Wear;
import android.os.Handler;
import android.os.HandlerThread;
import android.support.annotation.NonNull;
@ -26,7 +25,6 @@ import info.nightscout.androidaps.db.ProfileSwitch;
import info.nightscout.androidaps.db.Source;
import info.nightscout.androidaps.db.TempTarget;
import info.nightscout.androidaps.interfaces.APSInterface;
import info.nightscout.androidaps.interfaces.DanaRInterface;
import info.nightscout.androidaps.interfaces.PluginBase;
import info.nightscout.androidaps.interfaces.ProfileInterface;
import info.nightscout.androidaps.interfaces.PumpInterface;
@ -296,11 +294,10 @@ public class ActionStringHandler {
rMessage += MainApp.instance().getString(R.string.pumpbusy);
} else {
rMessage += "trying to fetch data from pump.";
Handler handler = new Handler(handlerThread.getLooper());
handler.post(new Runnable() {
ConfigBuilderPlugin.getCommandQueue().loadHistory(RecordTypes.RECORD_TYPE_DAILY, new Callback() {
@Override
public void run() {
((DanaRInterface) pump).loadHistory(RecordTypes.RECORD_TYPE_DAILY);
List<DanaRHistoryRecord> dummies = new LinkedList<DanaRHistoryRecord>();
List<DanaRHistoryRecord> historyList = getTDDList(dummies);
if (isOldData(historyList)) {
@ -308,8 +305,8 @@ public class ActionStringHandler {
} else {
sendStatusmessage("TDD", generateTDDMessage(historyList, dummies));
}
}
});
}
});
}
} else {
// if up to date: prepare, send (check if CPP is activated -> add CPP stats)

View file

@ -538,8 +538,10 @@ public class WatchUpdaterService extends WearableListenerService implements
//bgi
String bgiString = "";
Profile profile = MainApp.getConfigBuilder().getProfile();
double bgi = -(bolusIob.activity + basalIob.activity) * 5 * profile.getIsf();
bgiString = "" + ((bgi >= 0) ? "+" : "") + DecimalFormatter.to1Decimal(bgi);
if(profile!=null) {
double bgi = -(bolusIob.activity + basalIob.activity) * 5 * profile.getIsf();
bgiString = "" + ((bgi >= 0) ? "+" : "") + DecimalFormatter.to1Decimal(bgi);
}
String status = generateStatusString(profile, tempBasal,iobSum, iobDetail, bgiString);

View file

@ -786,6 +786,7 @@
<string name="customapp">Customized APK for download</string>
<string name="wear_detailed_delta_title">Show detailed delta</string>
<string name="wear_detailed_delta_summary">Show delta with one more decimal place</string>
<string name="unsupportedfirmware">Unsupported pump firmware</string>
<string name="bolusstopping">Stopping bolus delivery</string>
<string name="bolusstopped">Bolus delivery stopped</string>
<string name="combo_programming_bolus">Programming pump for bolusing</string>