aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2018-08-08 19:12:19 +0300
committerShlomo Hecht <shlomo@twine-s.com>2018-08-08 19:12:19 +0300
commit535b90dc450d521e9567dbed050e411f91efdc50 (patch)
treecdbf90f38f117411d096473bc57d4b1c64e2852b /Software/Embedded_SW
parentf1540db9b9b8d080f73404a290671979991ed91b (diff)
downloadTango-535b90dc450d521e9567dbed050e411f91efdc50.tar.gz
Tango-535b90dc450d521e9567dbed050e411f91efdc50.zip
fixes to the pressure calculation
Diffstat (limited to 'Software/Embedded_SW')
-rw-r--r--Software/Embedded_SW/Embedded/Modules/IDS/IDS_init.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_init.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_init.c
index 6312c701e..1efce00e3 100644
--- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_init.c
+++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_init.c
@@ -35,9 +35,9 @@ void Calculateinit (void)
Bits_0Pascal = Vlow * 4096 / 3; // Vlow * 4096bit / 3Vref = 709.973328 bits
Bits_1MPascal = VHigh * 4096 / 3; // VHigh * 4096bit / 3Vref = 3549.86646 bits
- a = (Bits_1MPascal - Bits_0Pascal) / (1 - 0) ;// Mpascal/Bits = 2839.89307
+ a = (1 - 0) / (Bits_1MPascal - Bits_0Pascal);// Mpascal/Bits = 0.000352125
- b = Bits_0Pascal - (a * 0 ); //709.973328
+ b = 0 - (a * Bits_0Pascal ); // y = ax + b (x= Bits_0Pascal, y = 0)
}
float CalculateDispenserPressure (int DispenserId)
@@ -58,7 +58,7 @@ float CalculateDispenserPressure (int DispenserId)
if(data<Bits_0Pascal)
data = Bits_0Pascal;//40mA 0Bar
- temp = (data - b) / a;
+ temp = a * data + b;
DispenserPressure[DispenserId] = temp; // [Mpascal] ( 1 Mpascal = 10 Bar )