summaryrefslogtreecommitdiff
path: root/digital
diff options
context:
space:
mode:
Diffstat (limited to 'digital')
-rw-r--r--digital/ai/src/twi_master/mimot.c16
-rw-r--r--digital/ai/src/twi_master/mimot.h8
-rw-r--r--digital/io-hub/src/guybrush/bottom_clamp.c2
-rw-r--r--digital/io-hub/src/guybrush/main.c4
-rw-r--r--digital/io-hub/src/guybrush/pressure.c2
-rw-r--r--digital/io-hub/src/robospierre/clamp.c8
-rw-r--r--digital/io-hub/src/robospierre/main.c4
-rw-r--r--digital/mimot/src/dirty/twi_proto.c7
8 files changed, 20 insertions, 31 deletions
diff --git a/digital/ai/src/twi_master/mimot.c b/digital/ai/src/twi_master/mimot.c
index 6663f81f..ff73fdb7 100644
--- a/digital/ai/src/twi_master/mimot.c
+++ b/digital/ai/src/twi_master/mimot.c
@@ -240,21 +240,13 @@ mimot_motor1_clamp (int16_t speed, int16_t pwm)
}
void
-mimot_motor0_free (void)
+mimot_motor_free (uint8_t motor, uint8_t brake)
{
uint8_t *buffer = twi_master_get_buffer (TWI_MASTER_ID_MIMOT);
buffer[0] = 'w';
- buffer[1] = 0;
- twi_master_send_buffer (2);
-}
-
-void
-mimot_motor1_free (void)
-{
- uint8_t *buffer = twi_master_get_buffer (TWI_MASTER_ID_MIMOT);
- buffer[0] = 'w';
- buffer[1] = 1;
- twi_master_send_buffer (2);
+ buffer[1] = motor;
+ buffer[2] = brake;
+ twi_master_send_buffer (3);
}
void
diff --git a/digital/ai/src/twi_master/mimot.h b/digital/ai/src/twi_master/mimot.h
index 78806154..78f0a8c9 100644
--- a/digital/ai/src/twi_master/mimot.h
+++ b/digital/ai/src/twi_master/mimot.h
@@ -111,13 +111,9 @@ mimot_motor0_clamp (int16_t speed, int16_t pwm);
void
mimot_motor1_clamp (int16_t speed, int16_t pwm);
-/** Free motor0. */
+/** Free motor. */
void
-mimot_motor0_free (void);
-
-/** Free motor1. */
-void
-mimot_motor1_free (void);
+mimot_motor_free (uint8_t motor, uint8_t brake);
/** Set raw output for motor. */
void
diff --git a/digital/io-hub/src/guybrush/bottom_clamp.c b/digital/io-hub/src/guybrush/bottom_clamp.c
index a1220acc..122c4e39 100644
--- a/digital/io-hub/src/guybrush/bottom_clamp.c
+++ b/digital/io-hub/src/guybrush/bottom_clamp.c
@@ -599,7 +599,7 @@ FSM_TRANS_TIMEOUT (CLAMP_REARRANGE_CD, TIMEOUT_RECENTRAGE, CLAMP_BOTTOM_CLAMP_HI
}
FSM_TRANS (CLAMP_BOTTOM_CLAMP_HIDE_POS2, lower_clamp_rotation_success, CLAMP_RELEASE_ASSERV)
{
- mimot_motor0_free();
+ mimot_motor_free (0, 1);
return FSM_NEXT (CLAMP_BOTTOM_CLAMP_HIDE_POS2, lower_clamp_rotation_success);
}
diff --git a/digital/io-hub/src/guybrush/main.c b/digital/io-hub/src/guybrush/main.c
index 556be296..68892e3b 100644
--- a/digital/io-hub/src/guybrush/main.c
+++ b/digital/io-hub/src/guybrush/main.c
@@ -287,8 +287,8 @@ main_loop (void)
IO_SET (OUTPUT_DOOR_OPEN);
IO_CLR (OUTPUT_DOOR_CLOSE);
/* Stop motors. */
- mimot_motor0_free ();
- mimot_motor1_free ();
+ mimot_motor_free (0, 0);
+ mimot_motor_free (1, 0);
/* End it and block here indefinitely. */
chrono_end_match (42);
return;
diff --git a/digital/io-hub/src/guybrush/pressure.c b/digital/io-hub/src/guybrush/pressure.c
index 9fa909b0..7e0be308 100644
--- a/digital/io-hub/src/guybrush/pressure.c
+++ b/digital/io-hub/src/guybrush/pressure.c
@@ -119,7 +119,7 @@ pressure_update (void)
if (pressure_get () > pressure.high)
{
/* Done. Stop. Open circuit. */
- mimot_motor1_free ();
+ mimot_motor_free (1, 0);
IO_SET (OUTPUT_PNEUM_OPEN);
pressure.state = PRESSURE_IDLE;
pressure.wait = PRESSURE_REST;
diff --git a/digital/io-hub/src/robospierre/clamp.c b/digital/io-hub/src/robospierre/clamp.c
index 1f8c5072..39ae8dfa 100644
--- a/digital/io-hub/src/robospierre/clamp.c
+++ b/digital/io-hub/src/robospierre/clamp.c
@@ -547,8 +547,8 @@ clamp_blocked (void)
else
logistic_dump (DIRECTION_BACKWARD, 0);
}
- mimot_motor0_free ();
- mimot_motor1_free ();
+ mimot_motor_free (0, 1);
+ mimot_motor_free (1, 1);
/* Signal problem. */
fsm_queue_post_event (FSM_EVENT (AI, clamp_move_failure));
}
@@ -649,8 +649,8 @@ FSM_TRANS (CLAMP_INIT_FINDING_TOP, clamp_elevation_success,
FSM_TRANS (CLAMP_INIT_GOING_REST, clamp_move_success, CLAMP_INIT_READY)
{
- mimot_motor0_free ();
- mimot_motor1_free ();
+ mimot_motor_free (0, 1);
+ mimot_motor_free (1, 1);
return FSM_NEXT (CLAMP_INIT_GOING_REST, clamp_move_success);
}
diff --git a/digital/io-hub/src/robospierre/main.c b/digital/io-hub/src/robospierre/main.c
index f16333c5..e68de49c 100644
--- a/digital/io-hub/src/robospierre/main.c
+++ b/digital/io-hub/src/robospierre/main.c
@@ -340,8 +340,8 @@ proto_callback (uint8_t cmd, uint8_t size, uint8_t *args)
break;
case c ('w', 0):
/* Disable all motor control. */
- mimot_motor0_free ();
- mimot_motor1_free ();
+ mimot_motor_free (0, 0);
+ mimot_motor_free (1, 0);
asserv_free_motor ();
break;
/* Stats commands.
diff --git a/digital/mimot/src/dirty/twi_proto.c b/digital/mimot/src/dirty/twi_proto.c
index 66cdb5aa..2de2b1a1 100644
--- a/digital/mimot/src/dirty/twi_proto.c
+++ b/digital/mimot/src/dirty/twi_proto.c
@@ -156,13 +156,14 @@ twi_proto_callback (u8 *buf, u8 size)
else
buf[0] = 0;
break;
- case c ('w', 1):
+ case c ('w', 2):
/* Free motor.
- * - b: aux index. */
+ * - b: aux index.
+ * - b: brake. */
if (buf[2] < AC_ASSERV_AUX_NB)
{
output_set (&output_aux[buf[2]], 0);
- output_brake (&output_aux[buf[2]], 0);
+ output_brake (&output_aux[buf[2]], buf[3]);
control_state_set_mode (&cs_aux[buf[2]].state, CS_MODE_NONE, 0);
}
else