/elec/quadcopter

To get this branch, use:
bzr branch http://bzr.ed.am/elec/quadcopter

« back to all changes in this revision

Viewing changes to src/rc-interface/motors.cc

  • Committer: Tim Marston
  • Date: 2014-02-05 22:15:49 UTC
  • Revision ID: tim@ed.am-20140205221549-jmrvij7zyl1cn8j9
stabalised the PPM output on the rc-interface board

Show diffs side-by-side

added added

removed removed

5
5
 
6
6
#include "motors.h"
7
7
#include "config.h"
 
8
#include "common.h"
8
9
#include <Arduino.h>
9
10
#include <limits.h>
10
11
 
73
74
                //      Serial.println( width );
74
75
                // }
75
76
        }
 
77
 
 
78
        // else, if an event is coming up soon, sleep and service the event to make
 
79
        // sure that no other code runs and blocks us!
 
80
        else
 
81
        {
 
82
                long delay = calculate_duration( now, next_event_at );
 
83
                if( delay < 250 )
 
84
                {
 
85
                        if( delay > 20 )
 
86
                                delayMicroseconds( delay - 20 );
 
87
                        update();
 
88
                }
 
89
        }
 
90
        
76
91
}