changeset 895:94535e672583 Evo_2_23

Zusammenf?hren
author heinrichsweikamp
date Wed, 18 Sep 2024 14:31:06 +0200
parents 9e2f9b91e827 (current diff) 1b05a84f6d0f (diff)
children f29369fff71e
files
diffstat 4 files changed, 83 insertions(+), 69 deletions(-) [+]
line wrap: on
line diff
--- a/Common/Inc/configuration.h	Wed Sep 18 14:30:45 2024 +0200
+++ b/Common/Inc/configuration.h	Wed Sep 18 14:31:06 2024 +0200
@@ -81,4 +81,7 @@
 /* Enable if the menu item predive check shall be available */
 /* #define ENABLE_PREDIVE_CHECK */
 
+/* Enable to have a faster transfer speed between bluetooth module and CPU */
+#define ENABLE_FAST_COMM
+
 #endif
--- a/Discovery/Src/data_central.c	Wed Sep 18 14:30:45 2024 +0200
+++ b/Discovery/Src/data_central.c	Wed Sep 18 14:31:06 2024 +0200
@@ -922,23 +922,27 @@
 #define SPEED_SLOW		(5.0f)
 #define SPEED_MEDIUM	(10.0f)
 #define SPEED_HIGH		(15.0f)
+#define SPEED_HYSTERESE (1.0f)
 
 uint8_t drawingColor_from_ascentspeed(float speed)
 {
+	static uint8_t lastColor = 0;
+
 	uint8_t color = CLUT_Font020;
 
-    if(speed >= SPEED_HIGH)
+    if((speed >= SPEED_HIGH) || ((lastColor == CLUT_WarningRed) && (speed >= SPEED_HIGH - SPEED_HYSTERESE)))
     {
     	color = CLUT_WarningRed;
     }
-    else if(speed >= SPEED_MEDIUM)
+    else if((speed >= SPEED_MEDIUM) || ((lastColor == CLUT_WarningYellow) && (speed >= SPEED_MEDIUM - SPEED_HYSTERESE)))
     {
     	color = CLUT_WarningYellow;
     }
-    else if(speed >= SPEED_SLOW)
+    else if((speed >= SPEED_SLOW) || ((lastColor == CLUT_NiceGreen) && (speed >= SPEED_SLOW - SPEED_HYSTERESE)))
     {
     	color = CLUT_NiceGreen;
     }
+    lastColor = color;
     return color;
 }
 
--- a/Discovery/Src/t7.c	Wed Sep 18 14:30:45 2024 +0200
+++ b/Discovery/Src/t7.c	Wed Sep 18 14:31:06 2024 +0200
@@ -2776,7 +2776,7 @@
 
 /* ascent rate graph */
 
-    if((pSettings->slowExitTime != 0) && (stateUsed->lifeData.depth_meter < pSettings->last_stop_depth_meter))
+    if((pSettings->slowExitTime != 0) && (pDecoinfo->output_time_to_surface_seconds == 0) && (stateUsed->lifeData.depth_meter < pSettings->last_stop_depth_meter))
     {
     	color = t7_drawSlowExitGraph();
     }
@@ -4726,86 +4726,88 @@
 	{
 		if(slowExitState != SE_END)
 		{
-			if(slowExitState == SE_INIT)
+			if((slowExitState == SE_INIT) && (stateUsed->lifeData.dive_time_seconds > 900)) /* min 15min divetime */
 			{
 				slowExitState = SE_ACTIVE;
 				exitSecTick = HAL_GetTick();
 			}
-			if(time_elapsed_ms(exitSecTick, HAL_GetTick()) > 1000)
+			else if(slowExitState == SE_ACTIVE)
 			{
-				exitSecTick = HAL_GetTick();
-
-				/* select depth digit color */
-				if(fabsf(stateUsed->lifeData.depth_meter - exitDepthMeter) < 0.5 )
+				if(time_elapsed_ms(exitSecTick, HAL_GetTick()) > 1000)
 				{
-					color = CLUT_NiceGreen;
+					exitSecTick = HAL_GetTick();
+
+					/* select depth digit color */
+					if(fabsf(stateUsed->lifeData.depth_meter - exitDepthMeter) < 0.5 )
+					{
+						color = CLUT_NiceGreen;
+					}
+					else if(fabsf(stateUsed->lifeData.depth_meter - exitDepthMeter) <= 1.5)
+					{
+						color = CLUT_WarningYellow;
+					}
+					else if(stateUsed->lifeData.depth_meter - exitDepthMeter < -1.5 )
+					{
+						color = CLUT_WarningRed;
+					}
+					else
+					{
+						color = 0;
+					}
+
+					if((fabsf(stateUsed->lifeData.depth_meter - exitDepthMeter) <= 1.6 ) /* only decrease counter if diver is close to target depth */
+							|| (color == CLUT_WarningRed))								 /* or if diver is far ahead */
+					{
+						countDownSec--;
+						if(countDownSec == 0)
+						{
+							slowExitState = SE_END;
+							color = 0;
+						}
+						exitDepthMeter -=  (pSettings->last_stop_depth_meter / (float)(pSettings->slowExitTime * 60));
+					}
 				}
-				else if(fabsf(stateUsed->lifeData.depth_meter - exitDepthMeter) <= 1.5)
+				if(!pSettings->FlipDisplay)
 				{
-					color = CLUT_WarningYellow;
-				}
-				else if(stateUsed->lifeData.depth_meter - exitDepthMeter < -1.5 )
-				{
-					color = CLUT_WarningRed;
+					start.y = t7l1.WindowY0 - 1;
 				}
 				else
 				{
-					color = 0;
+					start.y = t7l3.WindowY0 - 25;
 				}
 
-				if((fabsf(stateUsed->lifeData.depth_meter - exitDepthMeter) <= 1.6 ) /* only decrease counter if diver is close to target depth */
-						|| (color == CLUT_WarningRed))								 /* or if diver is far ahead */
+				for(index = 0; index < pSettings->last_stop_depth_meter; index++)	/* draw meter indicators */
 				{
-					countDownSec--;
-					if(countDownSec == 0)
-					{
-						slowExitState = SE_END;
-						color = 0;
-					}
-					exitDepthMeter -=  (pSettings->last_stop_depth_meter / (float)(pSettings->slowExitTime * 60));
+					start.y += drawingMeterStep;
+					stop.y = start.y;
+					start.x = CUSTOMBOX_LINE_LEFT - 1;
+					stop.x = start.x - 40;
+					GFX_draw_line(&t7screen, start, stop, 0);
 				}
-			}
-			if(!pSettings->FlipDisplay)
-			{
-				start.y = t7l1.WindowY0 - 1;
-			}
-			else
-			{
-				start.y = t7l3.WindowY0 - 25;
-			}
-
-			for(index = 0; index < pSettings->last_stop_depth_meter; index++)	/* draw meter indicators */
-			{
-				start.y += drawingMeterStep;
+
+				start.x = CUSTOMBOX_LINE_LEFT - CUSTOMBOX_OUTSIDE_OFFSET - 20;
+				stop.x = start.x;
+				if(!pSettings->FlipDisplay)
+				{
+					start.y = t7l1.WindowY0 + ASCENT_GRAPH_YPIXEL;
+				}
+				else
+				{
+					start.y = t7l3.WindowY0 - 25;
+				}
+				stop.y = start.y - countDownSec * (ASCENT_GRAPH_YPIXEL / (float)(pSettings->slowExitTime * 60.0));
+				if(stop.y >= 470)
+					stop.y = 470;
+
+				GFX_draw_thick_line(15,&t7screen, start, stop, 3);
+				/* mark diver depth */
+				start.x = CUSTOMBOX_LINE_LEFT - CUSTOMBOX_OUTSIDE_OFFSET - 25;
+				stop.x = start.x + 15;
+
+				start.y = start.y - (stateUsed->lifeData.depth_meter *120 / pSettings->last_stop_depth_meter);
 				stop.y = start.y;
-				start.x = CUSTOMBOX_LINE_LEFT - 1;
-				stop.x = start.x - 40;
-				GFX_draw_line(&t7screen, start, stop, 0);
-			}
-
-			start.x = CUSTOMBOX_LINE_LEFT - CUSTOMBOX_OUTSIDE_OFFSET - 20;
-			stop.x = start.x;
-			if(!pSettings->FlipDisplay)
-			{
-				start.y = t7l1.WindowY0 + ASCENT_GRAPH_YPIXEL;
+				GFX_draw_thick_line(10,&t7screen, start, stop, 9);
 			}
-			else
-			{
-				start.y = t7l3.WindowY0 - 25;
-			}
-			stop.y = start.y - countDownSec * (ASCENT_GRAPH_YPIXEL / (float)(pSettings->slowExitTime * 60.0));
-			if(stop.y >= 470)
-				stop.y = 470;
-
-			GFX_draw_thick_line(15,&t7screen, start, stop, 3);
-			/* mark diver depth */
-			start.x = CUSTOMBOX_LINE_LEFT - CUSTOMBOX_OUTSIDE_OFFSET - 25;
-			stop.x = start.x + 15;
-
-			start.y = start.y - (stateUsed->lifeData.depth_meter *120 / pSettings->last_stop_depth_meter);
-			stop.y = start.y;
-			GFX_draw_thick_line(10,&t7screen, start, stop, 9);
-			//GFX_draw_line(&t7screen, start, stop, 2);
 		}
 	}
 	return color;
--- a/Discovery/Src/tComm.c	Wed Sep 18 14:30:45 2024 +0200
+++ b/Discovery/Src/tComm.c	Wed Sep 18 14:31:06 2024 +0200
@@ -2193,7 +2193,12 @@
 			break;
 		case BM_CONFIG_SIGNAL_POLL:		sprintf(TxBuffer,"AT+BSTPOLL=100\r");
 			break;
-		case BM_CONFIG_BAUD:			sprintf(TxBuffer,"AT%%B22\r");
+		case BM_CONFIG_BAUD:
+#ifdef ENABLE_FAST_COMM
+										sprintf(TxBuffer,"AT%%B22\r");
+#else
+										BmTmpConfig++;
+#endif
 			break;
 		case BM_CONFIG_RETRY:			ConfigRetryCnt--;
 										HAL_Delay(1);
@@ -2260,7 +2265,7 @@
 				UartHandle.Init.BaudRate   = 460800;
 				HAL_UART_Init(&UartHandle);
 			}
-			if((BmTmpConfig == BM_CONFIG_BAUD) && (result == HAL_OK) && (UartHandle.Init.BaudRate == 460800)) /* This shut not happen because default speed is 115200 => update module configuration */
+			else if((BmTmpConfig == BM_CONFIG_BAUD) && (result == HAL_OK) && (UartHandle.Init.BaudRate == 460800)) /* This shut not happen because default speed is 115200 => update module configuration */
 			{
 				sprintf(TxBuffer,"AT%%B8\r");	/* set default baudrate */
 				CmdSize = strlen(TxBuffer);