forked from achamaikin/CCSModuleSW30Web
Send one-way Linux reboot notification (v1.0.39)
This commit is contained in:
1 parent
3b04e532af
commit
4f33a19387
7 files changed
+8836
-8821
No files matched your search
+1
-1
@@ -27,7 +27,7 @@ extern "C" {
|
|||||||
/* USER CODE BEGIN EC */
|
/* USER CODE BEGIN EC */
|
||||||
#define FW_VERSION_MAJOR 1
|
#define FW_VERSION_MAJOR 1
|
||||||
#define FW_VERSION_MINOR 0
|
#define FW_VERSION_MINOR 0
|
||||||
#define FW_VERSION_PATCH 38
|
#define FW_VERSION_PATCH 39
|
||||||
/* USER CODE END EC */
|
/* USER CODE END EC */
|
||||||
|
|
||||||
/* Exported macro ------------------------------------------------------------*/
|
/* Exported macro ------------------------------------------------------------*/
|
||||||
|
|||||||
@@ -31,6 +31,9 @@
|
|||||||
#define CMD_FIRE_ALARM 0xB7
|
#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_SUCCESS 0x12
|
||||||
#define RESP_FAILED 0x13
|
#define RESP_FAILED 0x13
|
||||||
#define RESP_INVALID 0x14
|
#define RESP_INVALID 0x14
|
||||||
|
|||||||
+10
-2
@@ -138,8 +138,16 @@ static void StopButtonControl(void){
|
|||||||
CONN.connControl = CMD_FORCE_UNLOCK;
|
CONN.connControl = CMD_FORCE_UNLOCK;
|
||||||
}
|
}
|
||||||
if(hold_time > 40000){
|
if(hold_time > 40000){
|
||||||
SC_SendPacket(NULL, 0, RESP_SUCCESS);
|
SC_SendPacket(NULL, 0, EVENT_HOST_REBOOT);
|
||||||
while(huart2.gState == HAL_UART_STATE_BUSY_TX);
|
{
|
||||||
|
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);
|
HAL_Delay(10);
|
||||||
NVIC_SystemReset();
|
NVIC_SystemReset();
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
+4411
-4409
File diff suppressed because it is too large.
Load diff
+4411
-4409
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user