stock mbed AnalogReads current loop closed and working

Dependencies:   mbed

Fork of priustroller by Bayley Wang

Revision:
36:11766b5da6ed
Parent:
33:e7b132029bae
--- a/context.cpp	Mon Mar 16 15:40:07 2015 +0000
+++ b/context.cpp	Thu Apr 16 04:08:47 2015 +0000
@@ -45,10 +45,11 @@
     _qpidmin = pidmin;
 }
 
-void Context::ConfigureThrottle(PinName throttle_pin, float min, float max) {
+void Context::ConfigureThrottle(PinName throttle_pin, float min, float max, float th_filter_strength) {
     _throttle_pin = throttle_pin;
     _min = min;
     _max = max;
+    _th_filter_strength = th_filter_strength;
 }
 
 void Context::ConfigurePositionSensor(PinName pos_a_pin, PinName pos_b_pin, float cal1_a, float cal2_a, float cal1_b, float cal2_b, float offset) {
@@ -108,6 +109,8 @@
     reference = new SynchronousReferenceSynthesizer(_max_current);
     filter_d = new MeanFilter(_filter_strength);
     filter_q = new MeanFilter(_filter_strength);
+    filter_th = new MeanFilter(_th_filter_strength);
+    
     
     serial = new Serial(USBTX, USBRX);
     serial->baud(115200);