[Bug]LG0 RTCA 例程下载失败
代码缺陷。
- 修复前:
# RTC的参数是BCD码形式,特殊处理,视图上21年在代码里要表示成0x21
if peri_name in ["RTC", "RTCA", "RTCB"] and (exp_value != "NULL") and ("0x" not in exp_value):
exp_value = "0x" + str(exp_value)
struct_dict["InitStruct"]["member"][m_key] = exp_value
- 修复后:
# RTC的参数是BCD码形式,特殊处理,视图上21年在代码里要表示成0x21
if peri_name in ["RTC", "RTCA", "RTCB"] and (exp_value != "NULL"):
if type(exp_value) is int:
exp_value = str(exp_value)
if "0x" not in exp_value:
exp_value = "0x" + str(exp_value)
struct_dict["InitStruct"]["member"][m_key] = exp_value