From 1ddce0cdcbc30b9100adf615a083b5623d25fa9d Mon Sep 17 00:00:00 2001 From: uncrustify Date: Thu, 16 Aug 2012 23:22:43 -0700 Subject: [PATCH] uncrustify libraries/PID/examples/pid/pid.pde --- libraries/PID/examples/pid/pid.pde | 118 ++++++++++++++--------------- 1 file changed, 59 insertions(+), 59 deletions(-) diff --git a/libraries/PID/examples/pid/pid.pde b/libraries/PID/examples/pid/pid.pde index 0ec899d489..836de0f7d4 100644 --- a/libraries/PID/examples/pid/pid.pde +++ b/libraries/PID/examples/pid/pid.pde @@ -1,59 +1,59 @@ -/* - Example of PID library. - 2010 Code by Jason Short. DIYDrones.com -*/ - -#include -#include -#include -#include -#include // ArduPilot RC Library -#include // ArduPilot Mega RC Library -#include - -long radio_in; -long radio_trim; - -Arduino_Mega_ISR_Registry isr_registry; - -#if CONFIG_APM_HARDWARE == APM_HARDWARE_APM2 - APM_RC_APM2 APM_RC; -#else - APM_RC_APM1 APM_RC; -#endif - -PID pid; - -void setup() -{ - Serial.begin(38400); - Serial.println("ArduPilot Mega PID library test"); - APM_RC.Init(&isr_registry); // APM Radio initialization - - delay(1000); - //rc.trim(); - radio_trim = APM_RC.InputCh(0); - - pid.kP(1); - pid.kI(0); - pid.kD(0.5); - pid.imax(50); - pid.save_gains(); - pid.kP(0); - pid.kI(0); - pid.kD(0); - pid.imax(0); - pid.load_gains(); - Serial.printf("P %f I %f D %f imax %f\n", pid.kP(), pid.kI(), pid.kD(), pid.imax()); -} - -void loop() -{ - delay(20); - //rc.read_pwm(); - long error = APM_RC.InputCh(0) - radio_trim; - long control = pid.get_pid(error, 1); - - Serial.print("control: "); - Serial.println(control,DEC); -} +/* + * Example of PID library. + * 2010 Code by Jason Short. DIYDrones.com + */ + +#include +#include +#include +#include +#include // ArduPilot RC Library +#include // ArduPilot Mega RC Library +#include + +long radio_in; +long radio_trim; + +Arduino_Mega_ISR_Registry isr_registry; + +#if CONFIG_APM_HARDWARE == APM_HARDWARE_APM2 +APM_RC_APM2 APM_RC; +#else +APM_RC_APM1 APM_RC; +#endif + +PID pid; + +void setup() +{ + Serial.begin(38400); + Serial.println("ArduPilot Mega PID library test"); + APM_RC.Init(&isr_registry); // APM Radio initialization + + delay(1000); + //rc.trim(); + radio_trim = APM_RC.InputCh(0); + + pid.kP(1); + pid.kI(0); + pid.kD(0.5); + pid.imax(50); + pid.save_gains(); + pid.kP(0); + pid.kI(0); + pid.kD(0); + pid.imax(0); + pid.load_gains(); + Serial.printf("P %f I %f D %f imax %f\n", pid.kP(), pid.kI(), pid.kD(), pid.imax()); +} + +void loop() +{ + delay(20); + //rc.read_pwm(); + long error = APM_RC.InputCh(0) - radio_trim; + long control = pid.get_pid(error, 1); + + Serial.print("control: "); + Serial.println(control,DEC); +}