Merge pull request #1252 from PoweRGbg/patch-3
fix for timeDisplayFormat in Dana RS
This commit is contained in:
commit
c0e834e2f1
1 changed files with 13 additions and 6 deletions
|
@ -45,6 +45,10 @@ public class DanaRUserOptionsActivity extends Activity {
|
||||||
NumberPicker shutdown;
|
NumberPicker shutdown;
|
||||||
NumberPicker lowReservoir;
|
NumberPicker lowReservoir;
|
||||||
Button saveToPumpButton;
|
Button saveToPumpButton;
|
||||||
|
// This is for Dana pumps only
|
||||||
|
boolean isRS = MainApp.getSpecificPlugin(DanaRSPlugin.class) != null && MainApp.getSpecificPlugin(DanaRSPlugin.class).isEnabled(PluginType.PUMP);
|
||||||
|
boolean isDanaR = MainApp.getSpecificPlugin(DanaRPlugin.class) != null && MainApp.getSpecificPlugin(DanaRPlugin.class).isEnabled(PluginType.PUMP);
|
||||||
|
boolean isDanaRv2 = MainApp.getSpecificPlugin(DanaRv2Plugin.class) != null && MainApp.getSpecificPlugin(DanaRv2Plugin.class).isEnabled(PluginType.PUMP);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
|
@ -125,8 +129,8 @@ public class DanaRUserOptionsActivity extends Activity {
|
||||||
|
|
||||||
public void setData() {
|
public void setData() {
|
||||||
DanaRPump pump = DanaRPump.getInstance();
|
DanaRPump pump = DanaRPump.getInstance();
|
||||||
|
// in DanaRS timeDisplay values are reversed
|
||||||
timeFormat.setChecked(pump.timeDisplayType != 0);
|
timeFormat.setChecked((!isRS && pump.timeDisplayType != 0) || (isRS && pump.timeDisplayType == 0));
|
||||||
buttonScroll.setChecked(pump.buttonScrollOnOff != 0);
|
buttonScroll.setChecked(pump.buttonScrollOnOff != 0);
|
||||||
beep.setChecked(pump.beepAndAlarm > 4);
|
beep.setChecked(pump.beepAndAlarm > 4);
|
||||||
screenTimeout.setValue((double) pump.lcdOnTimeSec);
|
screenTimeout.setValue((double) pump.lcdOnTimeSec);
|
||||||
|
@ -142,19 +146,22 @@ public class DanaRUserOptionsActivity extends Activity {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSaveClick() {
|
public void onSaveClick() {
|
||||||
boolean isRS = MainApp.getSpecificPlugin(DanaRSPlugin.class) != null && MainApp.getSpecificPlugin(DanaRSPlugin.class).isEnabled(PluginType.PUMP);
|
|
||||||
boolean isDanaR = MainApp.getSpecificPlugin(DanaRPlugin.class) != null && MainApp.getSpecificPlugin(DanaRPlugin.class).isEnabled(PluginType.PUMP);
|
|
||||||
boolean isDanaRv2 = MainApp.getSpecificPlugin(DanaRv2Plugin.class) != null && MainApp.getSpecificPlugin(DanaRv2Plugin.class).isEnabled(PluginType.PUMP);
|
|
||||||
if (!isRS && !isDanaR && !isDanaRv2) {
|
if (!isRS && !isDanaR && !isDanaRv2) {
|
||||||
//exit if pump is not DanaRS, Dana!, or DanaR with upgraded firmware
|
//exit if pump is not DanaRS, Dana!, or DanaR with upgraded firmware
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DanaRPump pump = DanaRPump.getInstance();
|
DanaRPump pump = DanaRPump.getInstance();
|
||||||
|
|
||||||
if (timeFormat.isChecked())
|
if (timeFormat.isChecked())
|
||||||
pump.timeDisplayType = 1;
|
pump.timeDisplayType = 1;
|
||||||
else
|
else
|
||||||
pump.timeDisplayType = 0;
|
pump.timeDisplayType = 0;
|
||||||
|
// displayTime on RS is reversed
|
||||||
|
if (isRS) {
|
||||||
|
if (timeFormat.isChecked())
|
||||||
|
pump.timeDisplayType = 0;
|
||||||
|
else
|
||||||
|
pump.timeDisplayType = 1;
|
||||||
|
}
|
||||||
if (buttonScroll.isChecked())
|
if (buttonScroll.isChecked())
|
||||||
pump.buttonScrollOnOff = 1;
|
pump.buttonScrollOnOff = 1;
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue