]> rtime.felk.cvut.cz Git - eurobot/public.git/commitdiff
motor-control: Fixes
authorMichal Sojka <sojkam1@fel.cvut.cz>
Fri, 10 Apr 2009 09:39:23 +0000 (11:39 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Fri, 10 Apr 2009 09:39:23 +0000 (11:39 +0200)
It seems there is some problem with inline functions.
Also runtime display was commented out as it sometimes triggered without
any reason.

src/motor-control/brushless.c

index 42a2b90040972030058fcdf05e85aea7037e74ab..59733e38000c0a15cc84e9812d4c1bb93ade8ca9 100644 (file)
 #include <canOpenDriver.h>
 #include <can_ids.h>
 
+#define INLINE /* Empty */
+
 /**
  * @addtogroup leds
  * @{
  * @name Motor control (h8eurobot)
  * @{
  */
-/* #define LED_ODO_SEND 0 */
-/* #define LED_CORR_TRIG 1 */
-/* #define LED_MAIN_LOOP 2 */
+/* #define LED_MAIN_LOOP 0 */
+/* #define LED_CORR_TRIG 2 */
+/* #define LED_ODO_SEND 3 */
 #define LED_LIVE   0           /**< D1: Blinks once per second when software is alive */
 #define LED_CAN_REC 1          /**< D2: Blinks when a CAN message is received:
                                 * - 2ms for unknown message
@@ -249,7 +251,7 @@ int cmd_do_mypwm(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
 /**
  * Implementation of help command with watchdog
  */
-static inline char *skip_white(char *p)
+static INLINE char *skip_white(char *p)
 {
   while(isspace((__u8)*p)) p++;
   return p;
@@ -399,7 +401,7 @@ struct odometryData_t
 } oddata[ODOMETRY_TABLE_SIZE];
 
 #if 0
-static inline short sendOdometry()
+static INLINE short sendOdometry()
 {
        static short idxSend=0;
        static short prevIdxRecive=0xff;
@@ -419,7 +421,7 @@ static inline short sendOdometry()
 #endif
 
 
-static inline void blink_odo_send(void)
+static INLINE void blink_odo_send(void)
 {
 #ifdef LED_ODO_SEND
     static bool led;
@@ -433,7 +435,7 @@ static inline void blink_odo_send(void)
  * Sends only pxms_ap. Odometry is calculated elsewhere and since we
  * don't send differences, sequence numbers are not necessary.
  */
-static inline void sendOdometrySimple()
+static INLINE void sendOdometrySimple()
 {
     /* If the variable is static, it is initialized to zero, so we don't have to initialize it all the time again. */
     static Message m;           
@@ -453,7 +455,7 @@ static inline void sendOdometrySimple()
 }
 
 #if 0
-static inline short storeOdometryInTable()
+static INLINE short storeOdometryInTable()
 {
        /*FIXME: add detection of error when idxStore>idxRecive.*/
        oddata[idxStore].dx=x;
@@ -469,7 +471,7 @@ static inline short storeOdometryInTable()
 #endif
 
 
-static inline void blink_err_led(void)
+static INLINE void blink_err_led(void)
 {
 #ifdef LED_ERROR
        static bool err_led = false;
@@ -479,7 +481,7 @@ static inline void blink_err_led(void)
 #endif
 }
 
-static inline void handle_motor_errors() {
+static INLINE void handle_motor_errors() {
     static unsigned last_msg_time=0;
     int i;
     pxmc_state_t *mcs;
@@ -530,7 +532,7 @@ void led_can_rec(unsigned duration_msec)
 #endif
 }
 
-static inline void blink_corr_trig(void)
+static INLINE void blink_corr_trig(void)
 {
 #ifdef LED_CORR_TRIG
        static bool led;
@@ -541,7 +543,7 @@ static inline void blink_corr_trig(void)
 }
 
 
-static inline void handle_can_receive(void) 
+static INLINE void handle_can_receive(void) 
 {
     Message msg_rcv;
 
@@ -584,7 +586,7 @@ static inline void handle_can_receive(void)
     led_can_rec(0);
 }
 
-static inline void handle_odometry_send()
+static INLINE void handle_odometry_send()
 {
 #define ODOMETRY_PERIOD  43
 #define ODOMETRY_TIMEOUT (3*ODOMETRY_PERIOD)
@@ -606,7 +608,7 @@ static inline void handle_odometry_send()
     }
 }
 
-static inline void handle_status_send()
+static INLINE void handle_status_send()
 {
     static unsigned last_send_time=0;
     Message m;
@@ -624,7 +626,7 @@ static inline void handle_status_send()
     }
 }
 
-static inline void blink_main_loop()
+static INLINE void blink_main_loop()
 {
 #ifdef LED_MAIN_LOOP
        static bool led = false;
@@ -635,7 +637,7 @@ static inline void blink_main_loop()
 
 }
 
-static inline void handle_leds()
+static INLINE void handle_leds()
 {
 #define PERIOD 1000
        static unsigned last=0;
@@ -694,7 +696,7 @@ int main()
         if (runtime_display) {
             //printf("c=%d idx=%d\n", test_counter, test_index);
             //printf("ene=%d\n", mcs_left.pxms_ene);
-            printf("rs=%ld as=%ld\n", mcs_left.pxms_rs,  mcs_left.pxms_as);
+            //printf("rs=%ld as=%ld\n", mcs_left.pxms_rs,  mcs_left.pxms_as);
         }
     } while (1);