comparison code_part1/OSTC_code_c_part2/p2_deco.c @ 323:b7940978edc9

Fix "Future TTS" display customview. * Display "---" during wait. * Display ascent when there is no stops.
author JeanDo
date Sat, 07 May 2011 00:52:20 +0200
parents 676d18bce8d7
children a7ed48daf597
comparison
equal deleted inserted replaced
322:676d18bce8d7 323:b7940978edc9
1245 { 1245 {
1246 case 3: //---- At surface: start a new dive ------------------------------ 1246 case 3: //---- At surface: start a new dive ------------------------------
1247 clear_deco_table(); 1247 clear_deco_table();
1248 copy_deco_table(); 1248 copy_deco_table();
1249 int_O_ascenttime = 0; // Reset DTR. 1249 int_O_ascenttime = 0; // Reset DTR.
1250 int_O_extra_ascenttime = 0;
1250 char_O_nullzeit = 0; // Reset bottom time. 1251 char_O_nullzeit = 0; // Reset bottom time.
1251 char_O_deco_status = 0; // Calc bottom-time/nullzeit next iteration. 1252 char_O_deco_status = 0; // Calc bottom-time/nullzeit next iteration.
1252 1253
1253 // Values that should be reset just once for the full real dive. 1254 // Values that should be reset just once for the full real dive.
1254 // This is used to record the lowest stop for the whole dive, 1255 // This is used to record the lowest stop for the whole dive,
1499 if( char_O_deco_status == 1 ) // Don't in @+5min variant. 1500 if( char_O_deco_status == 1 ) // Don't in @+5min variant.
1500 copy_deco_table(); 1501 copy_deco_table();
1501 1502
1502 calc_ascenttime(); 1503 calc_ascenttime();
1503 char_O_deco_status = 0; // calc nullzeit next time. 1504 char_O_deco_status = 0; // calc nullzeit next time.
1504 char_O_deco_last_stop = 0; // Surface reached. 1505 char_O_deco_last_stop = 0; // Surface reached (to animate menu)
1505 return; 1506 return;
1506 } 1507 }
1507 } 1508 }
1508 } 1509 }
1509 else 1510 else
1739 // and all stops. 1740 // and all stops.
1740 // 1741 //
1741 // Result in int_O_ascenttime, or int_O_extra_ascenttime if in @+5min variant. 1742 // Result in int_O_ascenttime, or int_O_extra_ascenttime if in @+5min variant.
1742 static void calc_ascenttime(void) 1743 static void calc_ascenttime(void)
1743 { 1744 {
1744 if( pres_respiration > pres_surface ) 1745 overlay unsigned char x;
1745 { 1746 overlay unsigned short sum;
1746 overlay unsigned char x; 1747
1747 overlay unsigned short sum; 1748 // + 0.7 to count 1 minute ascent time from 3 metre to surface
1748 1749 overlay float ascent = pres_respiration - pres_surface + 0.7;
1749 // + 0.7 to count 1 minute ascent time from 3 metre to surface 1750 if (ascent < 0.0)
1750 overlay float ascent = pres_respiration - pres_surface + 0.7; 1751 ascent = 0.0;
1751 if (ascent < 0.0) 1752 sum = (unsigned short)(ascent + 0.99);
1752 ascent = 0.0; 1753
1753 sum = (unsigned short)(ascent + 0.99); 1754 for(x=0; x<32 && internal_deco_depth[x]; x++)
1754 1755 sum += (unsigned short)internal_deco_time[x];
1755 for(x=0; x<32 && internal_deco_depth[x]; x++) 1756
1756 sum += (unsigned short)internal_deco_time[x]; 1757 if( char_O_deco_status == 1 )
1757 1758 int_O_ascenttime = sum;
1758 if( char_O_deco_status == 1 )
1759 int_O_ascenttime = sum;
1760 else
1761 int_O_extra_ascenttime = sum;
1762 }
1763 else 1759 else
1764 int_O_ascenttime = 0; 1760 int_O_extra_ascenttime = sum;
1765 } 1761 }
1766 1762
1767 ////////////////////////////////////////////////////////////////////////////// 1763 //////////////////////////////////////////////////////////////////////////////
1768 // update_startvalues 1764 // update_startvalues
1769 // 1765 //
2159 2155
2160 clear_deco_table(); 2156 clear_deco_table();
2161 char_O_deco_status = 3; // surface new in v.102 : stays in surface state. 2157 char_O_deco_status = 3; // surface new in v.102 : stays in surface state.
2162 char_O_nullzeit = 0; 2158 char_O_nullzeit = 0;
2163 int_O_ascenttime = 0; 2159 int_O_ascenttime = 0;
2160 int_O_extra_ascenttime = 0;
2164 calc_gradient_factor(); 2161 calc_gradient_factor();
2165 } 2162 }
2166 2163
2167 ////////////////////////////////////////////////////////////////////////////// 2164 //////////////////////////////////////////////////////////////////////////////
2168 ////////////////////////////////////////////////////////////////////////////// 2165 //////////////////////////////////////////////////////////////////////////////