Skip to content

Commit

Permalink
drivers: mf4005_motor: cosmetic style corrections
Browse files Browse the repository at this point in the history
and document better the steps of checking the connection
of the motor

Signed-off-by: Felipe Neves <[email protected]>
  • Loading branch information
uLipe committed Sep 12, 2024
1 parent 78abc1b commit d45d6bb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/lkm_mf4005_motor.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,18 +386,21 @@ static int mf4005_init(const struct device *dev)
}

/* Check motor connection before proceed */
struct can_frame tx_frame = {
struct can_frame tx_frame = {
.flags = 0,
.id = cfg->id,
.dlc = 8,
.data[0] = MF4005_PID_GET_REG,
};

/* Send a reading command to check the bus */
ret = can_send(cfg->can_bus, &tx_frame, K_FOREVER, NULL, NULL);
if(ret < 0) {
LOG_ERR("Failed to access the MF4005 motor: (0x%x)", cfg->id);
return ret;
}

/* Then wait response for the motor */
ret = k_sem_take(&dev_data->can_signal, K_MSEC(500));
if(ret < 0) {
LOG_ERR("Motor: (0x%x) seems to be disconnected", cfg->id);
Expand Down

0 comments on commit d45d6bb

Please sign in to comment.