본딩 정보 삭제 후 재부팅 msr? 응답 로직 수정
- msr? 수신 시 rsr: 응답 후 disconnect - 버튼 본딩 정보 삭제 후 재부팅 로직과 동일하게 주황 LED 2초 표시 후 재부팅
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
#include <zephyr/kernel.h>
|
#include <zephyr/kernel.h>
|
||||||
#include <zephyr/sys/util.h>
|
#include <zephyr/sys/util.h>
|
||||||
|
#include <zephyr/sys/reboot.h>
|
||||||
#if IS_ENABLED(CONFIG_BT_SMP)
|
#if IS_ENABLED(CONFIG_BT_SMP)
|
||||||
#include <zephyr/bluetooth/bluetooth.h>
|
#include <zephyr/bluetooth/bluetooth.h>
|
||||||
#include <zephyr/bluetooth/conn.h>
|
#include <zephyr/bluetooth/conn.h>
|
||||||
@@ -65,28 +66,6 @@ int cmd_msr(const uint8_t *data, uint8_t data_len)
|
|||||||
ARG_UNUSED(data);
|
ARG_UNUSED(data);
|
||||||
ARG_UNUSED(data_len);
|
ARG_UNUSED(data_len);
|
||||||
|
|
||||||
#if IS_ENABLED(CONFIG_BT_SMP)
|
|
||||||
int err = bt_unpair(BT_ID_DEFAULT, NULL);
|
|
||||||
if (err)
|
|
||||||
{
|
|
||||||
status = (uint16_t)(-err);
|
|
||||||
DBG_ERR("[CMD] msr bt_unpair failed err=%d\r\n", err);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
led_set_state(LED_STATE_BOND_DELETE);
|
|
||||||
bond_data_delete = true;
|
|
||||||
ble_pairing_window_mark_reset_open();
|
|
||||||
DBG_PRINTF("[CMD] msr bond data deleted\r\n");
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
bond_data_delete = true;
|
|
||||||
ble_pairing_window_mark_reset_open();
|
|
||||||
DBG_PRINTF("[CMD] msr bond delete skipped (BT_SMP disabled)\r\n");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (status == 0x0000)
|
|
||||||
{
|
|
||||||
int nvs_err = app_nvs_save_production_done(1U);
|
int nvs_err = app_nvs_save_production_done(1U);
|
||||||
if (nvs_err)
|
if (nvs_err)
|
||||||
{
|
{
|
||||||
@@ -97,7 +76,6 @@ int cmd_msr(const uint8_t *data, uint8_t data_len)
|
|||||||
{
|
{
|
||||||
m_production_done = 1U;
|
m_production_done = 1U;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
int tx_err = cmd_send_response_u16("rsr:", status);
|
int tx_err = cmd_send_response_u16("rsr:", status);
|
||||||
if (tx_err)
|
if (tx_err)
|
||||||
@@ -108,7 +86,29 @@ int cmd_msr(const uint8_t *data, uint8_t data_len)
|
|||||||
|
|
||||||
if (status == 0x0000)
|
if (status == 0x0000)
|
||||||
{
|
{
|
||||||
|
led_set_state(LED_STATE_BOND_DELETE);
|
||||||
|
k_msleep(2000);
|
||||||
|
|
||||||
|
bond_data_delete = true;
|
||||||
|
ble_pairing_window_mark_reset_open();
|
||||||
|
ble_advertising_restart_suspend(true);
|
||||||
|
|
||||||
|
#if IS_ENABLED(CONFIG_BT_SMP)
|
||||||
|
int err = bt_unpair(BT_ID_DEFAULT, NULL);
|
||||||
|
if (err)
|
||||||
|
{
|
||||||
|
DBG_ERR("[CMD] msr bt_unpair failed err=%d\r\n", err);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DBG_PRINTF("[CMD] msr bond data deleted\r\n");
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
DBG_PRINTF("[CMD] msr bond delete skipped (BT_SMP disabled)\r\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
DBG_PRINTF("[CMD] msr complete -> production done, reboot\r\n");
|
DBG_PRINTF("[CMD] msr complete -> production done, reboot\r\n");
|
||||||
|
sys_reboot(SYS_REBOOT_COLD);
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd_reboot_after_response();
|
cmd_reboot_after_response();
|
||||||
|
|||||||
Reference in New Issue
Block a user