Add disable vibration in insight settings (local_full only)

Build works but as it related to pump communication, I prefer to not test it on my pump before Tebbe confirmation... (code is very simple, so it should work!)
This commit is contained in:
Philoul 2020-05-15 11:37:09 +02:00
parent 51ab43416a
commit 1dd579fd19
4 changed files with 18 additions and 1 deletions

View file

@ -597,6 +597,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
bolusMessage.setDuration(0);
bolusMessage.setExtendedAmount(0);
bolusMessage.setImmediateAmount(insulin);
bolusMessage.setVibration(sp.getBoolean("insight_disable_vibration",false));
bolusID = connectionService.requestMessage(bolusMessage).await().getBolusId();
bolusCancelled = false;
}
@ -820,6 +821,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface,
bolusMessage.setDuration(durationInMinutes);
bolusMessage.setExtendedAmount(insulin);
bolusMessage.setImmediateAmount(0);
bolusMessage.setVibration(sp.getBoolean("insight_disable_vibration",false));
int bolusID = connectionService.requestMessage(bolusMessage).await().getBolusId();
InsightBolusID insightBolusID = new InsightBolusID();
insightBolusID.bolusID = bolusID;

View file

@ -14,6 +14,7 @@ public class DeliverBolusMessage extends AppLayerMessage {
private double extendedAmount;
private int duration;
private int bolusId;
private boolean disableVibration = false;
public DeliverBolusMessage() {
super(MessagePriority.NORMAL, true, true, Service.REMOTE_CONTROL);
@ -22,7 +23,11 @@ public class DeliverBolusMessage extends AppLayerMessage {
@Override
protected ByteBuf getData() {
ByteBuf byteBuf = new ByteBuf(22);
byteBuf.putUInt16LE(252);
// 805 => Old value with vibration (2.6.1 and earlier), 252 => new value without vibrations for firmware 3.x
if (disableVibration)
byteBuf.putUInt16LE(252);
else
byteBuf.putUInt16LE(805);
byteBuf.putUInt16LE(BolusTypeIDs.IDS.getID(bolusType));
byteBuf.putUInt16LE(31);
byteBuf.putUInt16LE(0);
@ -57,6 +62,8 @@ public class DeliverBolusMessage extends AppLayerMessage {
this.duration = duration;
}
public void setVibration(boolean disableVibration) { this.disableVibration = disableVibration;}
public int getBolusId() {
return bolusId;
}

View file

@ -1016,6 +1016,8 @@
<string name="log_alerts">Log alerts</string>
<string name="enable_tbr_emulation">Enable TBR emulation</string>
<string name="enable_tbr_emulation_summary">Use extended boluses instead of TBRs to bypass the 250%% limit</string>
<string name="disable_vibration">Disable vibrations on bolus delivery</string>
<string name="disable_vibration_summary">This setting is only available with Insight firmware 3.x</string>
<string name="disconnect_delay">Disconnect delay [s]</string>
<string name="serial_number">Serial number</string>
<string name="release_software_version">Release software version</string>

View file

@ -48,6 +48,12 @@
android:summary="@string/enable_tbr_emulation_summary"
android:title="@string/enable_tbr_emulation" />
<SwitchPreference
android:defaultValue="false"
android:key="insight_disable_vibration"
android:summary="@string/disable_vibration_summary"
android:title="@string/disable_vibration" />
<EditTextPreference
android:defaultValue="5"
android:inputType="number"