Skip to content

Commit

Permalink
Merge pull request #29 from xrobot-org/dev
Browse files Browse the repository at this point in the history
RM电机添加ID范围检查
  • Loading branch information
Jiu-xiao authored Jul 31, 2023
2 parents 29820de + 9bad87c commit 13d859f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/device/motor/dev_rm_motor.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include "dev_rm_motor.hpp"

#include <sys/_stdint.h>

#include "bsp_time.h"

/* 电机最大控制输出绝对值 */
Expand Down Expand Up @@ -34,12 +32,15 @@ RMMotor::RMMotor(const Param &param, const char *name)
switch (param.id_control) {
case M3508_M2006_CTRL_ID_BASE:
this->index_ = 0;
ASSERT(param.id_feedback > 0x200 && param.id_feedback <= 0x204);
break;
case M3508_M2006_CTRL_ID_EXTAND:
this->index_ = 1;
ASSERT(param.id_feedback > 0x204 && param.id_feedback <= 0x208);
break;
case GM6020_CTRL_ID_EXTAND:
this->index_ = 2;
ASSERT(param.id_feedback > 0x208 && param.id_feedback <= 0x20B);
break;
default:
ASSERT(false);
Expand Down

0 comments on commit 13d859f

Please sign in to comment.