temp repo

Dependencies:   mbed

Fork of priustroller_2 by N K

Revision:
33:e7b132029bae
Parent:
30:2b6d426f3bfc
--- a/core/motor.cpp	Mon Mar 16 02:43:19 2015 +0000
+++ b/core/motor.cpp	Mon Mar 16 03:09:48 2015 +0000
@@ -2,19 +2,19 @@
 #include "core.h"
 #include "sensors.h"
 
-Motor::Motor(PositionSensor *sense_p, TempSensor *sense_t) {
+Motor::Motor(CurrentSensor *sense_c, CurrentSensor *sense_b, PositionSensor *sense_p, TempSensor *sense_t) {
+    _sense_c = sense_c;
+    _sense_b = sense_b;
     _sense_p = sense_p;
     _sense_t = sense_t;
 }
 
 float Motor::GetCurrentC() {
-    float x = (float) global_ic / 4095.0f;
-    return (x - _ic_zero) / _scale;
+    return _sense_c->GetCurrent();
 }
 
 float Motor::GetCurrentB() {
-    float x = (float) global_ib / 4095.0f;
-    return (x - _ib_zero) / _scale;
+    return _sense_b->GetCurrent();
 }
 
 float Motor::GetPosition() {
@@ -28,10 +28,4 @@
 void Motor::Config(int num_poles, float kv) {
     _num_poles = num_poles;
     _kv = kv;
-}
-
-void Motor::InitSensors(float ib_zero, float ic_zero, float scale) {
-    _ib_zero = ib_zero;
-    _ic_zero = ic_zero;
-    _scale = scale;
 }
\ No newline at end of file