diff code_part1/OSTC_code_c_part2/p2_deco.c @ 322:676d18bce8d7

Fix ppO2[flush] display in customview.
author JeanDo
date Sat, 07 May 2011 00:08:08 +0200
parents a99073445c18
children b7940978edc9
line wrap: on
line diff
--- a/code_part1/OSTC_code_c_part2/p2_deco.c	Thu May 05 22:18:24 2011 +0200
+++ b/code_part1/OSTC_code_c_part2/p2_deco.c	Sat May 07 00:08:08 2011 +0200
@@ -1384,6 +1384,8 @@
 	pres_diluent = pres_respiration;
     if( char_I_const_ppO2 != 0 )												// new in v.101
     {
+        overlay float flush_ppO2 = pres_respiration * (1.0 - N2_ratio - He_ratio);
+        
   		pres_diluent -= const_ppO2;                                             // new in v.101
   		pres_diluent /= N2_ratio + He_ratio;                                    // new in v.101
         if( pres_diluent < 0.0 )
@@ -1392,7 +1394,10 @@
   		    pres_diluent = pres_respiration;                                    // new in v.101
 
  		char_O_diluent = (unsigned char)(pres_diluent/pres_respiration*100.0 + 0.5);
- 		char_O_diluent_ppO2 = (unsigned char)(pres_diluent * (1.0 - N2_ratio - He_ratio) * 100.0 + 0.5);
+
+ 		if( flush_ppO2 > 2.45 ) flush_ppO2 = 2.55;
+ 		if( flush_ppO2 < 0.0  ) flush_ppO2 = 0.0;
+ 		char_O_flush_ppO2 = (unsigned char)(flush_ppO2*100.0 + 0.5);
     }
 
     if( pres_diluent > ppWater )                                              // new in v.101