Send one-way Linux reboot notification (v1.0.39)

This commit is contained in:
raduet committed 2026-10-15 10:31:51 +02:00
1 parent 3b04e532af
commit 4f33a19387
7 files changed
+8836 -8821

No files matched your search

+1 -1
View File
@@ -27,7 +27,7 @@ extern "C" {
/* USER CODE BEGIN EC */
#define FW_VERSION_MAJOR 1
#define FW_VERSION_MINOR 0
#define FW_VERSION_PATCH 38
#define FW_VERSION_PATCH 39
/* USER CODE END EC */
/* Exported macro ------------------------------------------------------------*/
+3
View File
@@ -31,6 +31,9 @@
#define CMD_FIRE_ALARM 0xB7
// Коды ответов
/* One-way Linux reboot notification; no payload or acknowledgement. */
#define EVENT_HOST_REBOOT 0xB8
#define RESP_SUCCESS 0x12
#define RESP_FAILED 0x13
#define RESP_INVALID 0x14
+10 -2
View File
@@ -138,8 +138,16 @@ static void StopButtonControl(void){
CONN.connControl = CMD_FORCE_UNLOCK;
}
if(hold_time > 40000){
SC_SendPacket(NULL, 0, RESP_SUCCESS);
while(huart2.gState == HAL_UART_STATE_BUSY_TX);
SC_SendPacket(NULL, 0, EVENT_HOST_REBOOT);
{
uint32_t t0 = HAL_GetTick();
while(huart2.gState == HAL_UART_STATE_BUSY_TX){
if((HAL_GetTick() - t0) > 50u){
(void)HAL_UART_AbortTransmit(&huart2);
break;
}
}
}
HAL_Delay(10);
NVIC_SystemReset();
}