Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Still) no pedaling support when light's are on. #139

Open
andrevil opened this issue Aug 19, 2020 · 10 comments
Open

(Still) no pedaling support when light's are on. #139

andrevil opened this issue Aug 19, 2020 · 10 comments

Comments

@andrevil
Copy link

Hello together,

I've recognized, that the pedal assist stops when the lights are on. It only stops when a real current is drawn. The consumption of my lamp is ~0.5A at a stable voltage of 6V. With light settings on but no light connected everything runs fine.

I've seen there was a ticket in the past concerning this, but for me it is still not working.

I've tried different "ADC lights offset / ADC lights " in the settings. But none of the values (0 to 4) helped.

When I've looked in the motor.c I couldn't find anything concerning phase current calculation and light. Is this finding still fixed in this newest version?

BTW: This motor controlling firmware is very awesome and I have built up the second bike with it now. Thank you for this!

@andrevil
Copy link
Author

andrevil commented Aug 23, 2020

I solved the problem by changing motor.c line 485:

// calculate motor current ADC value if (ui8_g_duty_cycle > 0) { ui16_g_adc_motor_current = ((ui16_g_adc_battery_current << 8) / ((uint16_t) ui8_g_duty_cycle)); } else { ui16_g_adc_motor_current = 0; }

to
// calculate motor current ADC value if (ui8_g_duty_cycle > 10) { ui16_g_adc_motor_current = ((ui16_g_adc_battery_current << 8) / ((uint16_t) ui8_g_duty_cycle)); } else { ui16_g_adc_motor_current = 0; }

I'm not sure why this code line was changed back, but this solution seems to work for me. I've only made a small test drive. If something will go wrong I'll give an update!

@casainho
Copy link
Contributor

casainho commented Sep 7, 2020

@andrevil Can you please tell how is this going? is it working ok?

@andrevil
Copy link
Author

It seems to work without Problems. tested ca 60km

It's not a very nice solution. What about a battery current offset calibration after turning the light on?

@QwertV2
Copy link

QwertV2 commented Sep 17, 2020

I got this exactly issue with the latest firmware and 860LCD. Previously I've used the emmebrusa mod, and lights always worked.
In that code I notice some difference on variable size and rotating bits.

Emmebrusa:

// calculate motor phase current ADC value if (ui8_g_duty_cycle > 0) { ui8_adc_motor_phase_current = (ui16_adc_battery_current << 6) / ui8_g_duty_cycle; } else { ui8_adc_motor_phase_current = 0; }

Official:
// calculate motor current ADC value if (ui8_g_duty_cycle > 0) { ui16_g_adc_motor_current = ((ui16_g_adc_battery_current << 8) / ((uint16_t) ui8_g_duty_cycle)); } else { ui16_g_adc_motor_current = 0; }

I will try to use the suggested patch of andrevil, but I'm intrested to know what are the overall impacts.

ps: what about the solution provided in this opened pull request? is better?
#128

Thank you guys for your AMAZING work! ;)

@cookejames
Copy link

I'm also having this problem. I haven't tried your fix @andrevil but I'll give it a go if it isn't being merged into master as with autumn coming I need my lights again.

@eraue
Copy link

eraue commented Sep 22, 2020

Hello,
First of all. THANK YOU for this great soft.
Built an e-bike with a tsdz2 and 860c display that I use to commute 40 minutes to work every day.

I also have this issue and would very much appreciate a fix.

Thank you
IMG_20200714_180841

This was referenced Sep 27, 2020
@NicobobinusX
Copy link
Contributor

NicobobinusX commented Sep 28, 2020

I tried different fixes from various threads for this issue and have found the one I've entered in pull request #142 to feel the most responsive. It's really just a copy of #128 using the variable names from the V1.0 release. It took me a while for me to get an environment set up where I could actually compile this successfully, so in case it helps anyone I'm attaching a ZIP file containing the compiled HEX file with this change, along with a copy of the edited motor.c source file shown in #142 to this post. While this is the exact same HEX file I flashed to my motor using STlink, use at your own risk, etc.

ZIP file: TSDZ2-v1.0_lightfix.zip

@eraue
Copy link

eraue commented Sep 28, 2020

I tried different fixes from various threads for this issue and have found the one I've entered in pull request #142 to feel the most responsive. It's really just a copy of #128 using the variable names from the V1.0 release. It took me a while for me to get an environment set up where I could actually compile this successfully, so in case it helps anyone I'm attaching a ZIP file containing the compiled HEX file with this change, along with a copy of the edited motor.c source file shown in #142 to this post. While this is the exact same HEX file I flashed to my motor using STlink, use at your own risk, etc.

ZIP file: TSDZ2-v1.0_lightfix.zip

Great, Thank you.
Will test it and keep you updated.

@eraue
Copy link

eraue commented Oct 4, 2020

Works perfectly.

Thank you again

@eraue
Copy link

eraue commented Oct 7, 2020

Hello again,

Tested more detailed today and looks like the assist level is 100% independent of the configuration and levels I use.
Also realized the motor current values displayed can't be accurate. Very low compared to before.

BUT the light is working ;o)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants