Rev 44 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 44 | Rev 47 | ||
|---|---|---|---|
| Line 81... | Line 81... | ||
| 81 | } |
81 | } |
| 82 | } |
82 | } |
| 83 | push_pos[0] =sw_newstate[0]; |
83 | push_pos[0] =sw_newstate[0]; |
| 84 | push_pos[1] =sw_newstate[1]; |
84 | push_pos[1] =sw_newstate[1]; |
| 85 | 85 | ||
| 86 | int cnt0 = __HAL_TIM_GET_COUNTER(&htim9) >> 1; // counts 2 per step |
86 | int cnt0 = __HAL_TIM_GET_COUNTER(&htim9) >> 2; // counts 4 per step |
| 87 | int cnt1 = __HAL_TIM_GET_COUNTER(&htim3) >> 1; // counts 2 per step |
87 | int cnt1 = __HAL_TIM_GET_COUNTER(&htim3) >> 2; // counts 4 per step |
| 88 | 88 | ||
| 89 | // always count up, or count down to zero but dont wrap |
89 | // always count up, or count down to zero but dont wrap |
| 90 | 90 | ||
| 91 | if ((dial_pos[0] != 0) || (cnt0 > dial_count[0])) |
91 | if ((dial_pos[0] != 0) || (cnt0 > dial_count[0])) |
| 92 | dial_pos[0] += cnt0 - dial_count[0]; |
92 | dial_pos[0] += cnt0 - dial_count[0]; |