camcamfresh / Xiaomi-M365-BLE-Controller-Replacement

Replacing the BLE Controller with a Cellular Controller
142 stars 34 forks source link

Schematics for cabling the one wire bus #6

Closed sigmounte closed 5 years ago

sigmounte commented 6 years ago

How the Particle is wire to keep power is perfectly explained in text , but what about the 1 wire ?

Woud you make a simple schematics ? thanks !

In fact , where do you change the role of the Particle TX pin when you want to receive data ?

camcamfresh commented 5 years ago

From my understanding, Particle takes care of all of that for you. The only problem I had was clearing the buffer after I sent data (I did this by "if(Serial1.available()) escReader();" in multiple lines after sending the throttle data (throttle and brake values get 1 reply from the motor controller for every 4 messages)

Serial1.write(motor, sizeof(motor)); delay(10); //Sends control values to scooter.
Serial1.write(motor, sizeof(motor)); delay(10);
Serial1.write(motor, sizeof(motor)); delay(10);
Serial1.write(motor, sizeof(motor)); delay(10);
if(Serial1.available()) escReader(); //Clears Serial Buffer; it seems to recieve the packets we transmit.
Serial1.write(motor1, sizeof(motor1)); delay(10); //Sends control values and request X1 structure from scooter.
if(Serial1.available()) escReader(); //Read X1 Structure from the Scooter.
Serial1.write(inforequest, sizeof(inforequest)); delay(10); //Sends control values and request scooter trip information.
if(Serial1.available()) escReader(); //Read scooter trip information.