[Python] 纯文本查看 复制代码
{
"reg": {
// fmt: [c]: string, b: int8_t, B: uint8_t, h: int16_t, H: uint16_t, i: int32_t, I: uint32_t
// q: int64_t, Q: uint64_t, f: float, d: double
// show: 0: normal, 1: hex, 2: bytes
"list": [
[ 0x0000, 2, "H", 1, "magic_code", "Magic code: 0xcdcd" ],
[ 0x0002, 2, "H", 1, "conf_ver", "Config version" ],
[ 0x0004, 1, "B", 0, "conf_from", "0: default config, 1: all from flash, 2: partly from flash" ],
[ 0x0005, 1, "B", 0, "do_reboot", "1: reboot to bl, 2: reboot to app" ],
[ 0x0007, 1, "b", 0, "save_conf", "Write 1 to save current config to flash" ],
[ 0x000c, 1, "B", 1, "bus_cfg_mac", "RS-485 port id, range: 0~254" ],
[ 0x0010, 4, "I", 0, "bus_cfg_baud_l", "RS-485 baud rate for first byte" ],
[ 0x0014, 4, "I", 0, "bus_cfg_baud_h", "RS-485 baud rate for follow bytes" ],
// ...
[ 0x00bc, 4, "i", 0, "tc_pos", "Set target position" ],
[ 0x00c0, 4, "I", 0, "tc_speed", "Set target speed" ],
[ 0x00c4, 4, "I", 0, "tc_accel", "Set target accel" ],
[ 0x00c8, 4, "I", 0, "tc_accel_emg", "Set emergency accel" ],
[ 0x00d4, 4, "f", 0, "pid_pos_kp", "" ],
[ 0x00d8, 4, "f", 0, "pid_pos_ki", "" ],
[ 0x00dc, 4, "f", 0, "pid_pos_kd", "" ],
[ 0x0100, 4, "i", 0, "cal_pos", "PID input position" ],
[ 0x0104, 4, "f", 0, "cal_speed", "PID output speed" ],
[ 0x0108, 1, "B", 0, "state", "0: disable drive, 1: enable drive" ],
// --------------- Follows are not writable: -------------------
[ 0x0109, 1, "B", 0, "tc_state", "t_curve: 0: stop, 1: run" ],
[ 0x010c, 4, "i", 0, "cur_pos", "Motor current position" ],
[ 0x0110, 4, "f", 0, "tc_vc", "Motor current speed" ],
[ 0x0114, 4, "f", 0, "tc_ac", "Motor current accel" ],
[ 0x0124, 4, "I", 0, "loop_cnt", "Count for plot" ],
[ 0x0128, 10, "[c]", 0, "string_test", "String test" ]
],
// button groups
"reg_r": [["magic_code","save_conf"],["bus_cfg_mac","bus_cfg_tx_pre_len"],["dbg_en"],["qxchg_mcast"],
["qxchg_set","qxchg_ret"],["dbg_raw_msk"],["dbg_raw[0]","dbg_raw[1]"],["ref_volt","lim_en"],
["tc_pos","tc_accel"],["tc_accel_emg"],["pid_pos_kp","pid_pos_kd"],["cal_pos","cal_speed"],
["state"],["tc_state","cur_pos"],["tc_vc","tc_ac"],["loop_cnt"],["string_test"]],
"reg_w": [["magic_code","conf_ver"],["do_reboot"],["save_conf"],["bus_cfg_mac"],["bus_cfg_baud_l","bus_cfg_baud_h"],
["bus_cfg_filter_m"],["bus_cfg_mode"],["bus_cfg_tx_permit_len","bus_cfg_tx_pre_len"],["dbg_en"],
["qxchg_mcast"],["qxchg_set","qxchg_ret"],["dbg_raw_msk"],["dbg_raw[0]","dbg_raw[1]"],
["ref_volt","md_val"],["set_home"],["lim_en"],["tc_pos"],["tc_speed","tc_accel"],["tc_accel_emg"],
["pid_pos_kp","pid_pos_kd"],["state"],["string_test"]],
"less_r": [["tc_pos","tc_accel"],["state","loop_cnt"]],
"less_w": [["tc_pos"],["tc_speed","tc_accel"],["state"]]
},
"plot": {
"mask": "dbg_raw_msk",
"plots": [
{
// "color": ["black", "red", "green", ...]
"fmt": "I1.iBiiff",
"label": ["N", "tc_pos", "tc_state", "cal_pos", "cur_pos", "tc_vc", "tc_va"],
"cal": {
"pos_err": "_d[4].at(-1) - _d[3].at(-1)" // data4 - data3
},
"fft": {
"sample_rate": 5000,
"size": 4096
}
}, {
"fmt": "I1.ifif",
"label": ["N", "pid target", "i_term", "last_in", "cal_speed"]
}
]
},
"iap": { "reboot": 0x0005, "keep_bl": 0x0006 }
}