mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-06-23 03:32:07 +08:00
UI: better logic for Stand Still Timer (#28)
This commit is contained in:
@@ -333,6 +333,7 @@ void AnnotatedCameraWidget::updateState(const UIState &s) {
|
||||
setProperty("brakeLights", car_state.getBrakeLights() && s.scene.visual_brake_lights);
|
||||
|
||||
setProperty("standStillTimer", s.scene.stand_still_timer);
|
||||
setProperty("standStill", car_state.getStandstill());
|
||||
setProperty("standstillElapsedTime", sm["lateralPlan"].getLateralPlan().getStandstillElapsed());
|
||||
|
||||
// update engageability/experimental mode button
|
||||
@@ -501,7 +502,7 @@ void AnnotatedCameraWidget::drawHud(QPainter &p) {
|
||||
}
|
||||
|
||||
// Stand Still Timer
|
||||
if (standStillTimer && standstillElapsedTime != 0.0) {
|
||||
if (standStillTimer && standStill) {
|
||||
drawStandstillTimer(p, rect().right() - 650, 30 + 160 + 250);
|
||||
}
|
||||
p.restore();
|
||||
@@ -571,7 +572,7 @@ void AnnotatedCameraWidget::drawStandstillTimer(QPainter &p, int x, int y) {
|
||||
int minute = (int)(standstillElapsedTime / 60);
|
||||
int second = (int)((standstillElapsedTime) - (minute * 60));
|
||||
|
||||
if (standstillElapsedTime != 0) {
|
||||
if (standStill) {
|
||||
snprintf(lab_str, sizeof(lab_str), "STOP");
|
||||
snprintf(val_str, sizeof(val_str), "%01d:%02d", minute, second);
|
||||
}
|
||||
|
||||
@@ -78,6 +78,7 @@ class AnnotatedCameraWidget : public CameraWidget {
|
||||
Q_PROPERTY(bool brakeLights MEMBER brakeLights);
|
||||
|
||||
Q_PROPERTY(bool standStillTimer MEMBER standStillTimer);
|
||||
Q_PROPERTY(bool standStill MEMBER standStill);
|
||||
Q_PROPERTY(float standstillElapsedTime MEMBER standstillElapsedTime);
|
||||
|
||||
public:
|
||||
@@ -127,6 +128,7 @@ private:
|
||||
bool brakeLights;
|
||||
|
||||
bool standStillTimer;
|
||||
bool standStill;
|
||||
float standstillElapsedTime;
|
||||
|
||||
protected:
|
||||
|
||||
Reference in New Issue
Block a user