comparison Discovery/Src/tComm.c @ 1053:36fa1c44e597 Icon_Integration

Added upload command for icon: It is now possible to upload a custom icon which is shown during startup and while writing settings (instead of the HW string). The icons are limited to 256 colors and 800x480 pixels. The icon may not be larger than 200kByte because of storage avability. For upload the same CRC functions as for the common firmware updates are in use,
author Ideenmodellierer
date Wed, 31 Dec 2025 17:49:05 +0100
parents 1d7c7a36df15
children
comparison
equal deleted inserted replaced
1052:3029dd4398a5 1053:36fa1c44e597
114 #define UART_CMD_BUF_SIZE (30u) /* size of buffer for command exchange */ 114 #define UART_CMD_BUF_SIZE (30u) /* size of buffer for command exchange */
115 115
116 const uint8_t id_Region1_firmware = 0xFF; 116 const uint8_t id_Region1_firmware = 0xFF;
117 const uint8_t id_RTE = 0xFE; 117 const uint8_t id_RTE = 0xFE;
118 const uint8_t id_FONT = 0x10; 118 const uint8_t id_FONT = 0x10;
119 const uint8_t id_ICON = 0x20;
119 const uint8_t id_FONT_OLD = 0x00; 120 const uint8_t id_FONT_OLD = 0x00;
120 121
121 static BlueModTmpConfig_t BmTmpConfig = BM_CONFIG_OFF; /* Config BlueMod without storing the changes */ 122 static BlueModTmpConfig_t BmTmpConfig = BM_CONFIG_OFF; /* Config BlueMod without storing the changes */
122 static uint8_t EvaluateBluetoothSignalStrength = 0; 123 static uint8_t EvaluateBluetoothSignalStrength = 0;
123 #ifndef BOOTLOADER_STANDALONE 124 #ifndef BOOTLOADER_STANDALONE
689 case 0x85: // hw read entire logbook memory 690 case 0x85: // hw read entire logbook memory
690 case 0x86: // hw overwrite entire logbook memory 691 case 0x86: // hw overwrite entire logbook memory
691 case 0x87: // hw ext_flash_repair_SPECIAL_dive_numbers_starting_count_with memory(x) 692 case 0x87: // hw ext_flash_repair_SPECIAL_dive_numbers_starting_count_with memory(x)
692 case 0x88: /* read entire sample memory */ 693 case 0x88: /* read entire sample memory */
693 case 0x89: /* write entire sample memory */ 694 case 0x89: /* write entire sample memory */
694
695 #endif 695 #endif
696 case 0xC1: // Start low-level bootloader 696 case 0xC1: // Start low-level bootloader
697 if(HAL_UART_Transmit(&UartHandle, (uint8_t*)aTxBuffer, 1, UART_OPERATION_TIMEOUT)!= HAL_OK) 697 if(HAL_UART_Transmit(&UartHandle, (uint8_t*)aTxBuffer, 1, UART_OPERATION_TIMEOUT)!= HAL_OK)
698 return 0; 698 return 0;
699 break; 699 break;
1003 case 0x6A: // get model 1003 case 0x6A: // get model
1004 case 0x6B: // get specific firmware version 1004 case 0x6B: // get specific firmware version
1005 case 0x6C: /* Display Bluetooth signal strength */ 1005 case 0x6C: /* Display Bluetooth signal strength */
1006 case 0x6D: // get all compact headers (16 byte) 1006 case 0x6D: // get all compact headers (16 byte)
1007 case 0x6E: // display text 1007 case 0x6E: // display text
1008 case 0x6F: /* set icon */
1008 case 0x70: // read min, default, max setting 1009 case 0x70: // read min, default, max setting
1009 case 0x72: // read setting 1010 case 0x72: // read setting
1010 case 0x77: // write setting 1011 case 0x77: // write setting
1011 case 0x78: // reset all settings 1012 case 0x78: // reset all settings
1013
1012 if(HAL_UART_Transmit(&UartHandle, (uint8_t*)aTxBuffer, 1, 1000)!= HAL_OK) 1014 if(HAL_UART_Transmit(&UartHandle, (uint8_t*)aTxBuffer, 1, 1000)!= HAL_OK)
1013 return 0; 1015 return 0;
1014 break; 1016 break;
1015 1017
1016 // start communication (again) 1018 // start communication (again)
1316 case 0x77: 1318 case 0x77:
1317 writeData(aRxBuffer); 1319 writeData(aRxBuffer);
1318 updateSettingsAndMenuOnExit = 1; 1320 updateSettingsAndMenuOnExit = 1;
1319 aTxBuffer[count++] = prompt4D4C(receiveStartByteUart); 1321 aTxBuffer[count++] = prompt4D4C(receiveStartByteUart);
1320 break; 1322 break;
1323 case 0x6F:
1324 answer = receive_update_flex(1);
1325 if(answer == 0)
1326 {
1327 return 0;
1328 }
1329 else
1330 {
1331 aTxBuffer[count++] = prompt4D4C(receiveStartByteUart);
1332 }
1333 break;
1321 #else 1334 #else
1322 /* bootloader dummies */ 1335 /* bootloader dummies */
1323 // full headers (256 byte) 1336 // full headers (256 byte)
1324 case 0x61: 1337 case 0x61:
1325 for(int StepBackwards = 0;StepBackwards<256;StepBackwards++) 1338 for(int StepBackwards = 0;StepBackwards<256;StepBackwards++)
1548 uint8_t serialBuffer[10]; 1561 uint8_t serialBuffer[10];
1549 uint32_t length1, length2, lengthCompare, offsetCompare, ByteCompareStatus; 1562 uint32_t length1, length2, lengthCompare, offsetCompare, ByteCompareStatus;
1550 uint32_t lengthTotal, offsetTotal; 1563 uint32_t lengthTotal, offsetTotal;
1551 uint32_t checksum, checksumCalc = 0; 1564 uint32_t checksum, checksumCalc = 0;
1552 uint8_t id; 1565 uint8_t id;
1553 const uint8_t id_Region1_firmware = 0xFF;
1554 const uint8_t id_RTE = 0xFE;
1555 uint8_t textpointer = 0; 1566 uint8_t textpointer = 0;
1556 uint32_t index = 0; 1567 uint32_t index = 0;
1557 1568
1569 uint8_t* pWork1 = pBuffer1; /* the icon does not have an header included => data needs to be inserted before reading the image */
1570 uint32_t length1Work = 0;
1571
1558 //Get length 1572 //Get length
1559 if(HAL_UART_Receive(&UartHandle, sBuffer, 4,5000)!= HAL_OK) // 58000 1573 if(HAL_UART_Receive(&UartHandle, sBuffer, 4,5000)!= HAL_OK) // 58000
1560 { 1574 {
1561 return 0; 1575 return 0;
1562 } 1576 }
1563 lengthTotal = 256 * 256 * 256 * (uint32_t)sBuffer[0] + 256 * 256 * (uint32_t)sBuffer[1] + 256 * (uint32_t)sBuffer[2] + sBuffer[3]; 1577 lengthTotal = 256 * 256 * 256 * (uint32_t)sBuffer[0] + 256 * 256 * (uint32_t)sBuffer[1] + 256 * (uint32_t)sBuffer[2] + sBuffer[3];
1564 1578 length1Work = lengthTotal;
1565 //Get offset and/or id (id is 0xFF for RTE, 0xFE for firmware and offset if var) 1579 //Get offset and/or id (id is 0xFF for RTE, 0xFE for firmware and offset if var)
1566 if(HAL_UART_Receive(&UartHandle, sBuffer, 4,5000)!= HAL_OK) // 58000 1580 if(HAL_UART_Receive(&UartHandle, sBuffer, 4,5000)!= HAL_OK) // 58000
1567 { 1581 {
1568 return 0; 1582 return 0;
1569 } 1583 }
1571 1585
1572 checksumCalc = 256 * 256 * 256 * (uint32_t)sBuffer[0] + 256 * 256 * (uint32_t)sBuffer[1] + 256 * (uint32_t)sBuffer[2] + sBuffer[3]; 1586 checksumCalc = 256 * 256 * 256 * (uint32_t)sBuffer[0] + 256 * 256 * (uint32_t)sBuffer[1] + 256 * (uint32_t)sBuffer[2] + sBuffer[3];
1573 checksumCalc += lengthTotal; 1587 checksumCalc += lengthTotal;
1574 //old, does no longer work because of the fonts: checksumCalc = lengthTotal + offsetTotal; 1588 //old, does no longer work because of the fonts: checksumCalc = lengthTotal + offsetTotal;
1575 1589
1576 if((id != id_Region1_firmware) && (id != id_RTE) && (id != id_FONT) && (id != id_FONT_OLD)) 1590 if((id != id_Region1_firmware) && (id != id_RTE) && (id != id_FONT) && (id != id_FONT_OLD) && (id != id_ICON))
1577 { 1591 {
1578 return 0; 1592 return 0;
1593 }
1594
1595 if(id == id_ICON)
1596 {
1597 memcpy (pWork1, &lengthTotal,4);
1598 pWork1 +=4;
1599 length1Work += 4;
1579 } 1600 }
1580 1601
1581 // neu 110212 1602 // neu 110212
1582 if(id == id_FONT) 1603 if(id == id_FONT)
1583 { 1604 {
1585 /* todo set offset depending on font version offsetTotal = 0; */ 1606 /* todo set offset depending on font version offsetTotal = 0; */
1586 } 1607 }
1587 else 1608 else
1588 offsetTotal = 256 * 256 * 256 * (uint32_t)sBuffer[0] + 256 * 256 * (uint32_t)sBuffer[1] + 256 * (uint32_t)sBuffer[2] + sBuffer[3]; 1609 offsetTotal = 256 * 256 * 256 * (uint32_t)sBuffer[0] + 256 * 256 * (uint32_t)sBuffer[1] + 256 * (uint32_t)sBuffer[2] + sBuffer[3];
1589 1610
1611 if(id == id_ICON)
1612 {
1613 memcpy (pWork1, sBuffer,4);
1614 pWork1 +=4;
1615 length1Work += 4;
1616 }
1617
1590 // get checksum, bytes are in different order on Dev C++ code!!! 1618 // get checksum, bytes are in different order on Dev C++ code!!!
1591 if(HAL_UART_Receive(&UartHandle, sBuffer, 4,5000)!= HAL_OK) // 58000 1619 if(HAL_UART_Receive(&UartHandle, sBuffer, 4,5000)!= HAL_OK) // 58000
1592 { 1620 {
1593 return 0; 1621 return 0;
1594 } 1622 }
1595 checksum = 256 * 256 * 256 * (uint32_t)sBuffer[3] + 256 * 256 * (uint32_t)sBuffer[2] + 256 * (uint32_t)sBuffer[1] + sBuffer[0]; 1623 checksum = 256 * 256 * 256 * (uint32_t)sBuffer[3] + 256 * 256 * (uint32_t)sBuffer[2] + 256 * (uint32_t)sBuffer[1] + sBuffer[0];
1596 1624
1625 if(id == id_ICON)
1626 {
1627 memcpy (pWork1, sBuffer,4);
1628 pWork1 +=4;
1629 length1Work += 4;
1630 }
1597 1631
1598 if(checksumCalc != checksum) 1632 if(checksumCalc != checksum)
1599 { 1633 {
1600 uint8_t ptr = 0; 1634 uint8_t ptr = 0;
1601 strcpy(&display_text[ptr]," checksum error"); 1635 strcpy(&display_text[ptr]," checksum error");
1627 1661
1628 if((pBuffer2 == 0) && (length2 != 0)) 1662 if((pBuffer2 == 0) && (length2 != 0))
1629 return 0; 1663 return 0;
1630 1664
1631 //get Code 1665 //get Code
1632 if(receive_uart_large_size(&UartHandle, pBuffer1, length1)!= HAL_OK) 1666 if(receive_uart_large_size(&UartHandle, pWork1, length1)!= HAL_OK)
1633 return 0; 1667 return 0;
1634 1668
1635 if(length2) 1669 if(length2)
1636 if(receive_uart_large_size(&UartHandle, pBuffer2, length2)!= HAL_OK) 1670 if(receive_uart_large_size(&UartHandle, pBuffer2, length2)!= HAL_OK)
1637 return 0; 1671 return 0;
1643 checksum = 256 * 256 * 256 *(uint32_t)sBuffer[0] + 256 * 256 * (uint32_t)sBuffer[1] + 256 * (uint32_t)sBuffer[2] + sBuffer[3]; 1677 checksum = 256 * 256 * 256 *(uint32_t)sBuffer[0] + 256 * 256 * (uint32_t)sBuffer[1] + 256 * (uint32_t)sBuffer[2] + sBuffer[3];
1644 // uint32_t checksumCalc = crc32c_checksum(pBuffer1, length1, pBuffer2, length2); 1678 // uint32_t checksumCalc = crc32c_checksum(pBuffer1, length1, pBuffer2, length2);
1645 if(length2) 1679 if(length2)
1646 checksumCalc = CRC_CalcBlockCRC_moreThan768000((uint32_t*)pBuffer1, (uint32_t*)pBuffer2, lengthTotal/4); 1680 checksumCalc = CRC_CalcBlockCRC_moreThan768000((uint32_t*)pBuffer1, (uint32_t*)pBuffer2, lengthTotal/4);
1647 else 1681 else
1648 checksumCalc = CRC_CalcBlockCRC((uint32_t*)pBuffer1, length1/4); 1682 {
1649 1683 if(id == id_ICON)
1684 {
1685 checksumCalc = CRC_CalcBlockCRC((uint32_t*)(pBuffer1 + 12), length1/4); /* exclude header */
1686 }
1687 else
1688 {
1689 checksumCalc = CRC_CalcBlockCRC((uint32_t*)pBuffer1, length1/4);
1690 }
1691 }
1650 /* check id now */ 1692 /* check id now */
1651 /* 1693 /*
1652 if(region == 2) 1694 if(region == 2)
1653 { 1695 {
1654 if((id == id_Region1_firmware) || (id == id_RTE)) 1696 if((id == id_Region1_firmware) || (id == id_RTE))
1783 { 1825 {
1784 if(pBuffer2[index] != pBufferCompare[index]) 1826 if(pBuffer2[index] != pBufferCompare[index])
1785 ByteCompareStatus++; 1827 ByteCompareStatus++;
1786 } 1828 }
1787 } 1829 }
1830 else
1831 if(id == id_ICON)
1832 {
1833 firmware2_variable_upperpart_eraseFlashMemory(length1Work,0); /* flash is not in use => can be written immediately */
1834 firmware2_variable_upperpart_programFlashMemory(length1Work,0,pBuffer1,length1Work,0);
1835 ByteCompareStatus = 0; /* trust flashing for image use case */
1836 }
1788 1837
1789 releaseFrame(20,(uint32_t)pBufferCompare); 1838 releaseFrame(20,(uint32_t)pBufferCompare);
1790 1839
1791 if(ByteCompareStatus != 0) 1840 if(ByteCompareStatus != 0)
1792 { 1841 {
1794 display_text[255] = 21; 1843 display_text[255] = 21;
1795 return 0; 1844 return 0;
1796 } 1845 }
1797 else 1846 else
1798 { 1847 {
1799 strcpy(&display_text[0],"\n\rready to install."); 1848 if(id == id_ICON)
1849 {
1850 strcpy(&display_text[0],"\n\ricon stored.");
1851 }
1852 else
1853 {
1854 strcpy(&display_text[0],"\n\rready to install.");
1855 }
1800 display_text[255] = 21; 1856 display_text[255] = 21;
1801 return 1; 1857 return 1;
1802 } 1858 }
1803 } 1859 }
1804 1860
2019 { 2075 {
2020 EvaluateBluetoothSignalStrength = 1; 2076 EvaluateBluetoothSignalStrength = 1;
2021 } 2077 }
2022 2078
2023 /* read, validate the modul answer and flush rx que if necessary */ 2079 /* read, validate the modul answer and flush rx que if necessary */
2024 uint8_t tComm_CheckAnswerOK() 2080 uint8_t tComm_CheckAnswer(char* pAnswerExcepted)
2025 { 2081 {
2026 char answerOkay[] = "\r\nOK\r\n";
2027 char aRxBuffer[UART_CMD_BUF_SIZE]; 2082 char aRxBuffer[UART_CMD_BUF_SIZE];
2028 uint8_t sizeAnswer = sizeof(answerOkay) -1; 2083 uint8_t sizeAnswer =strlen(pAnswerExcepted) -1;
2029 uint8_t result = HAL_OK; 2084 uint8_t result = HAL_OK;
2030 uint8_t indexRef = 0; 2085 uint8_t indexRef = 0;
2031 uint8_t indexBuf = 0; 2086 uint8_t indexBuf = 0;
2032 uint8_t answer; 2087 uint8_t answer;
2033 2088
2034 memset(aRxBuffer,0,UART_CMD_BUF_SIZE); 2089 memset(aRxBuffer,0,UART_CMD_BUF_SIZE);
2035 if(HAL_UART_Receive(&UartHandle, (uint8_t*)aRxBuffer, sizeAnswer, UART_OPERATION_TIMEOUT) == HAL_OK) 2090 if(HAL_UART_Receive(&UartHandle, (uint8_t*)aRxBuffer, sizeAnswer, UART_OPERATION_TIMEOUT) == HAL_OK)
2036 { 2091 {
2037 do 2092 do
2038 { 2093 {
2039 if(answerOkay[indexRef] == aRxBuffer[indexBuf]) 2094 if(pAnswerExcepted[indexRef] == aRxBuffer[indexBuf])
2040 { 2095 {
2041 indexRef++; 2096 indexRef++;
2042 } 2097 }
2043 else 2098 else
2044 { 2099 {
2045 if(indexRef != 0) 2100 if(indexRef != 0)
2046 { 2101 {
2047 if((answerOkay[0] == aRxBuffer[indexBuf])) 2102 if((pAnswerExcepted[0] == aRxBuffer[indexBuf]))
2048 { 2103 {
2049 indexRef = 1; 2104 indexRef = 1;
2050 } 2105 }
2051 else 2106 else
2052 { 2107 {
2064 answer = HAL_ERROR; 2119 answer = HAL_ERROR;
2065 if (indexBuf < UART_CMD_BUF_SIZE) 2120 if (indexBuf < UART_CMD_BUF_SIZE)
2066 { 2121 {
2067 answer = HAL_UART_Receive(&UartHandle, (uint8_t*)&aRxBuffer[indexBuf], 1, 10); 2122 answer = HAL_UART_Receive(&UartHandle, (uint8_t*)&aRxBuffer[indexBuf], 1, 10);
2068 2123
2069 if(answerOkay[indexRef] == aRxBuffer[indexBuf]) 2124 if(pAnswerExcepted[indexRef] == aRxBuffer[indexBuf])
2070 { 2125 {
2071 indexRef++; 2126 indexRef++;
2072 } 2127 }
2073 else 2128 else
2074 { 2129 {
2092 } 2147 }
2093 return result; 2148 return result;
2094 2149
2095 } 2150 }
2096 2151
2152 /* read, validate the modul answer and flush rx que if necessary */
2153 uint8_t tComm_CheckAnswerOK()
2154 {
2155 char answerOkay[] = "\r\nOK\r\n";
2156 return tComm_CheckAnswer(answerOkay);
2157 }
2158
2159 uint8_t tComm_CheckAnswerMode(uint8_t reqMode)
2160 {
2161 char answerExpected[15];
2162 sprintf(answerExpected,"+UBTAD:%d\r\n",reqMode);
2163 return tComm_CheckAnswer(answerExpected);
2164 }
2097 2165
2098 void tComm_EvaluateBluetoothStrength(void) 2166 void tComm_EvaluateBluetoothStrength(void)
2099 { 2167 {
2100 char aTxBufferBarSSI[] = "AT+BARSSI\r"; 2168 char aTxBufferBarSSI[] = "AT+BARSSI\r";
2101 char aTxBufferEscapeSequence[] = "+++"; 2169 char aTxBufferEscapeSequence[] = "+++";
2253 { 2321 {
2254 strcpy(pCmdStr,"ATO1\r"); 2322 strcpy(pCmdStr,"ATO1\r");
2255 } 2323 }
2256 ret = 1; 2324 ret = 1;
2257 break; 2325 break;
2326 #ifdef ENABLE_PULSE_SENSOR_BT
2327 case BT_CMD_REQMODE: strcpy(pCmdStr,"AT+UBTLE?\r"); /* only available for OSTC5 */
2328 ret = 1;
2329 break;
2330 case BT_CMD_SETMODE: strcpy(pCmdStr,"AT+UBTLE=3\r"); /* only available for OSTC5 */
2331 ret = 1;
2332 break;
2333
2334
2335 case BT_CMD_WRITECONF: sprintf(pCmdStr,"AT&W0\r"); /* write settings into eeprom */
2336 break;
2337 case BT_CMD_RESTART: sprintf(pCmdStr,"AT+CPWROFF\r"); /* reboot module */
2338
2339 #endif
2258 default: 2340 default:
2259 break; 2341 break;
2260 } 2342 }
2261 return ret; 2343 return ret;
2262 } 2344 }
2337 configTick = HAL_GetTick(); 2419 configTick = HAL_GetTick();
2338 HAL_GPIO_WritePin(BLE_UBLOX_DSR_GPIO_PORT,BLE_UBLOX_DSR_PIN,GPIO_PIN_SET); 2420 HAL_GPIO_WritePin(BLE_UBLOX_DSR_GPIO_PORT,BLE_UBLOX_DSR_PIN,GPIO_PIN_SET);
2339 BmTmpConfig++; 2421 BmTmpConfig++;
2340 } 2422 }
2341 break; 2423 break;
2342 case BM_CONFIG5_BAUD: if(time_elapsed_ms(configTick, HAL_GetTick()) > 1100) 2424 #ifdef ENABLE_PULSE_SENSOR_BT
2425 case BM_CONFIG5_CHECKMODE: if(time_elapsed_ms(configTick, HAL_GetTick()) > 1100)
2426 {
2427 tComm_GetBTCmdStr(BT_CMD_REQMODE, TxBuffer);
2428 }
2429 break;
2430 case BM_CONFIG5_SETMODE: tComm_GetBTCmdStr(BT_CMD_SETMODE, TxBuffer);
2431 break;
2432 case BM_CONFIG5_WRITECONF: tComm_GetBTCmdStr(BT_CMD_WRITECONF, TxBuffer);
2433 break;
2434 case BM_CONFIG5_RESTART: tComm_GetBTCmdStr(BT_CMD_RESTART, TxBuffer);
2435 break;
2436 #endif
2437 case BM_CONFIG5_BAUD:
2438 #ifndef ENABLE_PULSE_SENSOR_BT
2439 if(time_elapsed_ms(configTick, HAL_GetTick()) > 1100)
2440 #endif
2343 { 2441 {
2344 tComm_GetBTCmdStr(BT_CMD_BAUDRATE_460, TxBuffer); 2442 tComm_GetBTCmdStr(BT_CMD_BAUDRATE_460, TxBuffer);
2345 } 2443 }
2346 break; 2444 break;
2347 case BM_CONFIG5_DATAMODE: tComm_GetBTCmdStr(BT_CMD_EXIT_CMD, TxBuffer); 2445 case BM_CONFIG5_DATAMODE: tComm_GetBTCmdStr(BT_CMD_EXIT_CMD, TxBuffer);
2348 break; 2446 break;
2349
2350 default: 2447 default:
2351 break; 2448 break;
2352 } 2449 }
2353 if(TxBuffer[0] != 0) /* forward command to module */ 2450 if(TxBuffer[0] != 0) /* forward command to module */
2354 { 2451 {
2355 CmdSize = strlen(TxBuffer); 2452 CmdSize = strlen(TxBuffer);
2356 result = HAL_UART_Transmit(&UartHandle, (uint8_t*)TxBuffer,CmdSize, 500); 2453 result = HAL_UART_Transmit(&UartHandle, (uint8_t*)TxBuffer,CmdSize, 500);
2357 if(result == HAL_OK) 2454 if(result == HAL_OK)
2358 { 2455 {
2359 result = tComm_CheckAnswerOK(); 2456 #ifdef ENABLE_PULSE_SENSOR_BT
2360 2457 if(BmTmpConfig == BM_CONFIG5_CHECKMODE)
2458 {
2459 result = tComm_CheckAnswerMode(3);
2460 if (result == HAL_OK)
2461 {
2462 BmTmpConfig = BM_CONFIG5_RESTART; /* mode correct => skip reconfig */
2463 }
2464 else
2465 {
2466 BmTmpConfig = BM_CONFIG5_SETMODE;
2467 }
2468 }
2469 else
2470 #endif
2471 {
2472 result = tComm_CheckAnswerOK();
2473 }
2361 if(((BmTmpConfig == BM_CONFIG_BAUD) || (BmTmpConfig == BM_CONFIG5_BAUD)) && (result == HAL_OK) && (UartHandle.Init.BaudRate != 460800)) /* is com already switched to fast speed? */ 2474 if(((BmTmpConfig == BM_CONFIG_BAUD) || (BmTmpConfig == BM_CONFIG5_BAUD)) && (result == HAL_OK) && (UartHandle.Init.BaudRate != 460800)) /* is com already switched to fast speed? */
2362 { 2475 {
2363 HAL_UART_DeInit(&UartHandle); 2476 HAL_UART_DeInit(&UartHandle);
2364 HAL_Delay(1); 2477 HAL_Delay(1);
2365 UartHandle.Init.BaudRate = 460800; 2478 UartHandle.Init.BaudRate = 460800;
2386 BmTmpConfig++; 2499 BmTmpConfig++;
2387 } 2500 }
2388 else 2501 else
2389 { 2502 {
2390 HAL_GPIO_WritePin(BLE_UBLOX_DSR_GPIO_PORT,BLE_UBLOX_DSR_PIN,GPIO_PIN_RESET); 2503 HAL_GPIO_WritePin(BLE_UBLOX_DSR_GPIO_PORT,BLE_UBLOX_DSR_PIN,GPIO_PIN_RESET);
2391 BmTmpConfig = BM_CONFIG_DONE; 2504 #ifdef ENABLE_PULSE_SENSOR_BT
2505 if(BmTmpConfig == BM_CONFIG5_RESTART)
2506 {
2507 settingsGetPointer()->bluetoothActive = 0;
2508 BmTmpConfig = BM_CONFIG_OFF;
2509 }
2510 else
2511 #endif
2512 {
2513 BmTmpConfig = BM_CONFIG_DONE;
2514 }
2392 } 2515 }
2393 } 2516 }
2394 } 2517 }
2395 } 2518 }
2396 else /* no command for the configuration step found => skip step */ 2519 else /* no command for the configuration step found => skip step */