mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-04 21:12:07 +08:00
Add device_type to class Hardware (#20535)
* add device_type to HadWare class * always wake on PC * use cereal::InitData::DeviceType old-commit-hash: 9922688f8b43425b16b9be6e445dfa87348055e4
This commit is contained in:
@@ -2,13 +2,14 @@
|
||||
|
||||
#include <cstdlib>
|
||||
#include <fstream>
|
||||
|
||||
#include "cereal/gen/cpp/log.capnp.h"
|
||||
|
||||
// no-op base hw class
|
||||
class HardwareNone {
|
||||
public:
|
||||
static constexpr float MAX_VOLUME = 0;
|
||||
static constexpr float MIN_VOLUME = 0;
|
||||
static const cereal::InitData::DeviceType device_type = cereal::InitData::DeviceType::PC;
|
||||
|
||||
static std::string get_os_version() { return "openpilot for PC"; };
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@ class HardwareEon : public HardwareNone {
|
||||
public:
|
||||
static constexpr float MAX_VOLUME = 1.0;
|
||||
static constexpr float MIN_VOLUME = 0.5;
|
||||
static constexpr float MIN_VOLUME = 0.5;
|
||||
static const cereal::InitData::DeviceType device_type = cereal::InitData::DeviceType::EON;
|
||||
|
||||
static std::string get_os_version() {
|
||||
return "NEOS " + util::read_file("/VERSION");
|
||||
|
||||
@@ -11,6 +11,7 @@ class HardwareTici : public HardwareNone {
|
||||
public:
|
||||
static constexpr float MAX_VOLUME = 0.5;
|
||||
static constexpr float MIN_VOLUME = 0.4;
|
||||
static const cereal::InitData::DeviceType device_type = cereal::InitData::DeviceType::TICI;
|
||||
|
||||
static std::string get_os_version() {
|
||||
return "AGNOS " + util::read_file("/VERSION");
|
||||
|
||||
@@ -199,7 +199,8 @@ static void handle_display_state(UIState* s, bool user_input) {
|
||||
constexpr float accel_samples = 5*UI_FREQ;
|
||||
static float accel_prev = 0., gyro_prev = 0.;
|
||||
|
||||
bool should_wake = s->scene.started || s->scene.ignition || user_input;
|
||||
bool should_wake = s->scene.started || s->scene.ignition ||
|
||||
user_input || Hardware::device_type == cereal::InitData::DeviceType::PC;
|
||||
if (!should_wake) {
|
||||
// tap detection while display is off
|
||||
bool accel_trigger = abs(s->scene.accel_sensor - accel_prev) > 0.2;
|
||||
|
||||
Reference in New Issue
Block a user