diff options
| author | Avi Levkovich <avi@twine-s.com> | 2018-08-08 16:46:19 +0300 |
|---|---|---|
| committer | Avi Levkovich <avi@twine-s.com> | 2018-08-08 16:46:19 +0300 |
| commit | 29fdb2c512e2b0576faf4011a2311200300335be (patch) | |
| tree | 36712fc8f5ff922e7e601dd286e3a9884a9fe457 /Software/Embedded_SW/Embedded/Modules/IDS/IDS_init.c | |
| parent | be5c498b723efa8f8e02332e5af40ea0214b0fb7 (diff) | |
| download | Tango-29fdb2c512e2b0576faf4011a2311200300335be.tar.gz Tango-29fdb2c512e2b0576faf4011a2311200300335be.zip | |
fix bug in Dispenser Pressure calculation
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules/IDS/IDS_init.c')
| -rw-r--r-- | Software/Embedded_SW/Embedded/Modules/IDS/IDS_init.c | 6 |
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 374ab444f..87274f904 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 = (1 - 0) / (Bits_1MPascal - Bits_0Pascal);// Mpascal/Bits = 0.000352125 + float a = (Bits_1MPascal - Bits_0Pascal) / (1 - 0) ;// Mpascal/Bits = - b = 0 - (a * Bits_0Pascal ); + float b = Bits_0Pascal - (a * 0 ); } float CalculateDispenserPressure (int DispenserId) @@ -58,7 +58,7 @@ float CalculateDispenserPressure (int DispenserId) if(data<Bits_0Pascal) data = Bits_0Pascal;//40mA 0Bar - temp = a * data + b; + temp = (data - b) / a; DispenserPressure[DispenserId] = temp; // [Mpascal] ( 1 Mpascal = 10 Bar ) |
