]> rtime.felk.cvut.cz Git - eurobot/public.git/commitdiff
lift: tuning main function
authorJiri Kubias <jiri.kubias@gmail.com>
Fri, 10 Apr 2009 13:31:16 +0000 (15:31 +0200)
committerJiri Kubias <jiri.kubias@gmail.com>
Fri, 10 Apr 2009 13:31:16 +0000 (15:31 +0200)
src/eb_vytah_09/main.c

index 0d65575370dae37966d3cc2aeb0f38b1d6660873..342371bb1d0b2906fa65adde39defd7969876ee0 100644 (file)
@@ -110,8 +110,6 @@ void timer0_irq() {
                cnt1khz = 0;
                ++timer_msec;
        }
-
-       deb_led_change(LEDG);
        
        /* int acknowledge */
        VICVectAddr = 0;
@@ -307,19 +305,30 @@ int main(void){
        
        
        uint32_t main_time = timer_usec;
+       uint32_t led_time = timer_msec;
        
        while(1){
-               run_fsm(&fsm_lift);
-               run_fsm(&fsm_pusher);
+       
+               if(timer_usec >= main_time + 10)
+               {
+                   main_time = timer_usec;  
+                   run_fsm(&fsm_lift);
+                   run_fsm(&fsm_pusher);
+                   
+               
+               }
+               
                if(get_timer_msec() >= lst_CAN_time + 100){     //repeat sending message every 100 ms
                        lst_CAN_time = get_timer_msec();                //save new time, when message was sent
                        //send CAN msg
                }
                
-               deb_led_change(LEDG);
+               if(timer_msec >= led_time + 500)        
+               {
+                   led_time = timer_msec;
+                   deb_led_change(LEDG);
+               }
                
-               main_time = timer_usec;
-               while((main_time + 100) >= timer_usec);