From 4fb5b6db9fab1f2d0c54f45a0ccfa0c6a6033479 Mon Sep 17 00:00:00 2001 From: Atsushi Watanabe Date: Thu, 25 Apr 2019 16:58:54 +0900 Subject: [PATCH] Fix protocol version send target (#106) --- src/param.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/param.c b/src/param.c index 5c0a543..b0b0b88 100644 --- a/src/param.c +++ b/src/param.c @@ -1020,18 +1020,16 @@ int apply_robot_params() // ウォッチドックタイマの設定 for (j = 0; j < YP_PARAM_MAX_MOTOR_NUM; j++) { - if (!g_param.motor_enable[j]) - continue; - parameter_set(PARAM_watch_dog_limit, j, 1200); + if (g_param.motor_enable[j]) + parameter_set(PARAM_watch_dog_limit, j, 1200); } if (g_param_init) { for (j = 0; j < YP_PARAM_MAX_MOTOR_NUM; j++) { - if (!g_param.motor_enable[j]) - continue; - parameter_set(PARAM_w_ref, j, 0); + if (g_param.motor_enable[j]) + parameter_set(PARAM_w_ref, j, 0); } g_param_init = 0; } @@ -1040,7 +1038,11 @@ int apply_robot_params() { int version, age; sscanf(YP_PROTOCOL_NAME, "YPP:%d:%d", &version, &age); - parameter_set(PARAM_protocol_version, 0, version); + for (j = 0; j < YP_PARAM_MAX_MOTOR_NUM; j++) + { + if (g_param.motor_enable[j]) + parameter_set(PARAM_protocol_version, j, version); + } } /* モータのパラメータ */