优化消息代码
This commit is contained in:
@@ -800,13 +800,9 @@ vector<DriverCommand> Driver::loadDriverIdFromJson(const std::string &strJson) {
|
||||
{"launchControler", 37}, {"sideSonar", 35}, {"buoyage", 56}
|
||||
};
|
||||
|
||||
// 检查每个字段,如果存在且值发生变化,则添加到返回向量中
|
||||
for (const auto& [field, id] : fieldToId) {
|
||||
if (root.isMember(field)) {
|
||||
unsigned char newValue = root[field].asUInt();
|
||||
// unsigned char& currentValue = *((unsigned char*)&table + offsetof(DriverTable, depth1) +
|
||||
// (fieldToId.at(field) - 18) * sizeof(unsigned char));
|
||||
|
||||
DriverCommand cmd;
|
||||
cmd.id = id;
|
||||
cmd.cmd = newValue;
|
||||
|
||||
Reference in New Issue
Block a user