fs
Dependents: ARAI45th 3servotest 1stcomp 3rdcompfixstart ... more
Diff: locate.cpp
- Revision:
- 1:3513a2fbd81f
- Parent:
- 0:265d8ad19d2a
- Child:
- 4:ecbb45e84c08
--- a/locate.cpp Fri Sep 02 12:40:36 2016 +0000 +++ b/locate.cpp Sat Sep 03 10:53:09 2016 +0000 @@ -24,6 +24,11 @@ /*************変数宣言終了******************/ + + + + + void update () //位置情報を更新する。r,lはエンコーダから { @@ -33,7 +38,7 @@ dir2 = __HAL_TIM_IS_TIM_COUNTING_DOWN(&timer2); r = -convert_enc_count(count1, dir1); - l = convert_enc_count(count2, dir2); + l = -convert_enc_count(count2, dir2); theta = (r - l) * ROUND - d_theta; v = (r - pr + l - pl); @@ -60,12 +65,12 @@ EncoderInit(&encoder2, &timer2, TIM2, 0xffff, TIM_ENCODERMODE_TI12); } -short coordinateX() +int coordinateX() { return x * LOCATE_STEP / 2; } -short coordinateY() +int coordinateY() { return y * LOCATE_STEP / 2; }