[tuxdroid-svn] r1191 - firmware/tuxcore/trunk
Status: Beta
Brought to you by:
ks156
From: Paul_R <c2m...@c2...> - 2008-05-22 14:00:42
|
Author: Paul_R Date: 2008-05-22 16:00:43 +0200 (Thu, 22 May 2008) New Revision: 1191 Modified: firmware/tuxcore/trunk/global.h firmware/tuxcore/trunk/main.c firmware/tuxcore/trunk/motors.c Log: * Added the motor state status : Status_Position2 frame, last byte. - xxxxxxx1 : Spin left on - xxxxxx1x : Spin right on - xxxxx1xx : Eyes on - xxxx1xxx : Mouth on - xxx1xxxx : Wings on Modified: firmware/tuxcore/trunk/global.h =================================================================== --- firmware/tuxcore/trunk/global.h 2008-05-22 13:40:54 UTC (rev 1190) +++ firmware/tuxcore/trunk/global.h 2008-05-22 14:00:43 UTC (rev 1191) @@ -103,19 +103,23 @@ * gStatus.mot: Motors Status */ -/* gStatus.mot:[0] Spin motor - * xxxxxxx0 === Spin off - * xxxxxxx1 === Spin on */ -#define GSTATUS_MOT_SPIN 0x01 -/* gStatus.mot:[1] Eyes/Mouth motor - * xxxxxx0x === motor off - * xxxxxx1x === motor on */ -#define GSTATUS_MOT_EYES 0x02 -#define GSTATUS_MOT_MOUTH 0x02 -/* gStatus.mot:[2] Wings motor - * xxxxx0xx === Wings off - * xxxxx1xx === Wings on */ -#define GSTATUS_MOT_WINGS 0x04 +/* gStatus.mot:[0:1] Spin motor + * xxxxxx00 === Spin off + * xxxxxx01 === Spin right on + * xxxxxx10 === Spin left on + * xxxxxx11 === undef / impossible */ +#define GSTATUS_MOT_SPINL 0x01 +#define GSTATUS_MOT_SPINR 0x02 +#define GSTATUS_MOT_SPIN_MK 0x03 +/* gStatus.mot:[2] Eyes/Mouth motor + * xxxxx0xx === motor off + * xxxxx1xx === motor on */ +#define GSTATUS_MOT_EYES 0x04 +#define GSTATUS_MOT_MOUTH 0x08 +/* gStatus.mot:[3] Wings motor + * xxxx0xxx === Wings off + * xxxx1xxx === Wings on */ +#define GSTATUS_MOT_WINGS 0x10 /* * gStatus.ir: IR Status @@ -166,7 +170,7 @@ uint8_t batteryS; /* Battery level status */ uint8_t ir; /* IR RC5 code received from tux's remote */ uint8_t pos; /* Poitionning */ - uint8_t mot; + uint8_t mot; /* Motors states */ uint8_t audio_play; uint8_t audio_status; } Modified: firmware/tuxcore/trunk/main.c =================================================================== --- firmware/tuxcore/trunk/main.c 2008-05-22 13:40:54 UTC (rev 1190) +++ firmware/tuxcore/trunk/main.c 2008-05-22 14:00:43 UTC (rev 1191) @@ -258,7 +258,8 @@ queue_cmd_p(STATUS_PORTS_CMD, PINB, PINC, PIND); queue_cmd_p(STATUS_POSITION1_CMD, eyes_move_counter, mouth_move_counter, flippers_move_counter); - queue_cmd_p(STATUS_POSITION2_CMD, spin_move_counter, gStatus.pos, 0); + queue_cmd_p(STATUS_POSITION2_CMD, spin_move_counter, gStatus.pos, + gStatus.mot); if (led_f) { led_f = false; Modified: firmware/tuxcore/trunk/motors.c =================================================================== --- firmware/tuxcore/trunk/motors.c 2008-05-22 13:40:54 UTC (rev 1190) +++ firmware/tuxcore/trunk/motors.c 2008-05-22 14:00:43 UTC (rev 1191) @@ -820,7 +820,7 @@ */ void stop_spinning(void) { - gStatus.mot &= ~GSTATUS_MOT_SPIN; + gStatus.mot &= ~GSTATUS_MOT_SPIN_MK; spin_move_counter = 0; stop_spin_motor(); } @@ -833,7 +833,7 @@ */ void spin_left(uint8_t const angle, uint8_t const pwm) { - gStatus.mot |= GSTATUS_MOT_SPIN; + gStatus.mot |= GSTATUS_MOT_SPINL; spin_move_counter = angle; /* If the rotation direction is changing and we are not stopped exactly on * the switch (position switch not pressed), we need to increment the angle @@ -857,7 +857,7 @@ */ void spin_right(uint8_t const angle, uint8_t const pwm) { - gStatus.mot |= GSTATUS_MOT_SPIN; + gStatus.mot |= GSTATUS_MOT_SPINR; spin_move_counter = angle; /* If the rotation direction is changing and we are not stopped exactly on * the switch (position switch not pressed), we need to increment the angle |