summaryrefslogtreecommitdiff
path: root/n/line-follower/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'n/line-follower/src/main.c')
-rw-r--r--n/line-follower/src/main.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/n/line-follower/src/main.c b/n/line-follower/src/main.c
index 96c4629..1b7e857 100644
--- a/n/line-follower/src/main.c
+++ b/n/line-follower/src/main.c
@@ -53,6 +53,10 @@ uint8_t motor_stat_speed, motor_stat_speed_cpt;
/** Statistics about pwm values. */
uint8_t motor_stat_pwm, motor_stat_pwm_cpt;
+/** Statistics about pid components. */
+uint8_t motor_stat_pid, motor_stat_pid_cpt;
+int16_t pid_pid,pid_p,pid_i,pid_d
+
/** Report of timer. */
uint8_t motor_stat_timer, motor_stat_timer_cpt;
@@ -123,9 +127,6 @@ main_loop (void)
case 4:
delay_ms (5L);
linesensor_print ();
- default:
- motor_mode = motor_mode; // j'ai pas trouvé comment faire
- // autrement...
}
motor_timer_1 = timer_read ();
/* Pwm setup. */
@@ -141,6 +142,17 @@ main_loop (void)
speed_right_int >> 8, speed_right_int);
motor_stat_speed_cpt = motor_stat_speed;
}
+ // displays stats concerning pid components
+ if (motor_stat_pid && !--motor_stat_pid_cpt)
+ {
+ proto_send4 ('C',
+ pid_pid >> 8, pid_pid,
+ pid_p >> 8, pid_p);
+ proto_send4 ('.',
+ pid_i >> 8, pid_i,
+ pid_d >> 8, pid_d);
+ motor_stat_pid_cpt = motor_stat_pid;
+ }
if (motor_stat_pwm && !--motor_stat_pwm_cpt)
{
proto_send4 ('W',
@@ -248,6 +260,9 @@ proto_callback (uint8_t cmd, uint8_t argc, proto_arg_t argv[])
motor_stat_speed_cpt = motor_stat_speed = argv[0];
motor_stat_pwm_cpt = motor_stat_pwm = argv[0];
break;
+ case c ('C', 1):
+ motor_stat_pid_cpt = motor_stat_pid = argv[0];
+ break;
case c ('c', 1):
motor_stat_counter_cpt = motor_stat_counter = argv[0];
break;