casainho
10 GW
- Joined
- Feb 14, 2011
- Messages
- 6,058
My PAS has 5 magnets and I can't replicate your issue. Can you please take a picture of your PAS? I would like to try understand if the magnets have the same space between them as their size, because:geofft said:Spent an hour in the garage earlier with the bike up on a test stand and can now give you some more information on the problems i had with my previous test ride.
1) The bike does not like being pushed in reverse - it's ok for about a metre or so but then the motor resists and at times will actively drive the bike forwards quite forcibly. This could create some dangerous situations and needs some attention.
....this is definitely being caused by reverse pas being mis-interpreted by the firmware. If I reverse pedal fairly quickly all is well, but if I reverse pedal very slowly (as would happen pushing the bike backwards) the motor gives strong drive pulses. A short video here:-https://www.youtube.com/watch?v=2ZvIl2bwB7Y
...so it seems the pas detection needs a little more work..?
I am also doing the same:stancecoke said:In the "Forumscontroller-" code it is solved by checking the ratio of the PAS_High_counter to the PAS_Low_counter
Code:
#if (PAS_DIRECTION == PAS_DIRECTION_RIGHT)
if (ui16_pas_on_time_counter > ui16_pas_off_time_counter)
#else
if (ui16_pas_on_time_counter <= ui16_pas_off_time_counter)
#endif
{ ui8_pas_direction = 1; }
else { ui8_pas_direction = 0; }
ui16_pas_off_time_counter = 0;
ui16_pas_on_time_counter = 0;
}
}
Code:
void read_pas_cadence_and_direction (void)
{
// cadence in RPM = 60 / (ui16_pas_timer2_ticks * PAS_NUMBER_MAGNETS * 0.000064)
if (ui16_pas_pwm_cycles_ticks >= ((uint16_t) PAS_ABSOLUTE_MIN_CADENCE_PWM_CYCLE_TICKS)) { ui8_pas_cadence_rpm = 0; }
else
{
ui8_pas_cadence_rpm = (uint8_t) (60 / (((float) ui16_pas_pwm_cycles_ticks) * ((float) PAS_NUMBER_MAGNETS) * 0.000064));
if (ui8_pas_cadence_rpm > ((uint8_t) PAS_MAX_CADENCE_RPM))
{
ui8_pas_cadence_rpm = ((uint8_t) PAS_MAX_CADENCE_RPM);
}
}
if (ui8_pas_direction) { ui8_pas_cadence_rpm = 0; }
}
Here is a log I took just now when testing -- for me, ui8_pas_direction seems to always be = 1 when rotating backwards, even very slow...:
