Correction de la lib car erreur de format dans les calculs

Revision:
3:77cf75d8a6ce
Parent:
1:a1f3bd291a0c
Child:
4:ff505486c804
--- a/MS5803.cpp	Thu Jul 24 04:59:22 2014 +0000
+++ b/MS5803.cpp	Wed Aug 06 17:27:29 2014 +0000
@@ -18,10 +18,10 @@
     THE SOFTWARE.
 
   * Library for Pressure Sensors of type MS5803-x of MEAS Switzerland     (www.meas-spec.com).
-  * The driver uses I2C mode (sensor's Protocol Select (PS) pin pulled to high). 
+  * The driver uses I2C mode (sensor's Protocol Select (PS) pin pulled to high).
   * MS5803-01BA was successfully tested by Raig Kaufer.
   * MS5803-14BA (Underwater Pressure Sensor 14 bar) was successfully tested by Robert Katzschmann
-  * Other types of MEAS are compatible but not tested 
+  * Other types of MEAS are compatible but not tested
   * Written by Raig Kaufer, distribute freely!
   * Revised by Robert Katzschmann
  */
@@ -34,17 +34,26 @@
  * Sensor operating function according data sheet
  */
 
+void MS5803::MS5803Init(void)
+{
+    MS5803Reset();
+    MS5803ReadProm();
+    return;
+}
+
 /* Send soft reset to the sensor */
-void MS5803::MS5803Reset(void) {
+void MS5803::MS5803Reset(void)
+{
     /* transmit out 1 byte reset command */
     ms5803_tx_data[0] = ms5803_reset;
     if ( i2c.write( device_address,  ms5803_tx_data, 1 ) );
-    printf("send soft reset");
+    //printf("send soft reset");
     wait_ms(20);
 }
 
 /* read the sensor calibration data from rom */
-void MS5803::MS5803ReadProm(void) {
+void MS5803::MS5803ReadProm(void)
+{
     uint8_t i,j;
     for (i=0; i<8; i++) {
         j = i;
@@ -56,19 +65,22 @@
 }
 
 /* Start the sensor pressure conversion */
-void MS5803::MS5803ConvertD1(void) {
+void MS5803::MS5803ConvertD1(void)
+{
     ms5803_tx_data[0] = ms5803_convD1;
     if ( i2c.write( device_address,  ms5803_tx_data, 1 ) );
 }
 
 /* Start the sensor temperature conversion */
-void MS5803:: MS5803ConvertD2(void) {
+void MS5803:: MS5803ConvertD2(void)
+{
     ms5803_tx_data[0] = ms5803_convD2;
     if ( i2c.write( device_address,  ms5803_tx_data, 1 ) );
 }
 
-/* Read the privious started conversion results */
-int32_t MS5803::MS5803ReadADC(void) {
+/* Read the previous started conversion results */
+int32_t MS5803::MS5803ReadADC(void)
+{
     int32_t adc;
     wait_ms(150);
     ms5803_tx_data[0] = ms5803_ADCread;
@@ -79,20 +91,26 @@
 }
 
 /* return the results */
-float MS5803::MS5803_Pressure (void) {
+float MS5803::MS5803_Pressure (void)
+{
     return P_MS5803;
 }
-float MS5803::MS5803_Temperature (void) {
+float MS5803::MS5803_Temperature (void)
+{
     return T_MS5803;
 }
 
 /* Sensor reading and calculation procedure */
-void MS5803::Barometer_MS5803(void) {
+void MS5803::Barometer_MS5803(void)
+{
     int32_t dT, temp;
     int64_t OFF, SENS, press;
 
-    MS5803Reset();                 // reset the sensor
-    MS5803ReadProm();             // read the calibration values
+    //no need to do this everytime!
+    //MS5803Reset();                 // reset the sensor
+    //MS5803ReadProm();             // read the calibration values
+    
+    
     MS5803ConvertD1();             // start pressure conversion
     D1 = MS5803ReadADC();        // read the pressure value
     MS5803ConvertD2();             // start temperature conversion