|
|
@@ -118,6 +118,51 @@ void main() {
|
|
|
expect(stopped.shotTimer, 25);
|
|
|
});
|
|
|
|
|
|
+ test('keeps the shtmx cutoff duration when the release line follows', () {
|
|
|
+ // V10 simulation, shtmx 2 with a 4 s shot signal.
|
|
|
+ var state = MachineState();
|
|
|
+ for (final line in [
|
|
|
+ 'sht 4 4823 OK', // stray line before the start
|
|
|
+ 'sht 4 0 OK',
|
|
|
+ 'sht 6 2001 OK', // cutoff
|
|
|
+ 'sht 8 3971 OK', // signal released
|
|
|
+ ]) {
|
|
|
+ state = MeCoffeeProtocol.parse(line, state);
|
|
|
+ if (line == 'sht 4 4823 OK') {
|
|
|
+ expect(state.isBrewing, isFalse);
|
|
|
+ expect(state.shotTimer, 0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ expect(state.isBrewing, isFalse);
|
|
|
+ expect(state.shotTimer, 2);
|
|
|
+ });
|
|
|
+
|
|
|
+ test('treats pid 65535 0 0 0 as the steam marker, not full power', () {
|
|
|
+ final heating = MachineState(heatingPower: 0.3, isHeating: true);
|
|
|
+ final steaming = MeCoffeeProtocol.parse('pid 65535 0 0 0 OK', heating);
|
|
|
+
|
|
|
+ expect(steaming.isSteaming, isTrue);
|
|
|
+ expect(steaming.isHeating, isTrue);
|
|
|
+ expect(steaming.heatingPower, 0);
|
|
|
+
|
|
|
+ final released = MeCoffeeProtocol.parse('pid 0 0 0 0 OK', steaming);
|
|
|
+ expect(released.isSteaming, isFalse);
|
|
|
+ expect(released.isHeating, isFalse);
|
|
|
+ expect(released.heatingPower, 0);
|
|
|
+
|
|
|
+ final resumed = MeCoffeeProtocol.parse('pid 2200 1258 0 0 OK', steaming);
|
|
|
+ expect(resumed.isSteaming, isFalse);
|
|
|
+ expect(resumed.heatingPower, closeTo(3458 / 65535, 1e-9));
|
|
|
+ });
|
|
|
+
|
|
|
+ test('V4 three-field pid 65535 0 0 is still full power', () {
|
|
|
+ final state = MeCoffeeProtocol.parse('pid 65535 0 0', MachineState());
|
|
|
+
|
|
|
+ expect(state.isSteaming, isFalse);
|
|
|
+ expect(state.heatingPower, 1.0);
|
|
|
+ });
|
|
|
+
|
|
|
test('parses scaled cmd get values for key-value settings', () {
|
|
|
var state = MachineState();
|
|
|
|