diff --git a/controller/controller.ino b/controller/controller.ino index e0ee124df9b557a360ee0c4a2147587117e55b03..6498bb2bb42da97a5097a49c8e5105fd09c970a3 100644 --- a/controller/controller.ino +++ b/controller/controller.ino @@ -48,7 +48,7 @@ #define SEN0098_VCC 5 // Supply voltage of the current sensors #define SEN0098_SENSI 40.0 // Chip ACS758LCB-050B-PFF-T #define SEN0098_QUIESCENT_FACTOR 0.5 // Bidirectional chip-> V_IOUTQ = 0.5*VCC -#define SEN0098_OFFSET 0.007 // [FIXME] VERIFY! +#define SEN0098_OFFSET 0.0122 // Manually set so current is 0 when no current #define GEAR_RATIO 0.1 // Gear ratio between motor and wings diff --git a/controller/sensors.ino b/controller/sensors.ino index f206b3daf110ef39f7f5e154b502ffb64f9512e7..12a85f798d882159db382f917b2056191f75e26d 100644 --- a/controller/sensors.ino +++ b/controller/sensors.ino @@ -42,8 +42,8 @@ void GetPsu(byte vol_pin, byte cur_pin, float &vol, float &cur) { float GetCurrent(byte cur_pin) { float volt_raw = (5.0 / 1023.0) * analogRead(cur_pin); - float volt = volt_raw * -gCUR_QOV + SEN0098_OFFSET; // Trimming value to make current equal to 0 when no current - return volt / gCUR_FACT; // Actual current + float volt = volt_raw - gCUR_QOV + SEN0098_OFFSET; // Trimming value to make current equal to 0 when no current + return volt / gCUR_FACT; // Actual current } // Measure the tension provided by the PSU