[tuxdroid-svn] r834 - in firmware: tuxcore/trunk tuxdefs
Status: Beta
Brought to you by:
ks156
From: jaguarondi <c2m...@c2...> - 2008-01-07 16:03:40
|
Author: jaguarondi Date: 2008-01-07 17:03:39 +0100 (Mon, 07 Jan 2008) New Revision: 834 Modified: firmware/tuxcore/trunk/parser.c firmware/tuxdefs/commands.h firmware/tuxdefs/config.h Log: * Disabled the LED standalone actions (i.e. blink when pressing the head button) if an LED command is ongoing, otherwise it is stopped. Modified: firmware/tuxcore/trunk/parser.c =================================================================== --- firmware/tuxcore/trunk/parser.c 2008-01-07 11:57:28 UTC (rev 833) +++ firmware/tuxcore/trunk/parser.c 2008-01-07 16:03:39 UTC (rev 834) @@ -147,7 +147,7 @@ } else if (command[0] == LED_SET_CMD) { - led_set_intensity(command[1], command[2]); + led_set_intensity(command[1], command[2]); } else if (command[0] == IR_SEND_RC5_CMD) { @@ -208,6 +208,8 @@ } /* Deprecated functions, may be removed in firmware v0.5. */ + /* The first 3 can be kept for the standalone as they're simpler than the + * other LED functions. */ else if (command[0] == LED_ON_CMD) { led_set_intensity(LED_BOTH, 0xFF); @@ -216,6 +218,17 @@ { led_set_intensity(LED_BOTH, 0x0); } + else if (command[0] == LED_TOGGLE_CMD) + { + /* Only toggle from the standalone if no computer commands are already + * driving the LEDs. */ + if (!(left_led.status.fading || left_led.status.pulsing \ + || right_led.status.fading || right_led.status.pulsing)) + { + led_set_fade_speed(LED_BOTH, 1, 10); + led_pulse(LED_BOTH, command[1], command[2]); + } + } else if (command[0] == LED_L_ON_CMD) { led_set_intensity(LED_LEFT, 0xFF); @@ -232,10 +245,6 @@ { led_set_intensity(LED_RIGHT, 0x0); } - else if (command[0] == 0x9A) /* old pulse function */ - { - led_pulse(3, command[1], command[2]); - } /* Undefined commands */ else Modified: firmware/tuxdefs/commands.h =================================================================== --- firmware/tuxdefs/commands.h 2008-01-07 11:57:28 UTC (rev 833) +++ firmware/tuxdefs/commands.h 2008-01-07 16:03:39 UTC (rev 834) @@ -83,6 +83,7 @@ #define LED_ON_CMD 0x1A /* Turn all LEDs on */ #define LED_OFF_CMD 0x1B /* Turn all LEDs off */ +#define LED_TOGGLE_CMD 0x9A /* Turn all LEDs off */ #define LED_L_ON_CMD 0x1C /* Turn left LED on */ #define LED_L_OFF_CMD 0x1D /* Turn left LED off */ #define LED_R_ON_CMD 0x1E /* Turn right LED on */ Modified: firmware/tuxdefs/config.h =================================================================== --- firmware/tuxdefs/config.h 2008-01-07 11:57:28 UTC (rev 833) +++ firmware/tuxdefs/config.h 2008-01-07 16:03:39 UTC (rev 834) @@ -49,29 +49,26 @@ /* Head button event */ #define HEAD_E_SEQ {\ - 0, LED_FADE_SPEED_CMD, 3, 1, 10, \ - 0, LED_PULSE_CMD, 3, 2, 30, /* Pulse LEDs once */\ + 0, LED_TOGGLE_CMD, 2, 30, 0, /* Pulse LEDs once */\ END_OF_ACTIONS\ } /* Left flipper button event */ #define LEFT_FLIP_E_SEQ {\ - 0, LED_FADE_SPEED_CMD, 3, 1, 10, \ - 0, LED_PULSE_CMD, 3, 2, 30, /* Pulse LEDs once */\ + 0, LED_TOGGLE_CMD, 2, 30, 0, /* Pulse LEDs once */\ END_OF_ACTIONS\ } /* Right flipper event */ #define RIGHT_FLIP_E_SEQ {\ - 0, LED_FADE_SPEED_CMD, 3, 1, 10, \ - 0, LED_PULSE_CMD, 3, 2, 30, /* Pulse LEDs once */\ + 0, LED_TOGGLE_CMD, 2, 30, 0, /* Pulse LEDs once */\ END_OF_ACTIONS\ } /* Start charging event */ #define CHARGER_START_E_SEQ {\ 0, MOVE_MOUTH_CMD, 2, 0, 0, /* move the mouth */\ - 0, LED_PULSE_CMD, 3, 4, 50, /* Pulse LEDs twice */\ + 0, LED_TOGGLE_CMD, 4, 50, 0, /* Pulse LEDs twice */\ 0, PLAY_SOUND_CMD, 3, 0, 0, /* play a sound */\ END_OF_ACTIONS\ } @@ -99,13 +96,13 @@ /* RF connection event */ #define RF_CONN_E_SEQ {\ - 0, LED_SET_CMD, LED_BOTH, 0xFF, 0, /* turn on the leds */\ + 0, LED_ON_CMD, 0, 0, 0, /* turn on the leds */\ END_OF_ACTIONS\ } /* RF disconnection event */ #define RF_DISCONN_E_SEQ {\ - 0, LED_SET_CMD, LED_BOTH, 0, 0, /* turn off the leds */\ + 0, LED_OFF_CMD, 0, 0, 0, /* turn off the leds */\ END_OF_ACTIONS\ } |