Skip to content

Commit

Permalink
Fix rear view mirror setting
Browse files Browse the repository at this point in the history
  • Loading branch information
espes committed Aug 29, 2017
1 parent 3de8509 commit 94fe677
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion selfdrive/controls/controlsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def __init__(self, gctx, rate=100):

# rear view camera state
self.rear_view_toggle = False
self.rear_view_allowed = bool(params.get("IsRearViewMirror"))
self.rear_view_allowed = (params.get("IsRearViewMirror") == "1")

self.v_cruise_kph = 255

This comment has been minimized.

Copy link
@hemangjoshi37a

hemangjoshi37a Sep 3, 2017

okay, awesome...

Expand Down

2 comments on commit 94fe677

@jduraes
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious: is a direct comparison better than casting the parameter into a bool expression, or is the latter rather just plain wrong??

@pjlao307
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The latter doesn't work because params.get("IsRearViewMirror") returns a string which when cast to bool will always return true.

Please sign in to comment.