Closed tfabris closed 6 years ago
Possibility: Consider the chance that somehow the Arduino randomly resets itself sometimes. The reset is enough to make it reissue the startup commands to the bluetooth chip from the routine "SetGlobalChipDefaults". This causes a brief hiccup in the audio without actually disconnecting the bluetooth. But at this point the Arduino has forgotten its PDU registration codes while the bluetooth chip thinks they're fine. This might indeed cause a problem where things sorta kinda work but not everything works, such as pause/play/next working but the track metadata failing to work. Not certain about this. But if that's the case then we have no choice but to reset the bluetooth chip each time the Arduino starts up. There is some code (currently commented out) that will do this but I don't want to enable it unless I have to.
Update: Had a repro of this issue and also a few minutes prior I had a repro of the OPPOSITE issue: The track titles were updating fine but the steering wheel controls were not working.
Will be attempting to work around this temporarily by enabling the feature which resets the bluetooth chip if the Arduino happens to reset itself.
If this works, and if you encounter a situation where the system resets itself just while you're driving along, consider implementing a write protect switch for the Arduino so that it doesn't auto-reset itself due to random floating information on the USB serial port. You did this on your earlier Butterfly project and that worked well.
I haven't had this repro since I added the code that forces the Arduino to reset the bluetooth chip after its initial startup. Closing issue until I get a repro again.
Keep an eye out for a recurrence of this bug:
Theories: Some kind of quick reset of one of the components but not all of the components (not sure which one) where the arduino code no longer knows the correct registration value for the track change notifications. Try to force a repro of this by poking at things.
I have attempted some mitigations in the code based on my theories but without a strong repro I am unable to be sure if my mitigations have helped or not. Look out for a repro of this to see if it recurs.