mikerr / esp-euc

Display info from an EUC (ninebot one S2) on ESP32 LCD
4 stars 0 forks source link

How to adapt to Ninebot One Z10 #1

Open erikkt opened 2 years ago

erikkt commented 2 years ago

Any idea on how to adapt this to Z10? Doesn't work with either 0x09 or 0x11. Would really like this for my Z10.

mikerr commented 2 years ago

It might need a different service / characteristic address for ninebot one

Service FFE0 Characteristic FFE1

https://www.gorina.es/9BMetrics/protocol.html

erikkt commented 2 years ago

Thanks for your reply! There is no mention of these addresses (FFE0/FFE1) in the code. Where are these? Are these related to: static BLEUUID serviceUUID("6e400001-b5a3-f393-e0a9-e50e24dcca9e"); static BLEUUID writecharUUID("6e400002-b5a3-f393-e0a9-e50e24dcca9e"); static BLEUUID readcharUUID("6e400003-b5a3-f393-e0a9-e50e24dcca9e");

mikerr commented 2 years ago

Actually for Z10 you should just be able to change 0x11 to 0x09 and update the last two checksum entries

​    ​char​ currentspeed[] = {​0x55​, ​0xAA​, ​0x03​, ​0x11​, ​0x01​, ​0x26​, ​0x02​, ​0xC2​, ​0xFF​, ​0x00​}; ​//​ current speed (kmh * 1000)

erikkt commented 2 years ago

Truly sorry for my ignorance, and I appreciate any answer. There is no mention in the doc on how to calculate the checksum. How do I do that?

char​ currentspeed[] = {​0x55​, ​0xAA​, ​0x03​, ​0x09​, ​0x01​, ​0x26​, ​0x02​, ​0xC2​, ​0x??, ​0x??​}; ​//​ current speed (kmh * 1000)

erikkt commented 2 years ago

Finally figured it out after many hours. The checksum seems to be calculated by adding everything between 0xAA and the first checksum, then XOR the result with FF. Chk1 seems to always be 0xFF. Unfortunately it still wont talk with my Z10. Can you please elaborate on the "Service FFE0, Characteristic FFE1". I don't understand where this is defined in the code. I would really appreciate your help.

mikerr commented 2 years ago

Which .ino are you testing with ?

Some are hard coded to the Ninebot One S2 (N20)

Try to uncomment the line

​   ​//if (advertisedDevice.haveServiceUUID() && advertisedDevice.isAdvertisingService(serviceUUID)) {

and comment out

String name = advertisedDevice.getName().c_str(); if (name.startsWith("N2O")) {

Service FFE0 is for older ninebot one E+, shouldn't need that for the Z10

erikkt commented 2 years ago

Thanks a lot for your reply! I am testing with the euc-lcd.ino, as I have a TTGO LCD ESP. The line you mention is already uncommented, and the 'if (name.startsWith("N2O"))' doesn't exist. Is there some other .ino I should use instead?

erikkt commented 2 years ago

I found a BT analyzer and it seems it is using characteristics FEC7, FEC8 and FEC9. How can I change this in the code? image image image