TSDZ2-ESP32 / TSDZ2-Android

Android control application for ESP32 add-on module of TSDZ2 eBike motor
GNU General Public License v3.0
10 stars 12 forks source link

Unable to discover device (ESP32) through app #3

Closed washichi closed 1 year ago

washichi commented 2 years ago

I am unable to discover or connect to the ESP32 by Bluetooth through the app. I can see the TSDZ2-ESP32 in my android bluetooth settings and pair. I can not see it in the app. (no discovered devices will be listed). (I paired through android bluetooth settings, after that still no discovered device).

I powered it with an FTDI adapter, on which i measured 3.320V. I tested it with ESP32-v1.1.8 + app 2.1.10, and ESP32-v1.2.1 + app v2.1.12. I'm using a OnePlus 7 Pro, Android 12L, Bluetooth 5.0. I also tested a Huawei (POT-LX1), Android 10, Bluetooth 4.2. Also unable to discover the ESP32 through the app, (On the Huawei I can also discover the ESP32 through the Android bluetooth settings, but not pair; I get the message: "go to this device's app to pair with it")

There serial output doesn't output anything. When Pairing through the Android Bluetooth settings it outputs the expected pairing info:

I (248670) tsdz_bt: T ESP_GATTS_CONNECT_EVT, conn_id = 0
I (248670) tsdz_bt: C ESP_GATTS_CONNECT_EVT, conn_id = 0
I (248770) tsdz_bt: The passkey Notify number:123456
I (249210) tsdz_bt: update connection params status = 0, min_int = 32, max_int = 48,conn_int = 48,latency = 0, timeout = 400
I (259070) tsdz_bt: key type = ESP_LE_KEY_LENC
I (259080) tsdz_bt: key type = ESP_LE_KEY_LID
I (259390) tsdz_bt: key type = ESP_LE_KEY_PENC
I (259390) tsdz_bt: key type = ESP_LE_KEY_PID
I (259390) tsdz_bt: remote BD_ADDR: 680ebdacb298
I (259400) tsdz_bt: address type = 1
I (259400) tsdz_bt: pair status = success
I (259410) tsdz_bt: auth mode = ESP_LE_AUTH_REQ_BOND_MITM
I (260560) tsdz_bt: update connection params status = 0, min_int = 0, max_int = 0,conn_int = 6,latency = 0, timeout = 500
I (261030) tsdz_bt: update connection params status = 0, min_int = 0, max_int = 0,conn_int = 48,latency = 0, timeout = 400

Anyone who had/has the same issue? Or can give me a pointer how to debug this?

washichi commented 2 years ago

I figured it has to do with the changed permission settings in newer Android version. I got it to work (tested on Android 12) (here is my fork), but my permission flow is incorrect, so the app crashes on first launch.

If I find the time I will look at it later, to see if I can resolve the crashes.