Mercurial > public > ostc4
comparison Discovery/Src/t7.c @ 892:0e084e5554a8 Evo_2_23
Smal modification slow exit counter:
The slow exit counter is not only activated if deco obligations have been completed and if the dive time is longer than 15 minutes.
| author | ideenmodellierer |
|---|---|
| date | Tue, 10 Sep 2024 21:18:36 +0200 |
| parents | 940f8e132638 |
| children | f29369fff71e |
comparison
equal
deleted
inserted
replaced
| 891:a7f4451ba69e | 892:0e084e5554a8 |
|---|---|
| 2774 Gfx_colorsscheme_mod(TextL2, 0); | 2774 Gfx_colorsscheme_mod(TextL2, 0); |
| 2775 GFX_write_string(&FontT105,&t7l2,TextL2,1); | 2775 GFX_write_string(&FontT105,&t7l2,TextL2,1); |
| 2776 | 2776 |
| 2777 /* ascent rate graph */ | 2777 /* ascent rate graph */ |
| 2778 | 2778 |
| 2779 if((pSettings->slowExitTime != 0) && (stateUsed->lifeData.depth_meter < pSettings->last_stop_depth_meter)) | 2779 if((pSettings->slowExitTime != 0) && (pDecoinfo->output_time_to_surface_seconds == 0) && (stateUsed->lifeData.depth_meter < pSettings->last_stop_depth_meter)) |
| 2780 { | 2780 { |
| 2781 color = t7_drawSlowExitGraph(); | 2781 color = t7_drawSlowExitGraph(); |
| 2782 } | 2782 } |
| 2783 else if(stateUsed->lifeData.ascent_rate_meter_per_min > 1) /* a value < 1 would cause a bar in negative direction brush rectangle of 12 and step width of 6 */ | 2783 else if(stateUsed->lifeData.ascent_rate_meter_per_min > 1) /* a value < 1 would cause a bar in negative direction brush rectangle of 12 and step width of 6 */ |
| 2784 { | 2784 { |
| 4724 } | 4724 } |
| 4725 else | 4725 else |
| 4726 { | 4726 { |
| 4727 if(slowExitState != SE_END) | 4727 if(slowExitState != SE_END) |
| 4728 { | 4728 { |
| 4729 if(slowExitState == SE_INIT) | 4729 if((slowExitState == SE_INIT) && (stateUsed->lifeData.dive_time_seconds > 900)) /* min 15min divetime */ |
| 4730 { | 4730 { |
| 4731 slowExitState = SE_ACTIVE; | 4731 slowExitState = SE_ACTIVE; |
| 4732 exitSecTick = HAL_GetTick(); | 4732 exitSecTick = HAL_GetTick(); |
| 4733 } | 4733 } |
| 4734 if(time_elapsed_ms(exitSecTick, HAL_GetTick()) > 1000) | 4734 else if(slowExitState == SE_ACTIVE) |
| 4735 { | 4735 { |
| 4736 exitSecTick = HAL_GetTick(); | 4736 if(time_elapsed_ms(exitSecTick, HAL_GetTick()) > 1000) |
| 4737 | |
| 4738 /* select depth digit color */ | |
| 4739 if(fabsf(stateUsed->lifeData.depth_meter - exitDepthMeter) < 0.5 ) | |
| 4740 { | 4737 { |
| 4741 color = CLUT_NiceGreen; | 4738 exitSecTick = HAL_GetTick(); |
| 4739 | |
| 4740 /* select depth digit color */ | |
| 4741 if(fabsf(stateUsed->lifeData.depth_meter - exitDepthMeter) < 0.5 ) | |
| 4742 { | |
| 4743 color = CLUT_NiceGreen; | |
| 4744 } | |
| 4745 else if(fabsf(stateUsed->lifeData.depth_meter - exitDepthMeter) <= 1.5) | |
| 4746 { | |
| 4747 color = CLUT_WarningYellow; | |
| 4748 } | |
| 4749 else if(stateUsed->lifeData.depth_meter - exitDepthMeter < -1.5 ) | |
| 4750 { | |
| 4751 color = CLUT_WarningRed; | |
| 4752 } | |
| 4753 else | |
| 4754 { | |
| 4755 color = 0; | |
| 4756 } | |
| 4757 | |
| 4758 if((fabsf(stateUsed->lifeData.depth_meter - exitDepthMeter) <= 1.6 ) /* only decrease counter if diver is close to target depth */ | |
| 4759 || (color == CLUT_WarningRed)) /* or if diver is far ahead */ | |
| 4760 { | |
| 4761 countDownSec--; | |
| 4762 if(countDownSec == 0) | |
| 4763 { | |
| 4764 slowExitState = SE_END; | |
| 4765 color = 0; | |
| 4766 } | |
| 4767 exitDepthMeter -= (pSettings->last_stop_depth_meter / (float)(pSettings->slowExitTime * 60)); | |
| 4768 } | |
| 4742 } | 4769 } |
| 4743 else if(fabsf(stateUsed->lifeData.depth_meter - exitDepthMeter) <= 1.5) | 4770 if(!pSettings->FlipDisplay) |
| 4744 { | 4771 { |
| 4745 color = CLUT_WarningYellow; | 4772 start.y = t7l1.WindowY0 - 1; |
| 4746 } | |
| 4747 else if(stateUsed->lifeData.depth_meter - exitDepthMeter < -1.5 ) | |
| 4748 { | |
| 4749 color = CLUT_WarningRed; | |
| 4750 } | 4773 } |
| 4751 else | 4774 else |
| 4752 { | 4775 { |
| 4753 color = 0; | 4776 start.y = t7l3.WindowY0 - 25; |
| 4754 } | 4777 } |
| 4755 | 4778 |
| 4756 if((fabsf(stateUsed->lifeData.depth_meter - exitDepthMeter) <= 1.6 ) /* only decrease counter if diver is close to target depth */ | 4779 for(index = 0; index < pSettings->last_stop_depth_meter; index++) /* draw meter indicators */ |
| 4757 || (color == CLUT_WarningRed)) /* or if diver is far ahead */ | |
| 4758 { | 4780 { |
| 4759 countDownSec--; | 4781 start.y += drawingMeterStep; |
| 4760 if(countDownSec == 0) | 4782 stop.y = start.y; |
| 4761 { | 4783 start.x = CUSTOMBOX_LINE_LEFT - 1; |
| 4762 slowExitState = SE_END; | 4784 stop.x = start.x - 40; |
| 4763 color = 0; | 4785 GFX_draw_line(&t7screen, start, stop, 0); |
| 4764 } | |
| 4765 exitDepthMeter -= (pSettings->last_stop_depth_meter / (float)(pSettings->slowExitTime * 60)); | |
| 4766 } | 4786 } |
| 4787 | |
| 4788 start.x = CUSTOMBOX_LINE_LEFT - CUSTOMBOX_OUTSIDE_OFFSET - 20; | |
| 4789 stop.x = start.x; | |
| 4790 if(!pSettings->FlipDisplay) | |
| 4791 { | |
| 4792 start.y = t7l1.WindowY0 + ASCENT_GRAPH_YPIXEL; | |
| 4793 } | |
| 4794 else | |
| 4795 { | |
| 4796 start.y = t7l3.WindowY0 - 25; | |
| 4797 } | |
| 4798 stop.y = start.y - countDownSec * (ASCENT_GRAPH_YPIXEL / (float)(pSettings->slowExitTime * 60.0)); | |
| 4799 if(stop.y >= 470) | |
| 4800 stop.y = 470; | |
| 4801 | |
| 4802 GFX_draw_thick_line(15,&t7screen, start, stop, 3); | |
| 4803 /* mark diver depth */ | |
| 4804 start.x = CUSTOMBOX_LINE_LEFT - CUSTOMBOX_OUTSIDE_OFFSET - 25; | |
| 4805 stop.x = start.x + 15; | |
| 4806 | |
| 4807 start.y = start.y - (stateUsed->lifeData.depth_meter *120 / pSettings->last_stop_depth_meter); | |
| 4808 stop.y = start.y; | |
| 4809 GFX_draw_thick_line(10,&t7screen, start, stop, 9); | |
| 4767 } | 4810 } |
| 4768 if(!pSettings->FlipDisplay) | |
| 4769 { | |
| 4770 start.y = t7l1.WindowY0 - 1; | |
| 4771 } | |
| 4772 else | |
| 4773 { | |
| 4774 start.y = t7l3.WindowY0 - 25; | |
| 4775 } | |
| 4776 | |
| 4777 for(index = 0; index < pSettings->last_stop_depth_meter; index++) /* draw meter indicators */ | |
| 4778 { | |
| 4779 start.y += drawingMeterStep; | |
| 4780 stop.y = start.y; | |
| 4781 start.x = CUSTOMBOX_LINE_LEFT - 1; | |
| 4782 stop.x = start.x - 40; | |
| 4783 GFX_draw_line(&t7screen, start, stop, 0); | |
| 4784 } | |
| 4785 | |
| 4786 start.x = CUSTOMBOX_LINE_LEFT - CUSTOMBOX_OUTSIDE_OFFSET - 20; | |
| 4787 stop.x = start.x; | |
| 4788 if(!pSettings->FlipDisplay) | |
| 4789 { | |
| 4790 start.y = t7l1.WindowY0 + ASCENT_GRAPH_YPIXEL; | |
| 4791 } | |
| 4792 else | |
| 4793 { | |
| 4794 start.y = t7l3.WindowY0 - 25; | |
| 4795 } | |
| 4796 stop.y = start.y - countDownSec * (ASCENT_GRAPH_YPIXEL / (float)(pSettings->slowExitTime * 60.0)); | |
| 4797 if(stop.y >= 470) | |
| 4798 stop.y = 470; | |
| 4799 | |
| 4800 GFX_draw_thick_line(15,&t7screen, start, stop, 3); | |
| 4801 /* mark diver depth */ | |
| 4802 start.x = CUSTOMBOX_LINE_LEFT - CUSTOMBOX_OUTSIDE_OFFSET - 25; | |
| 4803 stop.x = start.x + 15; | |
| 4804 | |
| 4805 start.y = start.y - (stateUsed->lifeData.depth_meter *120 / pSettings->last_stop_depth_meter); | |
| 4806 stop.y = start.y; | |
| 4807 GFX_draw_thick_line(10,&t7screen, start, stop, 9); | |
| 4808 //GFX_draw_line(&t7screen, start, stop, 2); | |
| 4809 } | 4811 } |
| 4810 } | 4812 } |
| 4811 return color; | 4813 return color; |
| 4812 } | 4814 } |
| 4813 void t7_tick(void) | 4815 void t7_tick(void) |
