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