marcraft2 / tesla-carplay

Carplay Raspberry Pi Wi-Fi Hotspot Web Server for Tesla.
Other
108 stars 19 forks source link

Audio fix #11

Closed ochompsky closed 1 year ago

ochompsky commented 2 years ago

The broken audio issues listed:

All 4 of these can be fixed but requires you to run the android version of the autokit app first. In that app, you change from 'box' mode to 'bluetooth' mode and then the setting will saved to the device. Alternatively, you may be able to mess around with the files on the dongle itself to make the change but I haven't done it that way. Once that is done, all of this will work on the Tesla.

However, the downside is that navigation audio is then broken. I believe this is a carlinkit issue they are working on but I don't know of a solution.

mikegapinski commented 2 years ago

When using the "Bluetooth" mode in Autokit you can pump the navigation audio via web sockets to something like https://github.com/samirkumardas/pcm-player, it'll work when driving. That is something I am doing for the second alpha of Tesla Android

marcraft2 commented 2 years ago

When using the "Bluetooth" mode in Autokit you can pump the navigation audio via web sockets to something like https://github.com/samirkumardas/pcm-player, it'll work when driving. That is something I am doing for the second alpha of Tesla Android

Thank you for this tip, but the bluetooth solution of the car seems to me a better solution, because the wifi must be reconnected when you switch to driving mode. At least by bluethoot there is no cutoff. And on this solution you can't use the tesla's microphone and steering wheel controls either.

The broken audio issues listed:

  • Wireless Carplay
  • Siri
  • Sound of calls & Microphone
  • Steering wheel control

All 4 of these can be fixed but requires you to run the android version of the autokit app first. In that app, you change from 'box' mode to 'bluetooth' mode and then the setting will saved to the device. Alternatively, you may be able to mess around with the files on the dongle itself to make the change but I haven't done it that way. Once that is done, all of this will work on the Tesla.

However, the downside is that navigation audio is then broken. I believe this is a carlinkit issue they are working on but I don't know of a solution.

I tried this in the latest version v0.3. By directly using the node-carplay library. It works correctly. I haven't had time to test the microphone, siri and call sound yet. (It's possible that it already works, I don't know if the raspberry (node-microphone) recognizes the tesla bluethoot microphone by default). And for the steering wheel controls, I have to do a separate piece of code to succeed in recovering the tesla controls with blue-alsa? then send them back to the Carplay.

And to make the audio work, you had to set the device as the default device and you no longer need to pass the environment variables for it to work. (I updated the documentation)

There may be a problem if the bluetooth connects after carplay, to correct you can restart the pm2 application:

pm2 restart all

I'll see how I can fix this in the future. For the moment I have to put myself in airplane mode and time to connect my Pi to the Bluetooth of the Tesla. Connection events are available in syslog I think I will use it to automatically restart pm2.

Edit: pm2 restart all breaks the image in the browser, you must imperatively connect the bluetooth of the tesla to the rasberry before carplay emits a sound. (Fixed on v0.4)

mikegapinski commented 2 years ago

I didn't mean the all audio Bluetooth via browser approach. The car remains connected with Bluetooth directly with your iPhone and that gives you:

You need to use AutoKit apk to change device configuration to support this - I don't know the payload to switch this manually, however I can try to find this out for you.

The browser is only used for navigation voices - that is a routing bug in Carlinkit firmware, hopefully it will be resolved soon. I am in touch with them about this.

You can quickly POC this approach and see how it works for you. The code is present in Tesla Android frontend app.

BTW: do you have any issues with using the video tag? I crossed out jmuxer and other approaches in Tesla Android because of new limitations in Tesla OS. If the app is loaded before putting the car into drive it will work, but after that you get a white screen(the video context doesn't start)

mikegapinski commented 2 years ago

BTW. In my case the Wi-Fi connection doesn't reset when changing gears(see Tesla Android recent YouTube video).

Make sure that your hotspot boots up quickly before you drive the car. If Wi-Fi connects before switching to drive there is no issue whatsoever. Just select remain connected in drive in your Tesla.

marcraft2 commented 2 years ago

Je ne parle pas du Bluetooth tout audio via l'approche du navigateur. La voiture reste connectée en Bluetooth directement avec votre iPhone et cela vous donne :

  • commandes au volant
  • microphone
  • Siri
  • appels

Are you telling me that we can configure CarPlay so that the Iphone can continue to use the bluetooth of the car at the same time as using Carplay? However, I don't understand why this code would be in the Tesla Android application

BTW : Avez-vous des problèmes avec l'utilisation de la balise vidéo ? J'ai barré jmuxer et d'autres approches dans Tesla Android en raison des nouvelles limitations de Tesla OS. Si l'application est chargée avant de mettre la voiture en marche, cela fonctionnera, mais après cela, vous utiliserez un écran blanc (le contexte vidéo ne démarrera pas)

No, I don't have a video problem at the moment. I don't use a resolution that is too high, it may play (900x702). But I have the impression that the last update of the Tesla browser helps a lot for the fluidity.

D'AILLEURS. Dans mon cas, la connexion Wi-Fi ne se réinitialise pas lors du changement de vitesse (voir la récente vidéo YouTube de Tesla Android).

Assurez-vous que votre point d'accès démarre rapidement avant de conduire la voiture. Si le Wi-Fi se connecte avant de passer au lecteur, il n'y a aucun problème. Sélectionnez simplement Rester connecté dans le lecteur de votre Tesla.

Thank you very much, I didn't know about this option!

mikegapinski commented 2 years ago

Je ne parle pas du Bluetooth tout audio via l'approche du navigateur. La voiture reste connectée en Bluetooth directement avec votre iPhone et cela vous donne :

  • commandes au volant
  • microphone
  • Siri
  • appels

Are you telling me that we can configure CarPlay so that the Iphone can continue to use the bluetooth of the car at the same time as using Carplay? However, I don't understand why this code would be in the Tesla Android application

The only bit that is present in my front end app is a script that allows to play RAW PCM audio in the browser in motion. Rest is handled by the dongle when you change the audio mode:

https://github.com/tesla-android/flutter-app/blob/main/web/pcmplayer.js https://github.com/tesla-android/flutter-app/blob/main/web/index.html

BTW : Avez-vous des problèmes avec l'utilisation de la balise vidéo ? J'ai barré jmuxer et d'autres approches dans Tesla Android en raison des nouvelles limitations de Tesla OS. Si l'application est chargée avant de mettre la voiture en marche, cela fonctionnera, mais après cela, vous utiliserez un écran blanc (le contexte vidéo ne démarrera pas)

No, I don't have a video problem at the moment. I don't use a resolution that is too high, it may play (900x702). But I have the impression that the last update of the Tesla browser helps a lot for the fluidity.

Resolution does not matter, try to load any jmuxer demo when driving the car. Video context is not created, you should get a white screen. It only works when you load the page while in Park and then shift to Drive or Reverse

D'AILLEURS. Dans mon cas, la connexion Wi-Fi ne se réinitialise pas lors du changement de vitesse (voir la récente vidéo YouTube de Tesla Android). Assurez-vous que votre point d'accès démarre rapidement avant de conduire la voiture. Si le Wi-Fi se connecte avant de passer au lecteur, il n'y a aucun problème. Sélectionnez simplement Rester connecté dans le lecteur de votre Tesla.

Thank you very much, I didn't know about this option!

marcraft2 commented 1 year ago

Fix on v0.4