From: Xavier L. <Ba...@us...> - 2011-04-05 20:40:49
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "krobot". The branch, master has been updated via 09f53a63386e5040989f92aa9ef00498ec72931f (commit) from 1005cb05df3f739bc9c6002e002a5b4eb5956c4a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 09f53a63386e5040989f92aa9ef00498ec72931f Author: Xavier Lagorce <Xav...@cr...> Date: Tue Apr 5 22:39:55 2011 +0200 [Controller_Motor_STM32] Blink LEDs when in HIL simulation mode (+typo) ----------------------------------------------------------------------- Changes: diff --git a/elec/boards/Controller_Motor_STM32/Firmware/controller_motor_stm32/can_monitor.c b/elec/boards/Controller_Motor_STM32/Firmware/controller_motor_stm32/can_monitor.c index 0613ca0..0625ce5 100644 --- a/elec/boards/Controller_Motor_STM32/Firmware/controller_motor_stm32/can_monitor.c +++ b/elec/boards/Controller_Motor_STM32/Firmware/controller_motor_stm32/can_monitor.c @@ -278,7 +278,7 @@ static void NORETURN canMonitorListen_process(void) { odo_setState(&odometry); break; case CAN_MSG_ODOMETRY: - // We should only receiv such message in HIL mode + // We should only receive such message in HIL mode if (mode == ROBOT_MODE_HIL) { odometry_msg.data32[0] = frame.data32[0]; odometry_msg.data32[1] = frame.data32[1]; diff --git a/elec/boards/Controller_Motor_STM32/Firmware/controller_motor_stm32/motor_controller.c b/elec/boards/Controller_Motor_STM32/Firmware/controller_motor_stm32/motor_controller.c index 967a552..4875872 100644 --- a/elec/boards/Controller_Motor_STM32/Firmware/controller_motor_stm32/motor_controller.c +++ b/elec/boards/Controller_Motor_STM32/Firmware/controller_motor_stm32/motor_controller.c @@ -176,6 +176,8 @@ static void NORETURN motorController_process(void) { static void NORETURN motorController_HIL_process(void) { control_params_t *params; Timer timer; + float last_t = 0; + uint8_t led_state = 0; // get data params = (control_params_t *) proc_currentUserData(); @@ -194,6 +196,19 @@ static void NORETURN motorController_HIL_process(void) { } else { timer_add(&timer); + if (last_t >= 1.0) { + if (led_state == 0) { + led_state = 1; + LED3_ON(); + LED4_ON(); + } else { + led_state = 0; + LED3_ON(); + LED4_ON(); + } + last_t -= 1.0; + } + // Compute "state estimation" params->last_estimate[0] = get_output_value(params->reference); params->last_estimate[1] = (params->last_estimate[0] - params->last_output) / params->T; @@ -202,6 +217,7 @@ static void NORETURN motorController_HIL_process(void) { params->last_output = params->last_estimate[0]; } timer_waitEvent(&timer); // Wait for the remaining of the sample period + last_t += params->T; } } hooks/post-receive -- krobot |