Commit 907e2ba3 authored by Wenxi XU's avatar Wenxi XU
Browse files

一些无关紧要的修改

parent 5a40db81
Loading
Loading
Loading
Loading
+9 −16
Original line number Diff line number Diff line
@@ -51,7 +51,7 @@ static void error_handle(struct AresProtocol *protocol, uint16_t req_id, uint16_
		return;
	}
	if (k_mutex_lock(&data->err_frame_mutex, K_NO_WAIT) != 0) {
		LOG_ERR("Failed to lock error frame mutex.");
		LOG_DBG("Failed to lock error frame mutex.");
		return;
	}
	GET_16BITS(data->error_frame_buf, ERROR_HEAD_IDX) = ERROR_FRAME_HEAD;
@@ -186,6 +186,13 @@ static void parse_sync(struct AresProtocol *protocol, uint8_t *buf, size_t len)
		return;
	}

	if (pack->len + SYNC_FRAME_LENGTH_OFFSET != len) {
		LOG_ERR("SYNC frame length mismatch: %d vs %d",
			pack->len + SYNC_FRAME_LENGTH_OFFSET, len);
		error_handle(protocol, pack->ID, UNKNOWN_TAIL);
		return;
	}

	if (pack->cb != NULL) {
		pack->cb(SYNC_PACK_STATUS_WRITE);
	}
@@ -377,22 +384,8 @@ static void rx_frame_parser(struct AresProtocol *protocol, uint8_t *buf, uint8_t
		parse_func(protocol, map);
		break;
	case SYNC_FRAME_HEAD:
		for (int i = 0; i < data->sync_cnt; i++) {
			if (data->sync_table[i].ID == GET_16BITS(buf, SYNC_ID_IDX)) {
				if (data->sync_table[i].len + SYNC_FRAME_LENGTH_OFFSET != len) {
					LOG_ERR("SYNC frame length mismatch: %d vs %d",
						data->sync_table[i].len + SYNC_FRAME_LENGTH_OFFSET,
						len);
					error_handle(protocol, data->sync_table[i].ID,
						     UNKNOWN_TAIL);
					return;
				}
		parse_sync(protocol, buf, len);
				break;
			}
		}
		LOG_DBG("SYNC frame received: ID %x", GET_16BITS(buf, SYNC_ID_IDX));

		break;
	case ERROR_FRAME_HEAD:
		if (len != ERROR_FRAME_LENGTH) {
+0 −2
Original line number Diff line number Diff line
@@ -172,9 +172,7 @@ void dual_call_func(struct AresProtocol *protocol, uint16_t ID, void *arg1, void
		.heart_beat_timer = {0},                                                           \
		.err_frame_mutex = {0},                                                            \
		.func_cnt = 0,                                                                     \
		.func_table = {0},                                                                 \
		.sync_cnt = 0,                                                                     \
		.sync_table = {0},                                                                 \
		.func_tx_bckup_msgq = {0},                                                         \
		.online = false,                                                                   \
	};                                                                                         \