oem_tool 添加一些语法错误的提示

This commit is contained in:
2024-11-08 15:30:40 +08:00
parent daaf246e04
commit 156c4ef8b2

View File

@@ -925,6 +925,13 @@ uint8_t get_detail_info(char *buf, uint8_t category)
str_ptr[1] = strtok(NULL, split_str);
str_ptr[2] = strtok(NULL, split_str);
if (!str_ptr[0]) {
die("unresolvable string '%s' in %s, line:%d\n", buf, g_category_string[category], oem_tool.line_num);
}
if (!str_ptr[1]) {
die("missing second parameter '%s' in %s, line:%d\n", buf, g_category_string[category], oem_tool.line_num);
}
/* special category */
if (category == CATEGORY_GENERAL) {
if (!strcmp(str_ptr[0], "bid")) {
@@ -941,6 +948,8 @@ uint8_t get_detail_info(char *buf, uint8_t category)
} else if (!strcmp(str_ptr[0], "fver")) {
// ?
oemcfg.board_cfg_ver = atoi(str_ptr[1]);
} else {
die("unknown keyword with '%s' in %s, line:%d\n", str_ptr[1], g_category_string[category], oem_tool.line_num);
}
return 0;
} else if (category == CATEGORY_RC_HDR) {
@@ -975,6 +984,8 @@ uint8_t get_detail_info(char *buf, uint8_t category)
(uint8_t *)oem_tool.rc_list[i] + len_hdr,
sizeof(iot_board_info_v1_t) - len_hdr);
}
} else {
die("unknown keyword with '%s' in %s, line:%d\n", str_ptr[1], g_category_string[category], oem_tool.line_num);
}
return 0;
}
@@ -995,7 +1006,11 @@ uint8_t get_detail_info(char *buf, uint8_t category)
// 配置gpio
uint8_t number = atoi(str_ptr[0]);
uint8_t core = atoi(str_ptr[1]);
uint8_t purpose = atoi(str_ptr[2]);
uint8_t purpose = 255;
if (!str_ptr[2]) {
die("missing third parameter '%s' in %s, line:%d\n", buf, g_category_string[category], oem_tool.line_num);
}
purpose = atoi(str_ptr[2]);
rc_quantity_boundary_check(category, number);
set_peripheral_allot(category, number, core, purpose);
oem_tool.rc.device_last = number;