mirror of
https://github.com/MoreTore/openpilot.git
synced 2026-08-04 15:56:08 +08:00
boardd: use setUbloxRaw to avoid memory alloc© in pigeon_publish_raw (#19884)
* use setUbloxRaw to avoid memory copy * const std::string &dat
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