mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-02 12:02:09 +08:00
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: e958ce1c313f3dbe8724bf3d574bc12305862ebb
This commit is contained in:
@@ -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() {
|
||||
|
||||
+1
-2
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user