mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-10-01 03:53:45 +08:00
canbana: complete basic functions (#25965)
* add chart header
* get all signal val from logs
* loop in selected range
* clear list before append
* automatically zoom on yaxis
* cleanup
* sync charts
* fix event_begin_sec
* set the color of rubber
* add TODO
* sync slider with charts
* keep video aspect ratio
* sync plot buttons
* reduce flickers
* cleanup
* refactor detail view
* clear counters
* more
use qcamera
old-commit-hash: a6ba073231
This commit is contained in:
@@ -46,7 +46,9 @@ LogReader::~LogReader() {
|
||||
#endif
|
||||
}
|
||||
|
||||
bool LogReader::load(const std::string &url, std::atomic<bool> *abort, bool local_cache, int chunk_size, int retries) {
|
||||
bool LogReader::load(const std::string &url, std::atomic<bool> *abort,
|
||||
const std::set<cereal::Event::Which> &allow,
|
||||
bool local_cache, int chunk_size, int retries) {
|
||||
raw_ = FileReader(local_cache, chunk_size, retries).read(url, abort);
|
||||
if (raw_.empty()) return false;
|
||||
|
||||
@@ -54,18 +56,26 @@ bool LogReader::load(const std::string &url, std::atomic<bool> *abort, bool loca
|
||||
raw_ = decompressBZ2(raw_, abort);
|
||||
if (raw_.empty()) return false;
|
||||
}
|
||||
return parse(abort);
|
||||
return parse(allow, abort);
|
||||
}
|
||||
|
||||
bool LogReader::load(const std::byte *data, size_t size, std::atomic<bool> *abort) {
|
||||
raw_.assign((const char *)data, size);
|
||||
return parse(abort);
|
||||
return parse({}, abort);
|
||||
}
|
||||
|
||||
bool LogReader::parse(std::atomic<bool> *abort) {
|
||||
bool LogReader::parse(const std::set<cereal::Event::Which> &allow, std::atomic<bool> *abort) {
|
||||
try {
|
||||
kj::ArrayPtr<const capnp::word> words((const capnp::word *)raw_.data(), raw_.size() / sizeof(capnp::word));
|
||||
while (words.size() > 0 && !(abort && *abort)) {
|
||||
if (!allow.empty()) {
|
||||
capnp::FlatArrayMessageReader reader(words);
|
||||
auto which = reader.getRoot<cereal::Event>().which();
|
||||
if (allow.find(which) == allow.end()) {
|
||||
words = kj::arrayPtr(reader.getEnd(), words.end());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAS_MEMORY_RESOURCE
|
||||
Event *evt = new (mbr_) Event(words);
|
||||
|
||||
Reference in New Issue
Block a user