show Dana model properly after communication error

This commit is contained in:
Milos Kozak 2018-03-12 22:16:10 +01:00
parent 5b064cd8f8
commit 4ff09a0125
5 changed files with 14 additions and 7 deletions

View file

@ -229,7 +229,7 @@ public class DanaRFragment extends SubscriberFragment {
batteryView.setText("{fa-battery-" + (pump.batteryRemaining / 25) + "}");
SetWarnColor.setColorInverse(batteryView, pump.batteryRemaining, 51d, 26d);
iobView.setText(pump.iob + " U");
if (pump.isNewPump) {
if (pump.model != 0 || pump.protocol != 0 || pump.productCode != 0) {
firmwareView.setText(String.format(MainApp.sResources.getString(R.string.danar_model), pump.model, pump.protocol, pump.productCode));
} else {
firmwareView.setText("OLD");

View file

@ -29,6 +29,10 @@ public class DanaRPump {
return instance;
}
public static void reset() {
instance = null;
}
public static final int UNITS_MGDL = 0;
public static final int UNITS_MMOL = 1;
@ -69,9 +73,9 @@ public class DanaRPump {
public static final int DOMESTIC_MODEL = 0x01;
public static final int EXPORT_MODEL = 0x03;
public int model;
public int protocol;
public int productCode;
public int model = 0;
public int protocol = 0;
public int productCode = 0;
public boolean isConfigUD;
public boolean isExtendedBolusEnabled;

View file

@ -36,7 +36,8 @@ public class MsgInitConnStatusTime extends MessageBase {
MainApp.getSpecificPlugin(DanaRPlugin.class).setFragmentEnabled(PluginBase.PUMP, false);
MainApp.getSpecificPlugin(DanaRPlugin.class).setFragmentVisible(PluginBase.PUMP, false);
DanaRPump.getInstance().lastConnection = 0; // mark not initialized
DanaRPump.reset(); // mark not initialized
//If profile coming from pump, switch it as well
if(MainApp.getSpecificPlugin(DanaRPlugin.class).isEnabled(PluginBase.PROFILE)){
(MainApp.getSpecificPlugin(DanaRPlugin.class)).setFragmentEnabled(PluginBase.PROFILE, false);

View file

@ -37,7 +37,8 @@ public class MsgInitConnStatusTime_k extends MessageBase {
MainApp.getSpecificPlugin(DanaRKoreanPlugin.class).setFragmentVisible(PluginBase.PUMP, false);
MainApp.getSpecificPlugin(DanaRPlugin.class).setFragmentEnabled(PluginBase.PUMP, true);
MainApp.getSpecificPlugin(DanaRPlugin.class).setFragmentVisible(PluginBase.PUMP, true);
DanaRPump.getInstance().lastConnection = 0; // mark not initialized
DanaRPump.reset(); // mark not initialized
//If profile coming from pump, switch it as well
if (MainApp.getSpecificPlugin(DanaRKoreanPlugin.class).isEnabled(PluginBase.PROFILE)) {

View file

@ -49,7 +49,8 @@ public class MsgCheckValue_v2 extends MessageBase {
MainApp.getSpecificPlugin(DanaRKoreanPlugin.class).setFragmentVisible(PluginBase.PUMP, true);
MainApp.getSpecificPlugin(DanaRPlugin.class).setFragmentEnabled(PluginBase.PUMP, false);
MainApp.getSpecificPlugin(DanaRPlugin.class).setFragmentVisible(PluginBase.PUMP, false);
DanaRPump.getInstance().lastConnection = 0; // mark not initialized
DanaRPump.reset(); // mark not initialized
//If profile coming from pump, switch it as well
if(MainApp.getSpecificPlugin(DanaRPlugin.class).isEnabled(PluginBase.PROFILE)){