@@ -32,10 +32,10 @@ void KellerLD::init() {
3232 year = scaling0 >> 11 ;
3333 month = (scaling0 & 0b0000011110000000 ) >> 7 ;
3434 day = (scaling0 & 0b0000000001111100 ) >> 2 ;
35-
35+
3636 // handle P-mode pressure offset (to vacuum pressure)
3737
38- if (mode == 0 ) {
38+ if (mode == 0 ) {
3939 // PA mode, Vented Gauge. Zero at atmospheric pressure
4040 P_mode = 1.01325 ;
4141 } else if (mode == 1 ) {
@@ -49,11 +49,11 @@ void KellerLD::init() {
4949
5050 uint32_t scaling12 = (uint32_t (readMemoryMap (LD_SCALING1)) << 16 ) | readMemoryMap (LD_SCALING2);
5151
52- P_min = *reinterpret_cast <float *>(&scaling12);
52+ P_min = *reinterpret_cast <float *>(&scaling12);
5353
5454 uint32_t scaling34 = (uint32_t (readMemoryMap (LD_SCALING3)) << 16 ) | readMemoryMap (LD_SCALING4);
5555
56- P_max = *reinterpret_cast <float *>(&scaling34);
56+ P_max = *reinterpret_cast <float *>(&scaling34);
5757}
5858
5959void KellerLD::setFluidDensity (float density) {
@@ -69,13 +69,13 @@ void KellerLD::read() {
6969
7070 delay (9 ); // Max conversion time per datasheet
7171
72- Wire.requestFrom (LD_ADDR,5 );
72+ Wire.requestFrom (LD_ADDR, 5 );
7373 status = Wire.read ();
7474 P = (Wire.read () << 8 ) | Wire.read ();
7575 uint16_t T = (Wire.read () << 8 ) | Wire.read ();
76-
77- P_bar = (float (P)- 16384 )* (P_max- P_min)/ 32768 + P_min + P_mode;
78- T_degc = ((T>> 4 )- 24 )* 0.05 - 50 ;
76+
77+ P_bar = (float (P) - 16384 ) * (P_max - P_min) / 32768 + P_min + P_mode;
78+ T_degc = ((T >> 4 ) - 24 ) * 0.05 - 50 ;
7979}
8080
8181uint16_t KellerLD::readMemoryMap (uint8_t mtp_address) {
@@ -87,37 +87,37 @@ uint16_t KellerLD::readMemoryMap(uint8_t mtp_address) {
8787
8888 delay (1 ); // allow for response to come in
8989
90- Wire.requestFrom (LD_ADDR,3 );
90+ Wire.requestFrom (LD_ADDR, 3 );
9191 status = Wire.read ();
9292 return ((Wire.read () << 8 ) | Wire.read ());
9393}
9494
9595bool KellerLD::status () {
96- if (equipment <= 62 ) {
96+ if (equipment <= 62 ) {
9797 return true ;
9898 } else {
9999 return false ;
100100 }
101101}
102102
103103float KellerLD::range () {
104- return P_max- P_min;
104+ return P_max - P_min;
105105}
106106
107107float KellerLD::pressure (float conversion) {
108- return P_bar* 1000 .0f * conversion;
108+ return P_bar * 1000 .0f * conversion;
109109}
110110
111111float KellerLD::temperature () {
112112 return T_degc;
113113}
114114
115115float KellerLD::depth () {
116- return (pressure (KellerLD::Pa)- 101325 )/ (fluidDensity* 9.80665 );
116+ return (pressure (KellerLD::Pa) - 101325 ) / (fluidDensity * 9.80665 );
117117}
118118
119119float KellerLD::altitude () {
120- return (1 - pow ((pressure ()/ 1013.25 ),0.190284 ))* 145366.45 * .3048 ;
120+ return (1 - pow ((pressure () / 1013.25 ), 0.190284 )) * 145366.45 * .3048 ;
121121}
122122
123123bool KellerLD::isInitialized () {
0 commit comments