1
0
mirror of https://github.com/oliexdev/openScale.git synced 2025-08-06 16:56:55 +02:00

change stop machine state order

This commit is contained in:
oliexdev
2019-01-23 18:41:22 +01:00
parent 092e3ba526
commit a593ad1e18

View File

@@ -176,9 +176,9 @@ public class BluetoothBeurerSanitas extends BluetoothCommunication {
setNotificationOn(CUSTOM_CHARACTERISTIC_WEIGHT);
break;
case 1:
stopMachineState();
// Say "Hello" to the scale and wait for ack
sendAlternativeStartCode(ID_START_NIBBLE_INIT, (byte) 0x01);
stopMachineState();
break;
case 2:
// Update time on the scale (no ack)
@@ -186,14 +186,14 @@ public class BluetoothBeurerSanitas extends BluetoothCommunication {
sendAlternativeStartCode(ID_START_NIBBLE_SET_TIME, Converters.toInt32Be(unixTime));
break;
case 3:
stopMachineState();
// Request scale status and wait for ack
sendCommand(CMD_SCALE_STATUS, encodeUserId(null));
stopMachineState();
break;
case 4:
stopMachineState();
// Request list of all users and wait until all have been received
sendCommand(CMD_USER_LIST);
stopMachineState();
break;
case 5:
// If currentRemoteUser is null, indexOf returns -1 and index will be 0
@@ -210,12 +210,12 @@ public class BluetoothBeurerSanitas extends BluetoothCommunication {
// Fetch saved measurements
if (currentRemoteUser != null) {
Timber.d("Request saved measurements for %s", currentRemoteUser.name);
sendCommand(CMD_GET_SAVED_MEASUREMENTS, encodeUserId(currentRemoteUser));
// Return to this state until all users have been processed
repeatMachineStateStep();
stopMachineState();
Timber.d("Request saved measurements for %s", currentRemoteUser.name);
sendCommand(CMD_GET_SAVED_MEASUREMENTS, encodeUserId(currentRemoteUser));
} else {
nextMachineStateStep();
}