changeset 1045:b018e1f3082e GasConsumption

Deactivate OSTC5 BT init sequence: At the moment the OSTC BT is preconfigurated and starting in data mode => skip BT config in case a OSTC5 HW is detected
author Ideenmodellierer
date Mon, 03 Nov 2025 21:17:14 +0100
parents 52fd91414b6c
children 1d7c7a36df15
files Discovery/Src/base.c Discovery/Src/tComm.c
diffstat 2 files changed, 19 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/Discovery/Src/base.c	Mon Oct 27 20:09:23 2025 +0100
+++ b/Discovery/Src/base.c	Mon Nov 03 21:17:14 2025 +0100
@@ -382,7 +382,6 @@
 
     MX_GPIO_Init();
     //  MX_SmallCPU_NO_Reset_Helper();	 //161116 hw
-    MX_Bluetooth_PowerOff();	/* disable module, needed in case of e.g. a reset event to make sure module is configured from scratch */
     MX_SPI_Init();
     MX_UART_Init();
     SDRAM_Config();
@@ -403,11 +402,6 @@
     GFX_init( &pLayerInvisible );
     TIM_BACKLIGHT_init();
 
-    // new 170508: bluetooth on at start
-    settingsGetPointer()->bluetoothActive = 1;
-    MX_Bluetooth_PowerOn();
-    tComm_StartBlueModConfig();
-
     /*
     if( (hardwareDataGetPointer()->primarySerial == 20+18)
      || (hardwareDataGetPointer()->primarySerial == 20+25)
@@ -442,6 +436,12 @@
     display_power_on__2_of_2__post_RGB();
     GFX_use_colorscheme( settingsGetPointer()->tX_colorscheme );
 
+
+    // new 170508: bluetooth on at start
+    settingsGetPointer()->bluetoothActive = 1;
+    MX_Bluetooth_PowerOn();
+    tComm_StartBlueModConfig();
+
     tHome_init();
     tI_init();
     tM_init();
--- a/Discovery/Src/tComm.c	Mon Oct 27 20:09:23 2025 +0100
+++ b/Discovery/Src/tComm.c	Mon Nov 03 21:17:14 2025 +0100
@@ -2257,12 +2257,20 @@
 	uint8_t RxBuffer[UART_CMD_BUF_SIZE];
 	uint8_t index = 0;
 
-	BmTmpConfig = BM_CONFIG_ECHO;
 	do	/* flush RX buffer */
 	{
 		answer = HAL_UART_Receive(&UartHandle, (uint8_t*)&RxBuffer[index], 1, 10);
 		if(index < UART_CMD_BUF_SIZE) index++;
 	}while(answer == HAL_OK);
+
+	if (isNewDisplay())
+	{
+		BmTmpConfig = BM_CONFIG_DONE;	/* Configuration is stored in BT module => no configuration needed */
+	}
+	else
+	{
+		BmTmpConfig = BM_CONFIG_ECHO;
+	}
 }
 
 uint8_t tComm_HandleBlueModConfig()
@@ -2352,7 +2360,8 @@
 	if(TxBuffer[0] != 0)		/* forward command to module */
 	{
 		CmdSize = strlen(TxBuffer);
-		if(HAL_UART_Transmit(&UartHandle, (uint8_t*)TxBuffer,CmdSize, 2000) == HAL_OK)
+		result = HAL_UART_Transmit(&UartHandle, (uint8_t*)TxBuffer,CmdSize, 500);
+		if(result == HAL_OK)
 		{
 			result = tComm_CheckAnswerOK();
 
@@ -2385,12 +2394,14 @@
 					BmTmpConfig = BM_CONFIG_DONE;
 				}
 			}
+#if 0
 			if(BmTmpConfig == BM_CONFIG_ECHO)
 			{
 				BmTmpConfig = BM_CONFIG_DONE;
 				ConfigRetryCnt = 0;
 				RestartModule = 1;
 			}
+#endif
 		}
 	}
 	else		/* no command for the configuration step found => skip step */