From e1f77422ec8bfbcf89031d1b1e1d007c2c99f865 Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Sat, 25 Aug 2012 09:19:29 +0200 Subject: [PATCH] Move shared PI global variable into the proper module. Signed-off-by: Richard Cochran --- pi.c | 4 ++-- pi.h | 12 ++++++++++++ ptp4l.c | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/pi.c b/pi.c index 33766b1..6917899 100644 --- a/pi.c +++ b/pi.c @@ -29,8 +29,8 @@ #define SWTS_KI 0.001 /* These two take their values from the configuration file. (see ptp4l.c) */ -extern double configured_pi_kp; -extern double configured_pi_ki; +double configured_pi_kp; +double configured_pi_ki; struct pi_servo { struct servo servo; diff --git a/pi.h b/pi.h index aa2bd85..e1babd3 100644 --- a/pi.h +++ b/pi.h @@ -21,6 +21,18 @@ #include "servo.h" +/** + * When set to a non-zero value, this variable determines the + * proportional constant for the PI controller. + */ +extern double configured_pi_kp; + +/** + * When set to a non-zero value, this variable determines the + * integral constant for the PI controller. + */ +extern double configured_pi_ki; + struct servo *pi_servo_create(int max_ppb, int sw_ts); #endif diff --git a/ptp4l.c b/ptp4l.c index a695164..6986aef 100644 --- a/ptp4l.c +++ b/ptp4l.c @@ -24,13 +24,13 @@ #include "clock.h" #include "config.h" +#include "pi.h" #include "print.h" #include "sk.h" #include "transport.h" #include "util.h" int assume_two_step; -double configured_pi_kp, configured_pi_ki; /*see pi.c*/ extern unsigned char ptp_dst_mac[]; /*see raw.c*/ extern unsigned char p2p_dst_mac[]; /*see raw.c*/