stock mbed AnalogReads current loop closed and working

Dependencies:   mbed

Fork of priustroller_2 by N K

Revision:
49:0603121a0538
Parent:
48:28edb4c5c04b
Child:
50:16b43e8fe04f
--- a/main.cpp	Fri Apr 17 05:19:21 2015 +0000
+++ b/main.cpp	Tue Apr 21 03:52:08 2015 +0000
@@ -8,27 +8,18 @@
 #include "callbacks.h"
 
 int main() { 
-    Context *context = new Context(false);
+    Context *context = new Context();
     context->ConfigureOutputs(D13, D3, D6, D2);
-    context->ConfigureCurrentSensors(A1, A2, 0.01f, 0.7f);
-    context->ConfigureIdPidController(0.00001f, 0.0f, 0.0f, 1.0f, -1.0f);
-    context->ConfigureIqPidController(0.00001f, 0.0f, 0.0f, 1.0f, -1.0f);
+    context->ConfigureCurrentSensors(A1, A2, 0.0016f, 0.7f); //scale in V/A, filter strength
+    context->ConfigureIdPidController(0.0001f, 0.0f, 0.0f, 1.0f, -1.0f);
+    context->ConfigureIqPidController(0.0001f, 0.0f, 0.0f, 1.0f, -1.0f);
     context->ConfigureThrottle(A0, 0.9f, 2.5f, 0.8f);  //last term is LPF strength
     context->ConfigurePositionSensor(A3, A4, 0.366f, 0.655f, 0.355f, 0.626f, 205.0f);
-    context->ConfigureReference(80.0f);  // max phase current
-    //context->ConfigureDebugger(2, 4000);
-    context->Start();
-    for (;;) {
-        fast_test2(context);
-        wait_us(500);
-        slow(context);
-    }
-    /*
+    context->ConfigureReference(20.0f);  // max phase current
+    context->ConfigureDebugger(1, 2000);
     context->AttachCallBack(&fast, 5000);
-    context->AttachCallBack(&fast_test, 5000);
-    context->AttachCallBack(&slow, 20);
+    context->AttachCallBack(&slow, 10);
     context->AttachCallBack(&debug, 10);
     context->AttachCallBack(&log, 500);
     context->Start();
-    */
 }