few fixes from LGTM

albatross
Adeeb Shihadeh 2021-01-16 14:23:06 -08:00
parent 876602ba91
commit 758794dec5
4 changed files with 16 additions and 8 deletions

View File

@ -232,7 +232,7 @@ void fill_frame_image(cereal::FrameData::Builder &framed, const CameraBuf *b) {
memcpy(&resized_dat[(r*new_width+c)*3], &dat[goff+r*b->rgb_stride*scale+c*3*scale], 3*sizeof(uint8_t));
}
}
framed.setImage(kj::arrayPtr((const uint8_t*)resized_dat, new_width*new_height*3));
framed.setImage(kj::arrayPtr((const uint8_t*)resized_dat, (size_t)new_width*new_height*3));
delete[] resized_dat;
}

View File

@ -276,7 +276,6 @@ def thermald_thread():
# If device is offroad we want to cool down before going onroad
# since going onroad increases load and can make temps go over 107
# We only do this if there is a relay that prevents the car from faulting
thermal_status = ThermalStatus.green # default to good condition
is_offroad_for_5_min = (started_ts is None) and ((not started_seen) or (off_ts is None) or (sec_since_boot() - off_ts > 60 * 5))
if max_cpu_temp > 107. or bat_temp >= 63. or (is_offroad_for_5_min and max_cpu_temp > 70.0):
# onroad not allowed
@ -293,6 +292,8 @@ def thermald_thread():
elif max_cpu_temp > 75.0:
# hysteresis between uploader not allowed and all good
thermal_status = clip(thermal_status, ThermalStatus.green, ThermalStatus.yellow)
else:
thermal_status = ThermalStatus.green # default to good condition
# **** starting logic ****

View File

@ -74,6 +74,10 @@ LogReader::LogReader(const QString& file, Events *events_, QReadWriteLock* event
});
}
LogReader::~LogReader() {
delete parser;
}
void LogReader::mergeEvents(int dled) {
auto amsg = kj::arrayPtr((const capnp::word*)(raw.data() + event_offset), (dled-event_offset)/sizeof(capnp::word));
Events events_local;

View File

@ -1,5 +1,4 @@
#ifndef FILEREADER_HPP
#define FILEREADER_HPP
#pragma once
#include <QString>
#include <QNetworkAccessManager>
@ -20,7 +19,8 @@
#include "channel.hpp"
class FileReader : public QObject {
Q_OBJECT
Q_OBJECT
public:
FileReader(const QString& file_);
void startRequest(const QUrl &url);
@ -28,10 +28,13 @@ public:
virtual void readyRead();
void httpFinished();
virtual void done() {};
public slots:
void process();
protected:
QNetworkReply *reply;
private:
QNetworkAccessManager *qnam;
QElapsedTimer timer;
@ -44,9 +47,12 @@ class LogReader : public FileReader {
Q_OBJECT
public:
LogReader(const QString& file, Events *, QReadWriteLock* events_lock_, QMap<int, QPair<int, int> > *eidx_);
~LogReader();
void readyRead();
void done() { is_done = true; };
bool is_done = false;
private:
bz_stream bStream;
@ -63,6 +69,3 @@ private:
QReadWriteLock* events_lock;
QMap<int, QPair<int, int> > *eidx;
};
#endif