show Dana model properly after communication error
This commit is contained in:
parent
5b064cd8f8
commit
4ff09a0125
5 changed files with 14 additions and 7 deletions
|
@ -229,7 +229,7 @@ public class DanaRFragment extends SubscriberFragment {
|
||||||
batteryView.setText("{fa-battery-" + (pump.batteryRemaining / 25) + "}");
|
batteryView.setText("{fa-battery-" + (pump.batteryRemaining / 25) + "}");
|
||||||
SetWarnColor.setColorInverse(batteryView, pump.batteryRemaining, 51d, 26d);
|
SetWarnColor.setColorInverse(batteryView, pump.batteryRemaining, 51d, 26d);
|
||||||
iobView.setText(pump.iob + " U");
|
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));
|
firmwareView.setText(String.format(MainApp.sResources.getString(R.string.danar_model), pump.model, pump.protocol, pump.productCode));
|
||||||
} else {
|
} else {
|
||||||
firmwareView.setText("OLD");
|
firmwareView.setText("OLD");
|
||||||
|
|
|
@ -29,6 +29,10 @@ public class DanaRPump {
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void reset() {
|
||||||
|
instance = null;
|
||||||
|
}
|
||||||
|
|
||||||
public static final int UNITS_MGDL = 0;
|
public static final int UNITS_MGDL = 0;
|
||||||
public static final int UNITS_MMOL = 1;
|
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 DOMESTIC_MODEL = 0x01;
|
||||||
public static final int EXPORT_MODEL = 0x03;
|
public static final int EXPORT_MODEL = 0x03;
|
||||||
public int model;
|
public int model = 0;
|
||||||
public int protocol;
|
public int protocol = 0;
|
||||||
public int productCode;
|
public int productCode = 0;
|
||||||
|
|
||||||
public boolean isConfigUD;
|
public boolean isConfigUD;
|
||||||
public boolean isExtendedBolusEnabled;
|
public boolean isExtendedBolusEnabled;
|
||||||
|
|
|
@ -36,7 +36,8 @@ public class MsgInitConnStatusTime extends MessageBase {
|
||||||
MainApp.getSpecificPlugin(DanaRPlugin.class).setFragmentEnabled(PluginBase.PUMP, false);
|
MainApp.getSpecificPlugin(DanaRPlugin.class).setFragmentEnabled(PluginBase.PUMP, false);
|
||||||
MainApp.getSpecificPlugin(DanaRPlugin.class).setFragmentVisible(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 profile coming from pump, switch it as well
|
||||||
if(MainApp.getSpecificPlugin(DanaRPlugin.class).isEnabled(PluginBase.PROFILE)){
|
if(MainApp.getSpecificPlugin(DanaRPlugin.class).isEnabled(PluginBase.PROFILE)){
|
||||||
(MainApp.getSpecificPlugin(DanaRPlugin.class)).setFragmentEnabled(PluginBase.PROFILE, false);
|
(MainApp.getSpecificPlugin(DanaRPlugin.class)).setFragmentEnabled(PluginBase.PROFILE, false);
|
||||||
|
|
|
@ -37,7 +37,8 @@ public class MsgInitConnStatusTime_k extends MessageBase {
|
||||||
MainApp.getSpecificPlugin(DanaRKoreanPlugin.class).setFragmentVisible(PluginBase.PUMP, false);
|
MainApp.getSpecificPlugin(DanaRKoreanPlugin.class).setFragmentVisible(PluginBase.PUMP, false);
|
||||||
MainApp.getSpecificPlugin(DanaRPlugin.class).setFragmentEnabled(PluginBase.PUMP, true);
|
MainApp.getSpecificPlugin(DanaRPlugin.class).setFragmentEnabled(PluginBase.PUMP, true);
|
||||||
MainApp.getSpecificPlugin(DanaRPlugin.class).setFragmentVisible(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 profile coming from pump, switch it as well
|
||||||
if (MainApp.getSpecificPlugin(DanaRKoreanPlugin.class).isEnabled(PluginBase.PROFILE)) {
|
if (MainApp.getSpecificPlugin(DanaRKoreanPlugin.class).isEnabled(PluginBase.PROFILE)) {
|
||||||
|
|
|
@ -49,7 +49,8 @@ public class MsgCheckValue_v2 extends MessageBase {
|
||||||
MainApp.getSpecificPlugin(DanaRKoreanPlugin.class).setFragmentVisible(PluginBase.PUMP, true);
|
MainApp.getSpecificPlugin(DanaRKoreanPlugin.class).setFragmentVisible(PluginBase.PUMP, true);
|
||||||
MainApp.getSpecificPlugin(DanaRPlugin.class).setFragmentEnabled(PluginBase.PUMP, false);
|
MainApp.getSpecificPlugin(DanaRPlugin.class).setFragmentEnabled(PluginBase.PUMP, false);
|
||||||
MainApp.getSpecificPlugin(DanaRPlugin.class).setFragmentVisible(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 profile coming from pump, switch it as well
|
||||||
if(MainApp.getSpecificPlugin(DanaRPlugin.class).isEnabled(PluginBase.PROFILE)){
|
if(MainApp.getSpecificPlugin(DanaRPlugin.class).isEnabled(PluginBase.PROFILE)){
|
||||||
|
|
Loading…
Reference in a new issue