Skip to content

Commit 4c1bf66

Browse files
committed
Fix issue of act set with pwm
1 parent eb57436 commit 4c1bf66

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/module/syscmd/cmd_act.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,14 @@ static rt_size_t act_device_write(actuator_dev_t act_dev, rt_uint16_t chan_sel,
5757
{
5858
rt_size_t ret = size;
5959

60-
/* Suspend controller output */
61-
mcn_suspend(MCN_HUB(control_output));
62-
6360
if (act_dev->config.protocol == ACT_PROTOCOL_PWM) {
6461
ret = rt_device_write(&act_dev->parent, chan_sel, chan_val, size);
6562
} else if (act_dev->config.protocol == ACT_PROTOCOL_DSHOT) {
6663
printf("Press any key to stop...\n");
64+
65+
/* Suspend controller output */
66+
mcn_suspend(MCN_HUB(control_output));
67+
6768
while (1) {
6869
/* type any key to exit */
6970
if (syscmd_has_input()) {
@@ -80,14 +81,14 @@ static rt_size_t act_device_write(actuator_dev_t act_dev, rt_uint16_t chan_sel,
8081

8182
systime_msleep(10);
8283
}
84+
85+
/* Resume controller output */
86+
mcn_resume(MCN_HUB(control_output));
8387
} else {
8488
/* Unknown protocol */
8589
ret = 0;
8690
}
8791

88-
/* Resume controller output */
89-
mcn_resume(MCN_HUB(control_output));
90-
9192
return ret;
9293
}
9394

0 commit comments

Comments
 (0)