ui: set max brightness when showing the QR code (#28907)

* set max brightness when showing the QR code

* set brightness in ui

* set in device
old-commit-hash: e958ce1c31
beeps
Dean Lee 2 years ago committed by GitHub
parent 9212a16e54
commit b8110a90d2
  1. 2
      selfdrive/ui/qt/widgets/prime.cc
  2. 3
      selfdrive/ui/ui.cc
  3. 6
      selfdrive/ui/ui.h

@ -26,10 +26,12 @@ PairingQRWidget::PairingQRWidget(QWidget* parent) : QWidget(parent) {
void PairingQRWidget::showEvent(QShowEvent *event) {
refresh();
timer->start(5 * 60 * 1000);
device()->setOffroadBrightness(100);
}
void PairingQRWidget::hideEvent(QHideEvent *event) {
timer->stop();
device()->setOffroadBrightness(BACKLIGHT_OFFROAD);
}
void PairingQRWidget::refresh() {

@ -14,7 +14,6 @@
#define BACKLIGHT_DT 0.05
#define BACKLIGHT_TS 10.00
#define BACKLIGHT_OFFROAD 50
// Projects a point in car to space to the corresponding point in full frame
// image space.
@ -299,7 +298,7 @@ void Device::resetInteractiveTimeout() {
}
void Device::updateBrightness(const UIState &s) {
float clipped_brightness = BACKLIGHT_OFFROAD;
float clipped_brightness = offroad_brightness;
if (s.scene.started) {
clipped_brightness = s.scene.light_sensor;

@ -20,6 +20,7 @@ const int UI_BORDER_SIZE = 30;
const int UI_HEADER_HEIGHT = 420;
const int UI_FREQ = 20; // Hz
const int BACKLIGHT_OFFROAD = 50;
typedef cereal::CarControl::HUDControl::AudibleAlert AudibleAlert;
const mat3 DEFAULT_CALIBRATION = {{ 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0 }};
@ -188,11 +189,16 @@ class Device : public QObject {
public:
Device(QObject *parent = 0);
bool isAwake() { return awake; }
void setOffroadBrightness(int brightness) {
offroad_brightness = std::clamp(brightness, 0, 100);
}
private:
bool awake = false;
int interactive_timeout = 0;
bool ignition_on = false;
int offroad_brightness = BACKLIGHT_OFFROAD;
int last_brightness = 0;
FirstOrderFilter brightness_filter;
QFuture<void> brightness_future;

Loading…
Cancel
Save