comparison code_part1/OSTC_code_c_part2/p2_deco.c @ 279:8514588eb6a2

Mark gas-switch stops for decoplans, displayed in yellow.
author JeanDo
date Tue, 19 Apr 2011 03:12:22 +0200
parents 17aab4ca0547
children 9feb224f6871
comparison
equal deleted inserted replaced
278:17aab4ca0547 279:8514588eb6a2
827 // 827 //
828 static void copy_deco_table(void) 828 static void copy_deco_table(void)
829 { 829 {
830 // Copy depth of the first (deepest) stop, because when reversing 830 // Copy depth of the first (deepest) stop, because when reversing
831 // order, it will be hard to find... 831 // order, it will be hard to find...
832 char_O_first_deco_depth = internal_deco_depth[0]; 832 char_O_first_deco_depth = internal_deco_depth[0] & 0x7F;
833 char_O_first_deco_time = internal_deco_time [0]; 833 char_O_first_deco_time = internal_deco_time [0];
834 834
835 if( read_custom_function(54) & 1 ) //---- Should we reverse table ? ------ 835 if( read_custom_function(54) & 1 ) //---- Should we reverse table ? ------
836 { 836 {
837 overlay unsigned char x, y; 837 overlay unsigned char x, y;
1834 for(x=0; x<32; ++x) 1834 for(x=0; x<32; ++x)
1835 { 1835 {
1836 // Make sure deco-stops are recorded in order: 1836 // Make sure deco-stops are recorded in order:
1837 assert( !internal_deco_depth[x] || temp_depth_limit <= internal_deco_depth[x] ); 1837 assert( !internal_deco_depth[x] || temp_depth_limit <= internal_deco_depth[x] );
1838 1838
1839 if( internal_deco_depth[x] == temp_depth_limit ) 1839 if( (internal_deco_depth[x] & 0x7F) == temp_depth_limit )
1840 { 1840 {
1841 // Do not overflow (max 255') 1841 // Do not overflow (max 255')
1842 if( internal_deco_time[x] < 255 ) 1842 if( internal_deco_time[x] < 255 )
1843 { 1843 {
1844 internal_deco_time[x]++; 1844 internal_deco_time[x]++;
1848 } 1848 }
1849 1849
1850 if( internal_deco_depth[x] == 0 ) 1850 if( internal_deco_depth[x] == 0 )
1851 { 1851 {
1852 internal_deco_depth[x] = temp_depth_limit; 1852 internal_deco_depth[x] = temp_depth_limit;
1853 if( sim_gas_delay > sim_dive_mins )
1854 internal_deco_depth[x] |= 0x80;
1855
1853 internal_deco_time[x] = 1; 1856 internal_deco_time[x] = 1;
1854 return; 1857 return;
1855 } 1858 }
1856 } 1859 }
1857 1860