camcamfresh / Xiaomi-M365-BLE-Controller-Replacement

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

bit shifting instead of strings.... #9

Closed smartinick closed 5 years ago

smartinick commented 5 years ago

Not an issue, but as it seems you need to figure that out.... use it like that:

uint16_t crc = (motor1[2] + motor1[3] + motor1[4] + motor1[5] + motor1[6] + motor1[7] + motor1[8] + motor1[9] + motor1[10] + motor1[11] + motor1[12]) ^ 0xFFFF; motor1[13] = (uint8_t)(crc&0xff); motor1[14] = (uint8_t)((crc&0xff00)>>8);

maybe that safe you some time - your code templated saved my time (doing similar with the esp32). Thanks for sharing!

for switching eco/normal mode you can look in my code, m365.cpp, method m365_sendcommand.

camcamfresh commented 5 years ago

Thank you! My friend recommended that I do this, but my microchip broke before I could test if would work. I'll try replacing my code with this when I finish making my wire harness (probably next week).

smartinick commented 5 years ago

you are welcome. thanks for starting this repo, saved me some time to research myself :D if you have any questions - ideas - i'm happy to give feedback/help!

On Mon, 10 Dec 2018 at 07:44, camcamfresh notifications@github.com wrote:

Thank you! My friend recommended that I do this, but my microchip broke before I could test if would work. I'll try replacing my code with this when I finish making my wire harness (probably next week).

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/camcamfresh/Xiaomi-M365-BLE-Controller-Replacement/issues/9#issuecomment-445704736, or mute the thread https://github.com/notifications/unsubscribe-auth/ADckB6phVELGBPo1HRZbJlUdbJv1mm6Yks5u3gLQgaJpZM4YoDy5 .