summaryrefslogtreecommitdiff
path: root/n/asserv/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'n/asserv/src/main.c')
-rw-r--r--n/asserv/src/main.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/n/asserv/src/main.c b/n/asserv/src/main.c
index d437f24..c0da1ec 100644
--- a/n/asserv/src/main.c
+++ b/n/asserv/src/main.c
@@ -52,6 +52,9 @@ uint8_t motor_taz;
/** Main loop counter. */
uint8_t motor_loop_cpt;
+/** Report finish. */
+uint8_t motor_finish_counter = 8, motor_finish_counter_cpt = 8;
+
/** Report of counters. */
uint8_t motor_stat_counter, motor_stat_counter_cpt;
@@ -135,8 +138,6 @@ main_loop (void)
if (motor_mode >= 2)
{
goto_update ();
- if (goto_finish)
- proto_send0 ('F');
}
motor_timer_2 = timer_read ();
/* Speed control. */
@@ -146,6 +147,12 @@ main_loop (void)
/* Pwm setup. */
pwm_update ();
/* Stats. */
+ if (motor_finish_counter && !--motor_finish_counter_cpt)
+ {
+ if (goto_finish == 1)
+ proto_send0 ('F');
+ motor_finish_counter_cpt = motor_finish_counter;
+ }
if (motor_stat_counter && !--motor_stat_counter_cpt)
{
proto_send2w ('C', counter_left, counter_right);
@@ -189,9 +196,7 @@ main_loop (void)
{
if (twi_master_is_finished ())
{
- proto_send5w ('H', motor_sharps[0], motor_sharps[1],
- motor_sharps[2], motor_sharps[3],
- motor_sharps[4]);
+ proto_send ('H', 10, (uint8_t *) motor_sharps);
twi_master_read (0x02, (uint8_t *) motor_sharps, 10);
}
motor_print_sharps_cpt = motor_print_sharps;