casainho
10 GW
- Joined
- Feb 14, 2011
- Messages
- 6,058
I was looking at your code and I have some notes/questions:stancecoke said:I've just uploaded a new branch with improved direction detection on PAS and made Regen like coast brakes availabe in normal PAS/Throttle mode. No wire at X4 is necessary, just a normal PAS at the origin PAS connector.
@casainho: you are right, with your code for handling the PAS signal, the mod of the BMS-Sensor doesn't work. With my interrupt-based handling, it works. Quite strange, but not important, as we won't use this sensor any more, I think....
1. The code have Printfs, please remove and "clean" the code
2. Your improved PAS direction detection is the same I looked before. With this new code, user will need to define another parameter and is also hard to find the correct value: #define PAS_THRESHOLD 1.7 <--- do we really need this improvement? what kind of PAS you have that didn't work with current code? The BMSBattery PAS, and I guess others may be very similar, work very well for me with current code and without the need of that additional parameter.
3. Seems some code is missing, because ui8_pas_flag is tested on read_pas_cadence_and_direction() but I don't see it being changed in any other place
4. This implementation seems to overwrite my implementation using the torque sensor + extra PAS. Please make your implementation to not overwrite, maybe using another define like EBIKE_REGULAR_PAS_REGEN_EBRAKE_LIKE_COAST_BRAKES