comparison Discovery/Src/tComm.c @ 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 74be24428049
children 1d7c7a36df15
comparison
equal deleted inserted replaced
1043:52fd91414b6c 1045:b018e1f3082e
2255 { 2255 {
2256 uint8_t answer = HAL_OK; 2256 uint8_t answer = HAL_OK;
2257 uint8_t RxBuffer[UART_CMD_BUF_SIZE]; 2257 uint8_t RxBuffer[UART_CMD_BUF_SIZE];
2258 uint8_t index = 0; 2258 uint8_t index = 0;
2259 2259
2260 BmTmpConfig = BM_CONFIG_ECHO;
2261 do /* flush RX buffer */ 2260 do /* flush RX buffer */
2262 { 2261 {
2263 answer = HAL_UART_Receive(&UartHandle, (uint8_t*)&RxBuffer[index], 1, 10); 2262 answer = HAL_UART_Receive(&UartHandle, (uint8_t*)&RxBuffer[index], 1, 10);
2264 if(index < UART_CMD_BUF_SIZE) index++; 2263 if(index < UART_CMD_BUF_SIZE) index++;
2265 }while(answer == HAL_OK); 2264 }while(answer == HAL_OK);
2265
2266 if (isNewDisplay())
2267 {
2268 BmTmpConfig = BM_CONFIG_DONE; /* Configuration is stored in BT module => no configuration needed */
2269 }
2270 else
2271 {
2272 BmTmpConfig = BM_CONFIG_ECHO;
2273 }
2266 } 2274 }
2267 2275
2268 uint8_t tComm_HandleBlueModConfig() 2276 uint8_t tComm_HandleBlueModConfig()
2269 { 2277 {
2270 static uint8_t RestartModule = 1; /* used to do power off / on cycle */ 2278 static uint8_t RestartModule = 1; /* used to do power off / on cycle */
2350 break; 2358 break;
2351 } 2359 }
2352 if(TxBuffer[0] != 0) /* forward command to module */ 2360 if(TxBuffer[0] != 0) /* forward command to module */
2353 { 2361 {
2354 CmdSize = strlen(TxBuffer); 2362 CmdSize = strlen(TxBuffer);
2355 if(HAL_UART_Transmit(&UartHandle, (uint8_t*)TxBuffer,CmdSize, 2000) == HAL_OK) 2363 result = HAL_UART_Transmit(&UartHandle, (uint8_t*)TxBuffer,CmdSize, 500);
2364 if(result == HAL_OK)
2356 { 2365 {
2357 result = tComm_CheckAnswerOK(); 2366 result = tComm_CheckAnswerOK();
2358 2367
2359 if((BmTmpConfig == BM_CONFIG_BAUD) && (result == HAL_OK) && (UartHandle.Init.BaudRate != 460800)) /* is com already switched to fast speed? */ 2368 if((BmTmpConfig == BM_CONFIG_BAUD) && (result == HAL_OK) && (UartHandle.Init.BaudRate != 460800)) /* is com already switched to fast speed? */
2360 { 2369 {
2383 if(BmTmpConfig == BM_CONFIG_RETRY) 2392 if(BmTmpConfig == BM_CONFIG_RETRY)
2384 { 2393 {
2385 BmTmpConfig = BM_CONFIG_DONE; 2394 BmTmpConfig = BM_CONFIG_DONE;
2386 } 2395 }
2387 } 2396 }
2397 #if 0
2388 if(BmTmpConfig == BM_CONFIG_ECHO) 2398 if(BmTmpConfig == BM_CONFIG_ECHO)
2389 { 2399 {
2390 BmTmpConfig = BM_CONFIG_DONE; 2400 BmTmpConfig = BM_CONFIG_DONE;
2391 ConfigRetryCnt = 0; 2401 ConfigRetryCnt = 0;
2392 RestartModule = 1; 2402 RestartModule = 1;
2393 } 2403 }
2404 #endif
2394 } 2405 }
2395 } 2406 }
2396 else /* no command for the configuration step found => skip step */ 2407 else /* no command for the configuration step found => skip step */
2397 { 2408 {
2398 if((BmTmpConfig > BM_CONFIG_OFF) && (BmTmpConfig < BM_CONFIG_DONE)) 2409 if((BmTmpConfig > BM_CONFIG_OFF) && (BmTmpConfig < BM_CONFIG_DONE))