[tuxdroid-svn] r750 - firmware/tuxcore/trunk
Status: Beta
Brought to you by:
ks156
From: jaguarondi <c2m...@c2...> - 2007-12-05 16:15:12
|
Author: jaguarondi Date: 2007-12-05 17:14:55 +0100 (Wed, 05 Dec 2007) New Revision: 750 Modified: firmware/tuxcore/trunk/ir.c firmware/tuxcore/trunk/standalone.c Log: * Added a protection on IR RC5 receiver code so that only codes from kysoh's remote are considered valid. The IR code needs to be refactored so for now I prefer to reject false triggerings rather than try to support usages we don't really need right now. Modified: firmware/tuxcore/trunk/ir.c =================================================================== --- firmware/tuxcore/trunk/ir.c 2007-12-03 16:33:46 UTC (rev 749) +++ firmware/tuxcore/trunk/ir.c 2007-12-05 16:14:55 UTC (rev 750) @@ -164,8 +164,11 @@ } else { - gStatus.ir = irReceivedCode; /* Updates global Status */ - gStatus.ir |= GSTATUS_IR_VALID; /* set valid bit */ + /* Update global status */ + gStatus.ir = ((uint8_t)irReceivedCode & 0x3F); + /* Check if the code comes from our remote control. */ + if ((irReceivedCode & 0x07C0) == 0x0740) + gStatus.ir |= GSTATUS_IR_VALID; /* set valid bit */ if (irReceivedCode & 0x0800) gStatus.ir |= GSTATUS_IR_TOGGLE; /* set toggle bit */ else Modified: firmware/tuxcore/trunk/standalone.c =================================================================== --- firmware/tuxcore/trunk/standalone.c 2007-12-03 16:33:46 UTC (rev 749) +++ firmware/tuxcore/trunk/standalone.c 2007-12-05 16:14:55 UTC (rev 750) @@ -223,7 +223,7 @@ /* IR signal processing */ /* put here things that should be done only once when a button is pushed */ - if (gStatus.ir != ir_oldvalue) + if (gStatus.ir != ir_oldvalue && gStatus.ir & GSTATUS_IR_VALID) { ir_command = gStatus.ir & GSTATUS_IR_COMMAND; ir_toggle = gStatus.ir & GSTATUS_IR_TOGGLE; |