Mercurial > public > mk2
comparison code_part1/OSTC_code_c_part2/p2_deco.c @ 564:4e9e95d108d2 bug_deco_clearing_missed_stops
Minor cleanups for MacOSX compatibility.
author | JeanDo |
---|---|
date | Wed, 29 Feb 2012 01:21:31 +0100 |
parents | 7bec4cf28cc7 |
children | 8666b14fce24 |
comparison
equal
deleted
inserted
replaced
563:7bec4cf28cc7 | 564:4e9e95d108d2 |
---|---|
153 static unsigned char calc_nextdecodepth(void); | 153 static unsigned char calc_nextdecodepth(void); |
154 | 154 |
155 //---- Bank 4 parameters ----------------------------------------------------- | 155 //---- Bank 4 parameters ----------------------------------------------------- |
156 #pragma udata bank4=0x400 | 156 #pragma udata bank4=0x400 |
157 | 157 |
158 static float temp_limit; | |
159 static float GF_low; | 158 static float GF_low; |
160 static float GF_high; | 159 static float GF_high; |
161 static float GF_delta; | 160 static float GF_delta; |
162 static float locked_GF_step; // GF_delta / low_depth | 161 static float locked_GF_step; // GF_delta / low_depth |
163 | 162 |
343 #endif | 342 #endif |
344 | 343 |
345 static short read_custom_function(PARAMETER unsigned char cf) | 344 static short read_custom_function(PARAMETER unsigned char cf) |
346 { | 345 { |
347 #ifdef CROSS_COMPILE | 346 #ifdef CROSS_COMPILE |
348 return (cf & 32) ? eeprom.bank1_CF[cf-32].value | 347 return (cf & 32) ? eeprom.bank1_CF[cf-32].value.lo |
349 : eeprom.bank0_CF[cf ].value; | 348 : eeprom.bank0_CF[cf ].value.lo; |
350 #else | 349 #else |
351 extern unsigned char hi, lo; | 350 extern unsigned char hi, lo; |
352 extern void getcustom15(); | 351 extern void getcustom15(); |
353 _asm | 352 _asm |
354 movff cf,WREG | 353 movff cf,WREG |
388 movlw 1 | 387 movlw 1 |
389 movwf TBLPTRU,0 | 388 movwf TBLPTRU,0 |
390 _endasm | 389 _endasm |
391 #endif | 390 #endif |
392 | 391 |
393 assert( 0 <= ci && ci < NUM_COMP ); | 392 assert( ci < NUM_COMP ); |
394 | 393 |
395 // Use an interleaved array (AoS) to access coefficients with a | 394 // Use an interleaved array (AoS) to access coefficients with a |
396 // single addressing. | 395 // single addressing. |
397 { | 396 { |
398 overlay rom const float* ptr = &buhlmann_ab[4*ci]; | 397 overlay rom const float* ptr = &buhlmann_ab[4*ci]; |
419 movlw 1 | 418 movlw 1 |
420 movwf TBLPTRU,0 | 419 movwf TBLPTRU,0 |
421 _endasm | 420 _endasm |
422 #endif | 421 #endif |
423 | 422 |
424 assert( 0 <= ci && ci < NUM_COMP ); | 423 assert( ci < NUM_COMP ); |
425 | 424 |
426 // Integration intervals. | 425 // Integration intervals. |
427 switch(period) | 426 switch(period) |
428 { | 427 { |
429 case 0: //---- 2 sec ----------------------------------------------------- | 428 case 0: //---- 2 sec ----------------------------------------------------- |
470 movlw 1 | 469 movlw 1 |
471 movwf TBLPTRU,0 | 470 movwf TBLPTRU,0 |
472 _endasm | 471 _endasm |
473 #endif | 472 #endif |
474 | 473 |
475 assert( 0 <= ci && ci < NUM_COMP ); | 474 assert( ci < NUM_COMP ); |
476 { | 475 { |
477 overlay rom const float* ptr = &buhlmann_ht[2*ci]; | 476 overlay rom const float* ptr = &buhlmann_ht[2*ci]; |
478 var_N2_ht = *ptr++; | 477 var_N2_ht = *ptr++; |
479 var_He_ht = *ptr++; | 478 var_He_ht = *ptr++; |
480 } | 479 } |
877 // | 876 // |
878 // Output: calc_N2_ratio, calc_He_ratio | 877 // Output: calc_N2_ratio, calc_He_ratio |
879 // | 878 // |
880 static void gas_switch_set(void) | 879 static void gas_switch_set(void) |
881 { | 880 { |
882 assert( 0 <= sim_gas_last_used && sim_gas_last_used <= NUM_GAS ); | 881 assert( sim_gas_last_used <= NUM_GAS ); |
883 | 882 |
884 if( sim_gas_last_used == 0 ) // Gas6 = manualy set gas. | 883 if( sim_gas_last_used == 0 ) // Gas6 = manualy set gas. |
885 { | 884 { |
886 calc_N2_ratio = N2_ratio; | 885 calc_N2_ratio = N2_ratio; |
887 calc_He_ratio = He_ratio; | 886 calc_He_ratio = He_ratio; |
2307 void deco_calc_percentage(void) | 2306 void deco_calc_percentage(void) |
2308 { | 2307 { |
2309 RESET_C_STACK | 2308 RESET_C_STACK |
2310 | 2309 |
2311 assert( 60 <= char_I_temp && char_I_temp <= 100 ); | 2310 assert( 60 <= char_I_temp && char_I_temp <= 100 ); |
2312 assert( 0 <= int_I_temp && int_I_temp < 5760 ); // Less than 4 days = 96h... | 2311 assert( int_I_temp < 5760 ); // Less than 4 days = 96h... |
2313 | 2312 |
2314 int_I_temp = (unsigned short)(((float)int_I_temp * (float)char_I_temp) * 0.01 ); | 2313 int_I_temp = (unsigned short)(((float)int_I_temp * (float)char_I_temp) * 0.01 ); |
2315 | 2314 |
2316 assert( int_I_temp < 5760 ); // Less than 96h too... | 2315 assert( int_I_temp < 5760 ); // Less than 96h too... |
2317 } | 2316 } |