167
|
1 // ********************************************************************
|
|
2 // ** main code for simulation / tests without full simulation code **
|
|
3 // ** This is NOT a part of the OSTC **
|
|
4 // ********************************************************************
|
116
|
5
|
|
6 //////////////////////////////////////////////////////////////////////////////
|
|
7 // OSTC - diving computer code
|
|
8 // Copyright (C) 2008 HeinrichsWeikamp GbR
|
|
9 //
|
|
10 // This program is free software: you can redistribute it and/or modify
|
|
11 // it under the terms of the GNU General Public License as published by
|
|
12 // the Free Software Foundation, either version 3 of the License, or
|
|
13 // (at your option) any later version.
|
|
14 //
|
|
15 // This program is distributed in the hope that it will be useful,
|
|
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
18 // GNU General Public License for more details.
|
|
19 //
|
|
20 // You should have received a copy of the GNU General Public License
|
|
21 // along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
22 //
|
|
23 //////////////////////////////////////////////////////////////////////////////
|
167
|
24 // History:
|
116
|
25 // 12/25/10 v110: [jDG] split in three files (deco.c, main.c, definitions.h)
|
167
|
26 // 01/24/11 : [jDG] make it link with oled+wordprocessor display functions
|
116
|
27
|
|
28 #include <stdlib.h>
|
167
|
29 #include <stdio.h>
|
116
|
30
|
167
|
31 //////////////////////////////////////////////////////////////////////////////
|
|
32 // Compile with:
|
|
33 // p2_deco.c
|
|
34 // p2_environment.asm
|
|
35 // To have a linkable application, downloadable on the OSTC.
|
|
36 //////////////////////////////////////////////////////////////////////////////
|
116
|
37
|
167
|
38 #define TEST_MAIN 1
|
|
39 #include "p2_definitions.h"
|
|
40 #include "../OSTC_code_c_part2/shared_definitions.h"
|
116
|
41
|
167
|
42 //////////////////////////////////////////////////////////////////////////////
|
|
43 //
|
116
|
44
|
167
|
45 static void print_stops(void)
|
|
46 {
|
|
47 //TODO: print decompression stops using aa_wordprocessor...
|
|
48 PLED_ClearScreen();
|
|
49 win_top = 0;
|
|
50 win_leftx2 = 0;
|
|
51 win_font = 0;
|
|
52 win_invert = 0;
|
|
53 PLED_standard_color();
|
116
|
54
|
167
|
55 sprintf(letter, "TTS: %d", char_O_ascenttime);
|
|
56 aa_wordprocessor();
|
|
57
|
|
58 //TODO: Wait click (to continue)
|
116
|
59 }
|
|
60
|
167
|
61 //////////////////////////////////////////////////////////////////////////////
|
116
|
62 #pragma code main = 0x9000
|
|
63 void main(void)
|
|
64 {
|
|
65 static unsigned int i;
|
|
66 static unsigned int debug_temp;
|
|
67
|
167
|
68 char_I_deco_model = 0;
|
|
69 deco_clear_CNS_fraction();
|
116
|
70
|
167
|
71 char_I_N2_ratio = 79; //38;
|
|
72 char_I_He_ratio = 0; //50;
|
|
73 char_I_deco_distance = 10; // 10 = 1 meter
|
|
74 char_I_depth_last_deco = 3; // values below 3 (meter) are ignored
|
|
75
|
|
76 char_I_const_ppO2 = 0;
|
|
77 char_I_deco_ppO2_change = 0; // [dm] 10 = 1 meter
|
|
78 char_I_deco_ppO2 = 0;
|
|
79
|
|
80 char_I_deco_gas_change1 = 20; // [m] 1 = 1 meter
|
|
81 char_I_deco_N2_ratio1 = 50;
|
|
82 char_I_deco_He_ratio1 = 0;
|
|
83
|
|
84 char_I_deco_gas_change2 = 6; // [m] 1 = 1 meter
|
|
85 char_I_deco_N2_ratio2 = 0;
|
|
86 char_I_deco_He_ratio2 = 0;
|
|
87
|
|
88 char_I_deco_gas_change3 = 0; // [m] 1 = 1 meter
|
|
89 char_I_deco_gas_change4 = 0; // [m] 1 = 1 meter
|
|
90 char_I_deco_gas_change5 = 0; // [m] 1 = 1 meter
|
116
|
91
|
167
|
92 //char_I_actual_ppO2; // 0x507
|
|
93 char_I_GF_High_percentage = 100; // 0x514 new in v.102
|
|
94 char_I_GF_Low_percentage = 100; // 0x515 new in v.102
|
|
95
|
|
96 char_I_saturation_multiplier = 110;
|
|
97 char_I_desaturation_multiplier = 90;
|
|
98
|
|
99 //---- Starts at zero meter ----------------------------------------------
|
|
100 int_I_pres_respiration = 1000;//980;
|
|
101 int_I_pres_surface = 1000;//980;
|
|
102 deco_clear_tissue();
|
116
|
103
|
167
|
104 //---- Calculate 29min at 45m --------------------------------------------
|
|
105 char_I_step_is_1min = 1;
|
|
106 int_I_pres_respiration = 4500 + int_I_pres_surface;
|
|
107
|
|
108 for (i=0;i<29;i++)
|
|
109 deco_calc_hauptroutine();
|
116
|
110
|
167
|
111 // Wait for one full computation
|
|
112 char_I_step_is_1min = 0;
|
|
113 char_O_deco_status = 255;
|
|
114 while (char_O_deco_status)
|
|
115 deco_calc_hauptroutine();
|
|
116 print_stops();
|
|
117
|
|
118 // And a second one
|
|
119 while (char_O_deco_status)
|
|
120 deco_calc_hauptroutine();
|
|
121 print_stops();
|
116
|
122
|
167
|
123 //---- 3000 seconds at 90m -----------------------------------------------
|
|
124 int_I_pres_respiration = 10000;
|
|
125 for (i=0;i<1500;i++)
|
|
126 deco_calc_hauptroutine();
|
|
127
|
|
128 while(char_O_deco_status != 0)
|
|
129 deco_calc_hauptroutine();
|
|
130 print_stops();
|
116
|
131
|
167
|
132 //---- 300 seconds at 29m ------------------------------------------------
|
|
133 int_I_pres_respiration = 3000;
|
|
134 for (i=0;i<150;i++)
|
|
135 deco_calc_hauptroutine();
|
116
|
136
|
167
|
137 while(char_O_deco_status != 0)
|
|
138 deco_calc_hauptroutine();
|
|
139 print_stops();
|
|
140 }
|