/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/receiver.cc

  • Committer: dan
  • Date: 2014-02-05 19:30:09 UTC
  • Revision ID: dan-20140205193009-r1fy3n31e4tfilo8
Added Ultra Sonic Prox sensor test prog

Show diffs side-by-side

added added

removed removed

66
66
}
67
67
 
68
68
 
69
 
bool Receiver::read_channels( unsigned long channel_values[] )
 
69
bool Receiver::read_channels( int channel_values[] )
70
70
{
71
71
        static unsigned long last_pulse_down = 0;
72
72
        static int next_channel = 0;
104
104
                        {
105
105
                                // store channel value
106
106
                                int channel = channel_order_[ next_channel ] - 1;
107
 
                                channel_values[ channel ] = duration;
 
107
                                channel_values[ channel ] = MAX_CHANNEL_VALUE *
 
108
                                        ( duration - MIN_PULSE_WIDTH ) /
 
109
                                        ( MAX_PULSE_WIDTH - MIN_PULSE_WIDTH );
108
110
 
109
111
                                // we got a channel
110
112
                                next_channel++;