OpenSourceEBike / TSDZ2_wireless

TSDZ2_wireless
36 stars 11 forks source link

brakes working #40

Closed rananna closed 3 years ago

rananna commented 3 years ago

@casainho , The brake signal is now being sent in the remote control. Notes:

  1. the red led will light on the remote to indicate a brake is pressed, it will turn off when the brake is released.
  2. the brake signal to the motor is using the same hack I implemented previously using the gearing. The uppermost rear gear (15) is used to indicate braking.
  3. When the brakes are active, I simply set a flag (brake_flag) in TSDZ2 wireless . I did not do anything else with this in the code - I leave that up to you to implement brakes on the motor.
  4. BRAKE__PIN in the remote iis set to pin 22. Could you please update the remote schematic to reflect this addition?
  5. I thing the brake delay is very short, on the order of a few ms.
casainho commented 3 years ago

I usually keep applying brakes for the 1 minute on the red light... can you change this behavior? I would say:

rananna commented 3 years ago

That is strange - I have no idea what this means. Perhaps it is because the PR modifies files that exist in TSDZ2 wireless and remote control?

rananna commented 3 years ago

@casainho - You said - "I usually keep applying brakes for the 1 minute on the red light... can you change this behavior? I would say:

every time the brakes are applied, enable red LED with a pulse of maybe 0.5 seconds"

Are you concerned that it will stay on when the brake is pulsed? If so, the way it works now is APP_BUTTON_PUSH detects the brake switch on and APP_BUTTON_RELEASE detects when it is open. So, the LED should flash if you are pulsing the brakes.

If you are concerned about pwr dissipation, I could change the display to flash instead of being solid on when brake is on to reduce pwr by 1/2.

I had it originally with only a 0.5 s flash, but I thought a user might panic and think the brake was not working if the light goes out. I thought it was better to keep it on when the brake lever is pressed. With pwm, it should not be too much additional pwr dissipation. The remote should easily last a year, even with excessive led usage. We should recommend changing yearly anyway.

casainho commented 3 years ago

Yes, I am worried to optimize power. I remember an user saying that do not like the wireless remote because of disposable batteries, because of environment, and I must agree we should optimize when possible and have a big number of duration to announce - this may also help on the "range anxiety" / reduce the fear the remote will fail when riding, because announcing a 2.5 years is very different then announcing 1 year.

I hope is not hard to implement, like this:

rananna commented 3 years ago

OK, I am concerned that the user will not see the led is on if it is too short. How about this for pwr managment. When the brake is applied I will set up a blinking pwm (1/2 brightness) LED for 8 seconds, (equivalent to a solid on RED LED for 2 seconds in pwr use) I will immediately cancel the led if the brake is released. If you think 8 seconds is too long, let me know the time you like.

casainho commented 3 years ago

I am ok if it is no blinking (because blinking it like I need attention) but continuous for like 5 or 10 seconds, with full duty-cycle or partial.