comparison Discovery/Src/vpm.c @ 907:46a21ff3f5ab Evo_2_23

Adaptation custom view deco plan for VPM: The VPM deco plan now shows the start of deco zone as well as the state of the deco table state. In case the table defined when reaching the deco zone is updated then the header line will change to yellow to indicate this. In case a deco stop is missed the head line will change to red.
author ideenmodellierer
date Sun, 13 Oct 2024 18:13:35 +0200
parents d4622533271d
children
comparison
equal deleted inserted replaced
906:49ee233c7a74 907:46a21ff3f5ab
130 static float rate_change[11]; 130 static float rate_change[11];
131 static short mix_change[11]; 131 static short mix_change[11];
132 132
133 static const _Bool vpm_b = true; 133 static const _Bool vpm_b = true;
134 134
135 static SvpmTableState vpmTableState = VPM_TABLE_INIT;
135 static SDecoinfo vpmTable; 136 static SDecoinfo vpmTable;
136 137
137 extern const float float_buehlmann_N2_factor_expositon_20_seconds[]; 138 extern const float float_buehlmann_N2_factor_expositon_20_seconds[];
138 extern const float float_buehlmann_He_factor_expositon_20_seconds[]; 139 extern const float float_buehlmann_He_factor_expositon_20_seconds[];
139 extern const float float_buehlmann_N2_factor_expositon_one_minute[]; 140 extern const float float_buehlmann_N2_factor_expositon_one_minute[];
191 static void BOYLES_LAW_COMPENSATION (float* First_Stop_Depth,float * Deco_Stop_Depth,float* Step_Size); 192 static void BOYLES_LAW_COMPENSATION (float* First_Stop_Depth,float * Deco_Stop_Depth,float* Step_Size);
192 static int vpm_calc_ndl(void); 193 static int vpm_calc_ndl(void);
193 static void vpm_init_1(void); 194 static void vpm_init_1(void);
194 static void vpm_calc_deco_ceiling(void); 195 static void vpm_calc_deco_ceiling(void);
195 196
197 uint8_t vpm_get_decozone(void);
198
196 static void vpm_init_1(void) 199 static void vpm_init_1(void)
197 { 200 {
198 units_equal_msw = true; 201 units_equal_msw = true;
199 units_equal_fsw = false; 202 units_equal_fsw = false;
200 altitude_dive_algorithm_off= true; //!Options: ON or OFF 203 altitude_dive_algorithm_off= true; //!Options: ON or OFF
239 { 242 {
240 if(pDecoInfo->output_stop_length_seconds[index] > 0) 243 if(pDecoInfo->output_stop_length_seconds[index] > 0)
241 { 244 {
242 if(decreaseStopTime) 245 if(decreaseStopTime)
243 { 246 {
244 if((pLifeData->depth_meter > (float)(actual_deco_stop - 0.5)) 247 if((pLifeData->depth_meter > (float)(actual_deco_stop - 1.5))
245 && (pLifeData->depth_meter < (float)actual_deco_stop + 1.5)) 248 && (pLifeData->depth_meter < (float)actual_deco_stop + 1.5))
246 { 249 {
247 pDecoInfo->output_stop_length_seconds[index]--; 250 pDecoInfo->output_stop_length_seconds[index]--;
251 decreaseStopTime = 0;
252 }
253 else if (pLifeData->depth_meter < (float)(actual_deco_stop - 1.5)) /* missed deco stop */
254 {
255 vpmTableState = VPM_TABLE_MISSED;
256 pDecoInfo->output_stop_length_seconds[index] = 0;
248 decreaseStopTime = 0; 257 decreaseStopTime = 0;
249 } 258 }
250 } 259 }
251 pDecoInfo->output_time_to_surface_seconds += pDecoInfo->output_stop_length_seconds[index]; 260 pDecoInfo->output_time_to_surface_seconds += pDecoInfo->output_stop_length_seconds[index];
252 } 261 }
333 { 342 {
334 if((int16_t)(pDECOINFO->output_time_to_surface_seconds - vpmTable.output_time_to_surface_seconds) > 60) 343 if((int16_t)(pDECOINFO->output_time_to_surface_seconds - vpmTable.output_time_to_surface_seconds) > 60)
335 { 344 {
336 memcpy(&vpmTable, pDECOINFO, sizeof(SDecoinfo)); 345 memcpy(&vpmTable, pDECOINFO, sizeof(SDecoinfo));
337 vpmTableActive = 1; 346 vpmTableActive = 1;
347 if(pVpm->deco_zone_reached) /* table should not change after deco zone was entered */
348 {
349 if(vpmTableState != VPM_TABLE_MISSED)
350 {
351 vpmTableState = VPM_TABLE_WARNING;
352 }
353 }
338 } 354 }
339 else 355 else
340 { 356 {
341 if(vpmTable.output_time_to_surface_seconds > 0) 357 if(vpmTable.output_time_to_surface_seconds > 0)
342 { 358 {
2487 } 2503 }
2488 2504
2489 void vpm_table_init() 2505 void vpm_table_init()
2490 { 2506 {
2491 vpmTable.output_time_to_surface_seconds = 0; 2507 vpmTable.output_time_to_surface_seconds = 0;
2508 vpmTableState = VPM_TABLE_INIT;
2492 } 2509 }
2493 2510 uint8_t vpm_get_decozone(void)
2511 {
2512 return((uint8_t)pVpm->depth_start_of_deco_zone_save);
2513 }
2514 SvpmTableState vpm_get_TableState(void)
2515 {
2516 return vpmTableState;
2517 }
2518