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.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/n/line-follower/src/main.c b/n/line-follower/src/main.c
index 1b7e857..3e7d84e 100644
--- a/n/line-follower/src/main.c
+++ b/n/line-follower/src/main.c
@@ -42,7 +42,7 @@
* 2 - position control;
* 3 - linefol mode;
* 4 - linefol calibration mode. */
-int8_t motor_mode;
+uint8_t motor_mode;
/** Main loop counter. */
uint8_t motor_loop_cpt;
@@ -87,7 +87,7 @@ int
main (void)
{
DDRD = 0x60;
- pwm_init ();
+ pwm_init (0);
timer_init ();
counter_init ();
speed_init ();
@@ -121,12 +121,17 @@ main_loop (void)
speed_update ();
speed_compute_left_pwm ();
speed_compute_right_pwm ();
+ break;
case 3:
linesensor_poll ();
speed_compute_linefol_pwm ();
+ speed_compute_left_pwm ();
+ speed_compute_right_pwm ();
+ break;
case 4:
delay_ms (5L);
linesensor_print ();
+ break;
}
motor_timer_1 = timer_read ();
/* Pwm setup. */
@@ -223,6 +228,10 @@ proto_callback (uint8_t cmd, uint8_t argc, proto_arg_t argv[])
speed_left_aim = argv[0];
speed_right_aim = argv[1];
break;
+ case c ('L', 0):
+ motor_mode = 4;
+ linesensor_reset ();
+ break;
case c ('l', 0):
motor_mode = 3;
linesensor_reset ();
@@ -272,6 +281,9 @@ proto_callback (uint8_t cmd, uint8_t argc, proto_arg_t argv[])
case c ('T', 1):
motor_stat_postrack_cpt = motor_stat_postrack = argv[0];
break;
+ case c ('P', 1):
+ pwm_init (argv[0]);
+ break;
default:
proto_send0 ('e');
return;