mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-08-23 01:04:05 +08:00
f49a9c9fd2
* less TICI when not needed * fix process replay * move reading voltages into hw abstraction layer * Update selfdrive/hardware/tici/hardware.h Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> * Update selfdrive/hardware/hw.h Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> * Update selfdrive/hardware/base.h Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> * rename init function * Update selfdrive/athena/athenad.py Co-authored-by: Robbe Derks <robbe.derks@gmail.com> * Update selfdrive/boardd/boardd.cc * Apply suggestions from code review * Update selfdrive/thermald/thermald.py * update ref * fix alert width if all cameras are bad * add ecam to test_loggerd * bump cereal * bump cereal Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> Co-authored-by: Robbe Derks <robbe.derks@gmail.com>
45 lines
1.6 KiB
C++
45 lines
1.6 KiB
C++
#pragma once
|
|
|
|
#include <cstdlib>
|
|
#include <fstream>
|
|
|
|
#include "common/params.h"
|
|
#include "common/util.h"
|
|
#include "selfdrive/hardware/base.h"
|
|
|
|
class HardwareTici : public HardwareNone {
|
|
public:
|
|
static constexpr float MAX_VOLUME = 0.9;
|
|
static constexpr float MIN_VOLUME = 0.2;
|
|
static bool TICI() { return true; }
|
|
static bool AGNOS() { return true; }
|
|
static std::string get_os_version() {
|
|
return "AGNOS " + util::read_file("/VERSION");
|
|
};
|
|
static std::string get_name() { return "tici"; };
|
|
static cereal::InitData::DeviceType get_device_type() { return cereal::InitData::DeviceType::TICI; };
|
|
static int get_voltage() { return std::atoi(util::read_file("/sys/class/hwmon/hwmon1/in1_input").c_str()); };
|
|
static int get_current() { return std::atoi(util::read_file("/sys/class/hwmon/hwmon1/curr1_input").c_str()); };
|
|
|
|
|
|
static void reboot() { std::system("sudo reboot"); };
|
|
static void poweroff() { std::system("sudo poweroff"); };
|
|
static void set_brightness(int percent) {
|
|
std::ofstream brightness_control("/sys/class/backlight/panel0-backlight/brightness");
|
|
if (brightness_control.is_open()) {
|
|
brightness_control << (percent * (int)(1023/100.)) << "\n";
|
|
brightness_control.close();
|
|
}
|
|
};
|
|
static void set_display_power(bool on) {
|
|
std::ofstream bl_power_control("/sys/class/backlight/panel0-backlight/bl_power");
|
|
if (bl_power_control.is_open()) {
|
|
bl_power_control << (on ? "0" : "4") << "\n";
|
|
bl_power_control.close();
|
|
}
|
|
};
|
|
|
|
static bool get_ssh_enabled() { return Params().getBool("SshEnabled"); };
|
|
static void set_ssh_enabled(bool enabled) { Params().putBool("SshEnabled", enabled); };
|
|
};
|