read bool param with read_db_bool (#2205)

* read bool param with read_db_bool

* Update selfdrive/loggerd/loggerd.cc

Co-authored-by: Willem Melching <willem.melching@gmail.com>

Co-authored-by: Willem Melching <willem.melching@gmail.com>
This commit is contained in:
Dean Lee 2020-09-22 00:17:35 +08:00 committed by GitHub
parent f55e79e46a
commit 0e5a5efffc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 8 deletions

View file

@ -113,8 +113,7 @@ void encoder_thread(bool is_streaming, bool raw_clips, int cam_idx) {
if (cam_idx == CAM_IDX_DCAM) {
// TODO: add this back
#ifndef QCOM2
std::vector<char> value = read_db_bytes("RecordFront");
if (value.size() == 0 || value[0] != '1') return;
if (!read_db_bool("RecordFront")) return;
LOGW("recording front camera");
#endif
set_thread_name("FrontCameraEncoder");
@ -461,8 +460,7 @@ kj::Array<capnp::word> gen_init_data() {
init.setGitRemote(capnp::Text::Reader(git_remote.data(), git_remote.size()));
}
std::vector<char> passive = read_db_bytes("Passive");
init.setPassive(passive.size() > 0 && passive[0] == '1');
init.setPassive(read_db_bool("Passive"));
{
// log params
std::map<std::string, std::string> params;

View file

@ -43,10 +43,7 @@ ParamsToggle::ParamsToggle(QString param, QString title, QString description, QS
setLayout(hlayout);
auto p = read_db_bytes(param.toStdString().c_str());
if (p.size()){
checkbox->setChecked(p[0] == '1');
}
checkbox->setChecked(read_db_bool(param.toStdString().c_str()));
setStyleSheet(R"(
QCheckBox { font-size: 70px }