|
|
@@ -428,16 +428,24 @@ __AIRLINK_CODE_IN_RAM__ static void spi_master_task(void *param)
|
|
|
g_airlink_newdata_notify_cb = on_newdata_notify;
|
|
|
g_airlink_link_data_cb = on_link_data_notify;
|
|
|
|
|
|
+ uint32_t start_wait_time = luat_mcu_tick64_ms();
|
|
|
+ uint32_t rdy_timeout_ms = 1000;
|
|
|
// 等待RDY就绪,防止从机未准备好就发送数据
|
|
|
luat_event_t event = {0};
|
|
|
while (1)
|
|
|
{
|
|
|
// bk的从机task在开机的时候会塞一包数据(只有0x72),这个时候会拉低RDY,以此触发中断
|
|
|
int ret = luat_rtos_queue_recv(rdy_evt_queue, &event, sizeof(luat_event_t), 10);
|
|
|
- if (ret == 0 && event.id == 6)
|
|
|
+ if (ret == 0 && event.id == 6) {
|
|
|
+ LLOGI("从机RDY就绪");
|
|
|
break;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (luat_mcu_tick64_ms() - start_wait_time > rdy_timeout_ms) {
|
|
|
+ LLOGE("等待从机RDY超时");
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
- LLOGD("airlink slave ready");
|
|
|
|
|
|
while (1)
|
|
|
{
|