にいむら にいむら
/
mainboardnrp2018
unkounko
Diff: Output/Motor/Motor.cpp
- Revision:
- 8:cb53beff4bb2
- Parent:
- 1:e73cf2469f83
diff -r f4252ddc480d -r cb53beff4bb2 Output/Motor/Motor.cpp --- a/Output/Motor/Motor.cpp Sat Jan 27 05:29:03 2018 +0000 +++ b/Output/Motor/Motor.cpp Sat Feb 24 07:32:11 2018 +0000 @@ -33,12 +33,12 @@ void Motor::Initialize(void) { //Port Initialize - for(uint8_t i = 0; i < MOUNTING_MOTOR_NUM * 2; i++) { + for(uint8_t i = MOTOR_START_NUM; i < MOUNTING_MOTOR_NUM * 2; i++) { directions[i] = 0; } //Pwm Initialize - for(uint8_t i = 0; i < MOUNTING_MOTOR_NUM; i++) { + for(uint8_t i = MOTOR_START_NUM; i < MOUNTING_MOTOR_NUM; i++) { pwms[i].period_us(50); //20kHz pwms[i] = 0.0; } @@ -47,20 +47,20 @@ } void Motor::SetDefault(void) { - for(uint8_t i = 0; i < MOUNTING_MOTOR_NUM; i++) { + for(uint8_t i = MOTOR_START_NUM; i < MOUNTING_MOTOR_NUM; i++) { motor[i].dir = FREE; motor[i].pwm = 0; } } void Motor::Update(MotorStatus *status) { - for(uint8_t i = 0; i < MOUNTING_MOTOR_NUM; i++) motor[i] = status[i]; + for(uint8_t i = MOTOR_START_NUM; i < MOUNTING_MOTOR_NUM; i++) motor[i] = status[i]; //PWM Update - for(uint8_t i = 0; i < MOUNTING_MOTOR_NUM; i++) pwms[i] = percentage_to_ratio(motor[i].pwm); + for(uint8_t i = MOTOR_START_NUM; i < MOUNTING_MOTOR_NUM; i++) pwms[i] = percentage_to_ratio(motor[i].pwm); //Port Update - for(uint8_t i = 0; i < MOUNTING_MOTOR_NUM; i++) { + for(uint8_t i = MOTOR_START_NUM; i < MOUNTING_MOTOR_NUM; i++) { directions[i * 2] = motor[i].d1; directions[i * 2 + 1] = motor[i].d2; }