comparison code_part1/OSTC_code_c_part2/p2_deco.c @ 630:6526a5b058b7

Fill char_O_deco_time_for_log array with stop times
author heinrichsweikamp
date Fri, 07 Sep 2012 14:48:31 +0200
parents d1719622111e
children 242139da29f2
comparison
equal deleted inserted replaced
629:e755ed869a3b 630:6526a5b058b7
678 678
679 //---- Second: copy to output table (in reverse order) 679 //---- Second: copy to output table (in reverse order)
680 for(y=0; y<NUM_STOPS; y++, --x) 680 for(y=0; y<NUM_STOPS; y++, --x)
681 { 681 {
682 char_O_deco_depth[y] = internal_deco_depth[x]; 682 char_O_deco_depth[y] = internal_deco_depth[x];
683 char_O_deco_time_for_log[y] = internal_deco_depth[x];
683 char_O_deco_time [y] = internal_deco_time [x]; 684 char_O_deco_time [y] = internal_deco_time [x];
684 685
685 // Stop only once the last transfer is done. 686 // Stop only once the last transfer is done.
686 if( x == 0 ) break; 687 if( x == 0 ) break;
687 } 688 }
689 //---- Third: fill table end with null 690 //---- Third: fill table end with null
690 for(y++; y<NUM_STOPS; y++) 691 for(y++; y<NUM_STOPS; y++)
691 { 692 {
692 char_O_deco_time [y] = 0; 693 char_O_deco_time [y] = 0;
693 char_O_deco_depth[y] = 0; 694 char_O_deco_depth[y] = 0;
695 char_O_deco_time_for_log[y] = 0;
694 } 696 }
695 } 697 }
696 else //---- Straight copy ------------------------------------------------ 698 else //---- Straight copy ------------------------------------------------
697 { 699 {
698 overlay unsigned char x; 700 overlay unsigned char x, y;
699 701
700 for(x=0; x<NUM_STOPS; x++) 702 for(x=0; x<NUM_STOPS; x++)
701 { 703 {
702 char_O_deco_depth[x] = internal_deco_depth[x]; 704 char_O_deco_depth[x] = internal_deco_depth[x];
703 char_O_deco_time [x] = internal_deco_time [x]; 705 char_O_deco_time [x] = internal_deco_time [x];
704 } 706 }
707
708 //Now fill the char_O_deco_time_for_log array
709 //---- First: search the first non-null depth
710 for(x=(NUM_STOPS-1); x != 0; --x)
711 if( internal_deco_depth[x] != 0 ) break;
712
713 //---- Second: copy to output table (in reverse order)
714 for(y=0; y<NUM_STOPS; y++, --x)
715 {
716 char_O_deco_time_for_log[y] = internal_deco_depth[x];
717
718 // Stop only once the last transfer is done.
719 if( x == 0 ) break;
720 }
721
722 //---- Third: fill table end with null
723 for(y++; y<NUM_STOPS; y++)
724 {
725 char_O_deco_time_for_log [y] = 0;
726 }
727
705 } 728 }
706 } 729 }
707 730
708 ////////////////////////////////////////////////////////////////////////////// 731 //////////////////////////////////////////////////////////////////////////////
709 // temp_tissue_safety // 732 // temp_tissue_safety //