[tuxdroid-svn] r1128 - firmware/tuxcore/trunk
Status: Beta
Brought to you by:
ks156
From: jaguarondi <c2m...@c2...> - 2008-05-07 10:45:54
|
Author: jaguarondi Date: 2008-05-07 12:45:54 +0200 (Wed, 07 May 2008) New Revision: 1128 Modified: firmware/tuxcore/trunk/communication.c firmware/tuxcore/trunk/communication.h firmware/tuxcore/trunk/main.c Log: * Moved the pong function so that they are sent as fast as possible, not one every 100ms anymore. This should point more communication problems in this worst case. Modified: firmware/tuxcore/trunk/communication.c =================================================================== --- firmware/tuxcore/trunk/communication.c 2008-05-07 10:44:53 UTC (rev 1127) +++ firmware/tuxcore/trunk/communication.c 2008-05-07 10:45:54 UTC (rev 1128) @@ -171,6 +171,11 @@ (i2c_get_status() == I2C_BUSY)); } +bool cmds_empty(void) +{ + return !FifoLength(statusFifo); +} + /** * I2C communication initialization * Modified: firmware/tuxcore/trunk/communication.h =================================================================== --- firmware/tuxcore/trunk/communication.h 2008-05-07 10:44:53 UTC (rev 1127) +++ firmware/tuxcore/trunk/communication.h 2008-05-07 10:45:54 UTC (rev 1128) @@ -47,6 +47,7 @@ uint8_t param3); int8_t send_cmd(uint8_t *status); bool cmds_sent(void); +bool cmds_empty(void); uint8_t fetchCommands(void); #endif /* COMMUNICATION_H */ Modified: firmware/tuxcore/trunk/main.c =================================================================== --- firmware/tuxcore/trunk/main.c 2008-05-07 10:44:53 UTC (rev 1127) +++ firmware/tuxcore/trunk/main.c 2008-05-07 10:45:54 UTC (rev 1128) @@ -199,6 +199,12 @@ updateStatus(); } + /* send pending pongs */ + if (pingCnt && cmds_empty()) + { + pingCnt--; + send_cmd_p(PONG_CMD, pingCnt, 0, 0); + } /* Parse and execute received commands. */ parse_received_cmd(); @@ -282,11 +288,6 @@ } if (gerror) send_cmd_p(GERROR_CMD, TUXCORE_CPU_NUM, gerror, 0); - if (pingCnt) /* send pending pongs */ - { - pingCnt--; - send_cmd_p(PONG_CMD, pingCnt, 0, 0); - } sensorsUpdate |= STATUS_SENT; } |