Skip to content

Commit 8a93d60

Browse files
committed
fix(vendor.dreame): Disable postWriteDelay for manual control commands
1 parent a3bc1aa commit 8a93d60

3 files changed

Lines changed: 10 additions & 5 deletions

File tree

backend/lib/robots/dreame/DreameMiotHelper.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,12 @@ class DreameMiotHelper {
4242
* @param {number} siid
4343
* @param {number} piid
4444
* @param {*} value
45+
* @param {object} [options]
46+
* @param {number|null} [options.postWriteDelay]
4547
* @returns {Promise<void>}
4648
*/
47-
async writeProperty(siid, piid, value) {
49+
async writeProperty(siid, piid, value, options) {
50+
const postWriteDelay = options?.postWriteDelay ?? this.postWriteDelay;
4851
const res = await this.robot.sendCommand("set_properties", [
4952
{
5053
did: this.robot.deviceId,
@@ -59,8 +62,8 @@ class DreameMiotHelper {
5962
throw new RobotFirmwareError("Error code " + res[0].code);
6063
}
6164

62-
if (this.postWriteDelay) {
63-
await sleep(this.postWriteDelay); // Give the firmware some time to think
65+
if (postWriteDelay) {
66+
await sleep(postWriteDelay); // Give the firmware some time to think
6467
}
6568
} else {
6669
throw new Error("Received invalid response");

backend/lib/robots/dreame/capabilities/DreameHighResolutionManualControlCapability.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ class DreameHighResolutionManualControlCapability extends HighResolutionManualCo
115115
spdw: angle,
116116
audio: audioHint === true ? "true" : "false",
117117
random: Math.floor(Math.random() * 1000)
118-
})
118+
}),
119+
{postWriteDelay: null}
119120
);
120121

121122
this.lastCommand = new Date().getTime();

backend/lib/robots/dreame/capabilities/DreameManualControlCapability.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ class DreameManualControlCapability extends ManualControlCapability {
129129
spdw: angle,
130130
audio: audioHint === true ? "true" : "false",
131131
random: Math.floor(Math.random() * 1000)
132-
})
132+
}),
133+
{postWriteDelay: null}
133134
);
134135

135136
this.lastCommand = new Date().getTime();

0 commit comments

Comments
 (0)