Open andrevil opened 4 years ago
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!
@andrevil Can you please tell how is this going? is it working ok?
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?
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? https://github.com/OpenSource-EBike-firmware/TSDZ2-Smart-EBike/pull/128
Thank you guys for your AMAZING work! ;)
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.
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
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
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.
Works perfectly.
Thank you again
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)
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!