mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-06-30 02:52:04 +08:00
boardd: use setUbloxRaw to avoid memory alloc© in pigeon_publish_raw (#19884)
* use setUbloxRaw to avoid memory copy * const std::string &dat old-commit-hash: 0f8b5db8cefdd53c06ffd4867b8915d12f6e4603
This commit is contained in:
@@ -462,16 +462,14 @@ void hardware_control_thread() {
|
||||
}
|
||||
}
|
||||
|
||||
static void pigeon_publish_raw(PubMaster &pm, std::string dat) {
|
||||
static void pigeon_publish_raw(PubMaster &pm, const std::string &dat) {
|
||||
// create message
|
||||
MessageBuilder msg;
|
||||
auto ublox_raw = msg.initEvent().initUbloxRaw(dat.length());
|
||||
memcpy(ublox_raw.begin(), dat.data(), dat.length());
|
||||
|
||||
capnp::Data::Builder ublox_row((uint8_t*)dat.data(), dat.length());
|
||||
msg.initEvent().setUbloxRaw(ublox_row);
|
||||
pm.send("ubloxRaw", msg);
|
||||
}
|
||||
|
||||
|
||||
void pigeon_thread() {
|
||||
if (!panda->is_pigeon){ return; };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user