Fixed timeout. Now it is usable for other input methods than nunchuck.

Cosmetical cleanup in motor-test.
This commit is contained in:
larsm 2019-06-01 16:17:48 +02:00
parent ffda2219f1
commit 3e2cfe973a
2 changed files with 5 additions and 7 deletions

View File

@ -105,8 +105,6 @@ void Nunchuck_Read() {
HAL_Delay(5);
if (HAL_I2C_Master_Receive(&hi2c2,0xA4,(uint8_t*)nunchuck_data, 6, 100) == HAL_OK) {
timeout = 0;
} else {
timeout++;
}
if (timeout > 3) {

View File

@ -226,11 +226,10 @@ int main(void) {
#endif
#ifdef CONTROL_MOTOR_TEST
// if (main_loop_counter % 2 == 0) {
if (motor_test_direction == 1) cmd2 += 1;
else cmd2 -= 1;
if (abs(cmd2) > CONTROL_MOTOR_TEST_MAX_SPEED) motor_test_direction = -motor_test_direction;
// }
timeout = 0;
#endif
@ -327,6 +326,7 @@ int main(void) {
}
main_loop_counter += 1;
timeout++;
}
}