joy-it/Joy-Car

Indicators and hazard light do not work as expected

Opened this issue · 0 comments

Thanks for providing Joy-Car hardware and software. This is an excellent learning tool.

One of the first things I realized when using Joy-Car is that the indicator and hazard lights do "not work". Later I realized, they do work, jut not intuitively:

When turning on an indicator via JoyCar.hazardlights(ToggleSwitch.On) the hazard lights will not reproducibly go on. In fact, if they have been on once before (maybe half an hour before), they will immediately "start" a new "off" blinking phase. And if JoyCar.hazardlights(ToggleSwitch.On) is not called again and again then the hazard lights will not come on at all.

The left and right indicators have the same bug. The bug is introduced by the statefulness of the hazardBool, indicatorLeftBool, indicatorRightBool and lightIndicatorInterval variables which are never reset, regardless whether indicators(hazard light are switched on or off.

The expected behavior is: When I switch and indicators/hazard light from off to on, the indicator/hazard light come on immediately without any delay, and a fresh indicator blink on phase is started.

Needing to call JoyCar.hazardlights(ToggleSwitch.On) repeatedly to cause the blinking behavior is not utterly nice but acceptable. When not doing that the indicators and hazard lights should stay on indefinitely.