Mercurial > public > hwos_code
comparison src/p2_deco.c @ 135:42a2cfc3e85d
minor
author | heinrichsweikamp |
---|---|
date | Wed, 16 Jul 2014 14:39:56 +0200 |
parents | 939f1e83c4c2 |
children | 7dbc1d780ca5 |
comparison
equal
deleted
inserted
replaced
134:4574aed5cd4c | 135:42a2cfc3e85d |
---|---|
2158 // CF#54 == TRUE if shallowest stop first. | 2158 // CF#54 == TRUE if shallowest stop first. |
2159 // CF#56 == bottom liters/minutes (5 .. 50) or bar/min. | 2159 // CF#56 == bottom liters/minutes (5 .. 50) or bar/min. |
2160 // CF#57 == deco liters/minutes (5 .. 50) or bar/min. | 2160 // CF#57 == deco liters/minutes (5 .. 50) or bar/min. |
2161 // Output: int_O_gas_volumes[0..4] in litters * 0.1 | 2161 // Output: int_O_gas_volumes[0..4] in litters * 0.1 |
2162 // | 2162 // |
2163 /* | 2163 |
2164 | 2164 |
2165 void deco_gas_volumes(void) | 2165 void deco_gas_volumes(void) |
2166 { | 2166 { |
2167 overlay float volumes[NUM_GAS]; | 2167 overlay float volumes[NUM_GAS]; |
2168 overlay float bottom_usage, deco_usage; | 2168 overlay float bottom_usage, deco_usage; |
2169 overlay unsigned char i, deepest_first; | 2169 overlay unsigned char i; |
2170 overlay unsigned char gas, depth; | 2170 overlay unsigned char gas, depth; |
2171 overlay unsigned char lastGasStop = 255; | 2171 overlay unsigned char lastGasStop = 255; |
2172 RESET_C_STACK | 2172 RESET_C_STACK |
2173 | 2173 |
2174 //---- initialize with bottom consumption -------------------------------- | 2174 //---- initialize with bottom consumption -------------------------------- |
2184 = (char_I_bottom_depth*0.1 + 1.0) // Use Psurface = 1.0 bar. | 2184 = (char_I_bottom_depth*0.1 + 1.0) // Use Psurface = 1.0 bar. |
2185 * char_I_bottom_time // in minutes. | 2185 * char_I_bottom_time // in minutes. |
2186 * bottom_usage; // In liter/minutes. | 2186 * bottom_usage; // In liter/minutes. |
2187 | 2187 |
2188 //---- Ascent usage ------------------------------------------------------ | 2188 //---- Ascent usage ------------------------------------------------------ |
2189 deepest_first = 0; | |
2190 deco_usage = 20; // In liter/minutes. | 2189 deco_usage = 20; // In liter/minutes. |
2191 | 2190 |
2192 depth = char_I_bottom_depth; | 2191 depth = char_I_bottom_depth; |
2193 | 2192 |
2194 for(i=0; i<NUM_STOPS; ++i) | 2193 for(i=0; i<NUM_STOPS; ++i) |
2195 { | 2194 { |
2196 overlay unsigned char newDepth, time; | 2195 overlay unsigned char newDepth, time; |
2197 | 2196 |
2198 // Manage stops in reverse order (CF#54) | 2197 time = char_O_deco_time[31-i]; |
2199 if( deepest_first ) | 2198 if( time == 0 ) continue; // not yet: still search table. |
2200 { | 2199 newDepth = char_O_deco_depth[31-i]; |
2201 time = char_O_deco_time[i]; | |
2202 if( time == 0 ) break; // End of table: done. | |
2203 | |
2204 newDepth = char_O_deco_depth[i]; | |
2205 } | |
2206 else | |
2207 { | |
2208 time = char_O_deco_time[31-i]; | |
2209 if( time == 0 ) continue; // not yet: still search table. | |
2210 | |
2211 newDepth = char_O_deco_depth[31-i]; | |
2212 } | |
2213 | 2200 |
2214 //---- Gas switch during or before this stop -------------------------- | 2201 //---- Gas switch during or before this stop -------------------------- |
2215 for(;;) | 2202 for(;;) |
2216 { | 2203 { |
2217 overlay unsigned char newGas = 0; | 2204 overlay unsigned char newGas = 0; |
2289 int_O_gas_volumes[i] = (unsigned short)(volumes[i] + 0.5); | 2276 int_O_gas_volumes[i] = (unsigned short)(volumes[i] + 0.5); |
2290 } | 2277 } |
2291 | 2278 |
2292 ////////////////////////////////////////////////////////////////////////////// | 2279 ////////////////////////////////////////////////////////////////////////////// |
2293 | 2280 |
2294 */ | 2281 |
2295 | 2282 |
2296 void deco_push_tissues_to_vault(void) | 2283 void deco_push_tissues_to_vault(void) |
2297 { | 2284 { |
2298 overlay unsigned char x; | 2285 overlay unsigned char x; |
2299 RESET_C_STACK | 2286 RESET_C_STACK |