I thought this firmware uses FOC sinusoidal commutation, not BLDC?stancecoke said:If you want to understand how to do the commutation of the BLDC you can find detailed information in the internet, but this is a real deep dive and not necessary for implenting the gearsensor.
Anyway, besides implementing extra functions on your already working firmware, I'd like to better understand how to write a firmware from scratch, I think easiest is PID controller so I'm looking into that. Do you have any EVB brushless to advise, a developer board for brushless motors with a demo firmware already written and working?
stancecoke said:Do you have a link to the gearsensor? I guess it just pulls the signal pin to gnd, when a gear shift is detected. So you can use the brake input of the controller to make the middrive motor stop to avoid shifting under full load.
Official site: http://gearsensor.com/

Originally, it was connected in series to a brake, on newer motors they started making a dedicated cable for it. The problem of having the gearsensor in series to the brake was that it had a higher activation time/latency for the cutoff.
Basically, what I'd like to do is implement 10 profiles for current and speed (https://i.imgur.com/1BY5MzA.jpg) + add an extra cutoff column and change the cutoff time for each assist level. In addition, I'd like to link this cutoff time also to my current speed and current gear.
The reason for this is, the gearsensor is amazing, but it has a big problem. If you go buy any motor that implements it (bafang, brose, etc.), you notice they use the same exact cutoff time for all assist levels and gears, and what happens is that at higher gears you can feel the motor tear off when you change gear. Thus I'd like to take this great tool, intercept the signal sent by it every time you change gear, but customise the cutoff time for every single assist level, for every single gear, and also based on what's my current speed.
Anyway, as a starting point, I'd be just happy to have 10 profiles with 10 different cutoff times tbh (something like this: https://i.imgur.com/Y0CVPYA.jpg). Then you can start adding more stuff.
