Skip to content

Commit f32579e

Browse files
authored
Merge pull request #6 from Kamoool/system_settings_change_logic
Added system settings logic and lock session before disconnecting
2 parents 86320fd + 7dcce5b commit f32579e

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

lib/model/serial_port_utils.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ class SerialPortUtils {
3434
}
3535

3636
void disconnect() {
37+
if (SettingsRepository().systemUnlocked) {
38+
lockSession();
39+
}
3740
stopListener = true;
3841
sendString('X');
3942
serialPort.close();

lib/widgets/system_widget.dart

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,20 @@ class _SystemWidgetState extends State<SystemWidget> {
4343
NumericSetting(
4444
setting: SettingsRepository().sensorAboveAdjust,
4545
notifyParent: widget.notifyParent,
46-
minAllowed: ConstantsRepository().sensorAboveNumericMin,
46+
// minAllowed: ConstantsRepository().sensorAboveNumericMin,
47+
minAllowed: (double.tryParse(SettingsRepository().sensorBelowAdjust.value) ??
48+
ConstantsRepository().sensorAboveNumericMin) +
49+
1,
4750
maxAllowed: ConstantsRepository().sensorAboveNumericMax,
4851
step: ConstantsRepository().sensorAboveNumericStep),
4952
NumericSetting(
5053
setting: SettingsRepository().sensorBelowAdjust,
5154
notifyParent: widget.notifyParent,
5255
minAllowed: ConstantsRepository().sensorBelowNumericMin,
53-
maxAllowed: ConstantsRepository().sensorBelowNumericMax,
56+
// maxAllowed: ConstantsRepository().sensorBelowNumericMax,
57+
maxAllowed: (double.tryParse(SettingsRepository().sensorAboveAdjust.value) ??
58+
ConstantsRepository().sensorBelowNumericMax) -
59+
1,
5460
step: ConstantsRepository().sensorBelowNumericStep),
5561
],
5662
),

0 commit comments

Comments
 (0)