Prof Greg Egan
/
UAVXArm-GKE
UAVX Multicopter Flight Controller.
outputs_conventional.h@0:62a1c91a859a, 2011-02-18 (annotated)
- Committer:
- gke
- Date:
- Fri Feb 18 22:28:05 2011 +0000
- Revision:
- 0:62a1c91a859a
- Child:
- 2:90292f8bd179
First release
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
gke | 0:62a1c91a859a | 1 | // =============================================================================================== |
gke | 0:62a1c91a859a | 2 | // = UAVXArm Quadrocopter Controller = |
gke | 0:62a1c91a859a | 3 | // = Copyright (c) 2008 by Prof. Greg Egan = |
gke | 0:62a1c91a859a | 4 | // = Original V3.15 Copyright (c) 2007 Ing. Wolfgang Mahringer = |
gke | 0:62a1c91a859a | 5 | // = http://code.google.com/p/uavp-mods/ http://uavp.ch = |
gke | 0:62a1c91a859a | 6 | // =============================================================================================== |
gke | 0:62a1c91a859a | 7 | |
gke | 0:62a1c91a859a | 8 | // This is part of UAVXArm. |
gke | 0:62a1c91a859a | 9 | |
gke | 0:62a1c91a859a | 10 | // UAVXArm is free software: you can redistribute it and/or modify it under the terms of the GNU |
gke | 0:62a1c91a859a | 11 | // General Public License as published by the Free Software Foundation, either version 3 of the |
gke | 0:62a1c91a859a | 12 | // License, or (at your option) any later version. |
gke | 0:62a1c91a859a | 13 | |
gke | 0:62a1c91a859a | 14 | // UAVXArm is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without |
gke | 0:62a1c91a859a | 15 | // even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
gke | 0:62a1c91a859a | 16 | // See the GNU General Public License for more details. |
gke | 0:62a1c91a859a | 17 | |
gke | 0:62a1c91a859a | 18 | // You should have received a copy of the GNU General Public License along with this program. |
gke | 0:62a1c91a859a | 19 | // If not, see http://www.gnu.org/licenses/ |
gke | 0:62a1c91a859a | 20 | |
gke | 0:62a1c91a859a | 21 | |
gke | 0:62a1c91a859a | 22 | void OutSignals(void) { |
gke | 0:62a1c91a859a | 23 | static int8 m; |
gke | 0:62a1c91a859a | 24 | static uint8 r; |
gke | 0:62a1c91a859a | 25 | |
gke | 0:62a1c91a859a | 26 | for ( m = 0; m < (uint8)6; m++ ) |
gke | 0:62a1c91a859a | 27 | PWM[m] = Limit(PWM[m], ESCMin, ESCMax); |
gke | 0:62a1c91a859a | 28 | |
gke | 0:62a1c91a859a | 29 | #if !( defined SIMULATE | defined TESTING ) |
gke | 0:62a1c91a859a | 30 | |
gke | 0:62a1c91a859a | 31 | if ( !F.MotorsArmed ) |
gke | 0:62a1c91a859a | 32 | StopMotors(); |
gke | 0:62a1c91a859a | 33 | |
gke | 0:62a1c91a859a | 34 | #ifdef ELEVON |
gke | 0:62a1c91a859a | 35 | Out0.pulsewidth_us(1000 + (int16)( PWM[ThrottleC] * PWMScale ) ); |
gke | 0:62a1c91a859a | 36 | Out1.pulsewidth_us(1000 + (int16)( PWM[RightElevonC] * PWMScale ) ); |
gke | 0:62a1c91a859a | 37 | Out2.pulsewidth_us(1000 + (int16)( PWM[LeftElevonC] * PWMScale ) ); |
gke | 0:62a1c91a859a | 38 | Out3.pulsewidth_us(1000 + (int16)( PWM[RudderC] * PWMScale ) ); |
gke | 0:62a1c91a859a | 39 | #else |
gke | 0:62a1c91a859a | 40 | Out0.pulsewidth_us(1000 + (int16)( PWM[ThrottleC] * PWMScale ) ); |
gke | 0:62a1c91a859a | 41 | Out1.pulsewidth_us(1000 + (int16)( PWM[AileronC] * PWMScale ) ); |
gke | 0:62a1c91a859a | 42 | Out2.pulsewidth_us(1000 + (int16)( PWM[ElevatorC] * PWMScale ) ); |
gke | 0:62a1c91a859a | 43 | Out3.pulsewidth_us(1000 + (int16)( PWM[RudderC] * PWMScale ) ); |
gke | 0:62a1c91a859a | 44 | #endif |
gke | 0:62a1c91a859a | 45 | |
gke | 0:62a1c91a859a | 46 | } // OutSignals |
gke | 0:62a1c91a859a | 47 | |
gke | 0:62a1c91a859a | 48 | |
gke | 0:62a1c91a859a | 49 | |
gke | 0:62a1c91a859a | 50 | |
gke | 0:62a1c91a859a | 51 | |
gke | 0:62a1c91a859a | 52 | |
gke | 0:62a1c91a859a | 53 | |
gke | 0:62a1c91a859a | 54 |