THIS CODE IS NOT BEING DEVELOPED NOR MANTAINED ANYMORE.

Please use instead the Stancecoke firmware:

Casainho was developing and mantaining this code up to June 2018 but stopped because he started using on his ebikes the alternative TSDZ2 mide drive motor that uses another motor controller. Not having the hardware, it would be impossible to keep developing and testing the firmware.

TSDZ2 mid drive motor controller uses the same microcontroller STM8 as KT motor controllers and so Casainho started to use the same base code developed for KT motor controllers firmware, on the TSDZ2 motor controllers -- see here: https://github.com/OpenSource-EBike-firmware/TongSheng_TSDZ2_motor_controller_firmware

Original documentation, outdated: