TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Electric Motors and Controllers
andyme   100 W

100 W
Posts: 218
Joined: Oct 04 2017 1:40pm

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by andyme » Jun 06 2020 7:05am

cavi wrote:
Jun 05 2020 8:47pm
2: trip distance. It would be nice if it did not reset when you turned off the power. As sometimes you have to reboot mid ride....
I second that strongly... :P Trip Time same...
Last edited by andyme on Jun 06 2020 7:11am, edited 1 time in total.

andyme   100 W

100 W
Posts: 218
Joined: Oct 04 2017 1:40pm

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by andyme » Jun 06 2020 7:07am

Hi, I do not want to offend the writer of the wiki/configurations menu, but i must admit: i have comprehension problems due to laxk of knowledge most probably.

I would like to calibrate the torque sensor. I think i understand what i need to do, however i need to understand the following three entries in the technical configurations:
Entries beginning
Pedal side x Current side of the pedal the firmware considers. This value depends on correct calibration at startup of the system: the pedals need to be vertical pointing to ground. You can select on Configurations to be left or right pedal to point to ground at startup, based on your preferences. This is needed to the system can know in which pedal are you doing the force with your legs, since the weight is measured differently on each pedal due to the torque sensor.
Weight with offset x Weight on the pedals and this value can have an offset representing a no zero value at startup when there are zero weight on pedals.
Weight without offset x Same as previous but with offset removed.
Entries end.

pedal side: does it mean i have to select the pedal that i will step on at startup, meaning: if i want to use the right pedal first, i have to select "left" and the left pedal has to face downwards when i switch on the display? that is how i understand this. is this correct?

weight with offset:
what is this at all? can someone pls. give me an example how and when this occurs ? i have absolutely no clue what this refers to...
Weight without offset accordingly...no clue

Sorry...

skestans   100 W

100 W
Posts: 167
Joined: Jul 12 2019 12:42am
Location: Switzerland

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by skestans » Jun 06 2020 3:29pm

Pedal side is which pedal is down toward the ground when turning the bike on.

Weight with offset is the torque sensor converting its reading to a weight in kg after calibration. It helps to check if you did it right: does the 5kg object register as 5kg on the display after calibration or is it off? Note that it’s not a precision scale so within a kilo or two is still good.

Weight without offset is the same but without using the calibrated values.

andyme   100 W

100 W
Posts: 218
Joined: Oct 04 2017 1:40pm

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by andyme » Jun 06 2020 4:28pm

skestans wrote:
Jun 06 2020 3:29pm
Pedal side is which pedal is down toward the ground when turning the bike on.

Weight with offset is the torque sensor converting its reading to a weight in kg after calibration. It helps to check if you did it right: does the 5kg object register as 5kg on the display after calibration or is it off? Note that it’s not a precision scale so within a kilo or two is still good.

Weight without offset is the same but without using the calibrated values.
Thanks very much, I may have an idea now... :roll: :wink:

gatorsean   100 mW

100 mW
Posts: 36
Joined: Jun 12 2019 1:28am

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by gatorsean » Jun 07 2020 1:35am

cavi wrote:
Jun 05 2020 8:47pm
1: throttle, it seems that the throttle is tied to the assist level, or it feels that way, it does not seem to give me full power. Maybe I have it set wrong?
I agree with this 100% The throttle should offer full power regardless of assist mode. a couple users have been discussing this lately but we are in the minority and casainho does not normally use the throttle.

I would be happy to try and fix this and do a pull request, but I just ask for a little high level theory of how the throttle works in the code.

casainho, if you read, this, can you take a look at the problem or maybe leave a note here about how the throttle is intended to work in the code?

Benoit   10 mW

10 mW
Posts: 31
Joined: May 22 2020 3:24am

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by Benoit » Jun 07 2020 7:52am

cavi wrote:
Jun 03 2020 6:43pm
One other software issue that bugs me is that the trip meter resets every time you kill the power. Many times on a ride I will stop and turn off the bike and then when I restart the trip meter has reset....... Could we possibly change this for next firmware, then maybe like the BBSHD press both up and down at once and it would reset?
I'm currently working on it !

What is already done : 2 trip memories ("A" and "B") with :
  • time
  • distance
  • average speed
  • max speed
Trip A and B are independant. Datas are saved/load in EEPROM.
It's working fine for me, I have to test it again to be sure.

I now have to implement the reset feature : manually and automaticaly (for 850/860C as SW102 has no RTC).

As soon as all will be done, I'll made a pull request.

My source code is available here ("WIP-trips-memories" branch) : https://github.com/Kenny-54/Color_LCD/t ... s-memories
But I did not provide on Github the compiled firmware so if you want to test it you'll have to compile it yourself, or MP me.

safeaschuck   100 µW

100 µW
Posts: 7
Joined: Apr 21 2020 10:11am

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by safeaschuck » Jun 07 2020 11:09am

Hi, I think I have killed my 860C by making a mistake with my wiring.

It had previously successfully flashed to 1.0 Beta (splash screen confirmed)

I made my own harness to connect 860C to TSDZ2, read much info, wiki etc. and checked carefully to get it right. Could not get a sucsessful flash with STLink v2 following wiki instructions.
Tried Aliexpress 1t4 cable, no luck.
Discovered 1T4 cable wiring is different, hacked the harness to pieces, tried again, Sucsessfully flashed TSDZ2 (according to software) with 1.0 beta.

Display won't come on at all, Tried hot wiring brakes and throttle to read on and off in different combo's as I saw an old post from Casainho that the brake's can stop it booting.

Is there =ny way I can confirm the display is dead?

Could it still be alive due to the fact I flashed the TSDZ2 successfully with it connected in it's current state?

If I have to replace it will I regret getting a SW102 to save a few $$?

casainho   100 GW

100 GW
Posts: 5022
Joined: Feb 14 2011 2:43pm

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by casainho » Jun 07 2020 3:00pm

gatorsean wrote:
Jun 07 2020 1:35am
I would be happy to try and fix this and do a pull request, but I just ask for a little high level theory of how the throttle works in the code.

casainho, if you read, this, can you take a look at the problem or maybe leave a note here about how the throttle is intended to work in the code?
Looking at the code, I can´t understand why throttle does work as you guys are saying.

Please look at the code, mainly on:

Code: Select all

  // throttle
  apply_throttle(&ui16_m_adc_target_current, ui8_assist_enable);
And put the questions here that you may have when trying to understand the code.
- EBike wireless standard: wireless motor, wireless cycling GPS display Garmin Edge and wireless remote with wireless brake sensor
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of OpenSource knowledge and technology for ebikes: Wireless EBike standard ANT+ and Bluetooth, TSDZ2 OpenSource firmware, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

Please consider a donation to help developments: paypal.me/jorgecasa

casainho   100 GW

100 GW
Posts: 5022
Joined: Feb 14 2011 2:43pm

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by casainho » Jun 07 2020 3:17pm

safeaschuck wrote:
Jun 07 2020 11:09am
It had previously successfully flashed to 1.0 Beta (splash screen confirmed)
The display always show that first screen independent of the TSDZ2 communication. If your display is ok and with corrected flashed firmware, it will show that screen for sure.
- EBike wireless standard: wireless motor, wireless cycling GPS display Garmin Edge and wireless remote with wireless brake sensor
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of OpenSource knowledge and technology for ebikes: Wireless EBike standard ANT+ and Bluetooth, TSDZ2 OpenSource firmware, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

Please consider a donation to help developments: paypal.me/jorgecasa

casainho   100 GW

100 GW
Posts: 5022
Joined: Feb 14 2011 2:43pm

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by casainho » Jun 07 2020 3:23pm

Benoit wrote:
Jun 07 2020 7:52am
As soon as all will be done, I'll made a pull request.
I am waiting for it!! When you do it, I will test and make a new version.

And about the FOC x2, I tested it and it does not work. I see on the display the angle, after a certain amount like 15, to jump to values like 60 and the motor stops to work as expected. I was luck to not burn anything, the current controller seems to work well and protect on this case.
- EBike wireless standard: wireless motor, wireless cycling GPS display Garmin Edge and wireless remote with wireless brake sensor
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of OpenSource knowledge and technology for ebikes: Wireless EBike standard ANT+ and Bluetooth, TSDZ2 OpenSource firmware, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

Please consider a donation to help developments: paypal.me/jorgecasa

Benoit   10 mW

10 mW
Posts: 31
Joined: May 22 2020 3:24am

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by Benoit » Jun 08 2020 3:24am

casainho wrote:
Jun 07 2020 3:23pm
Benoit wrote:
Jun 07 2020 7:52am
As soon as all will be done, I'll made a pull request.
I am waiting for it!! When you do it, I will test and make a new version.
Yesterday I added the manual reset feature. But I made it very simple, within the configuration screen.
I have to see to do that from the main screen.
And autoreset is not yet working. I hope it will be done this week.

vshitikov   10 W

10 W
Posts: 94
Joined: Mar 05 2020 7:24am

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by vshitikov » Jun 08 2020 4:08am

casainho wrote:
Jun 01 2020 3:06pm
vshitikov wrote:
Jun 01 2020 2:56pm
We should probably upload this troubleshooting in wiki so it may help other people. And also tell people not to set the battery cutoff voltage to low.
Maybe a specific page with explanation of the sysptoms, why that happens and the solution. That page could be linked both from configurations battery cut off voltage and FAQ.
Hi Casainho,
Just updated Wiki with the troubleshooting information when controller firmware gets corrupted and how to restore it using option bytes. I could not upload pictures right away in the wiki, it requires push access to the directory. But the pictures are not necessary anyways.

casainho   100 GW

100 GW
Posts: 5022
Joined: Feb 14 2011 2:43pm

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by casainho » Jun 08 2020 4:25am

vshitikov wrote:
Jun 08 2020 4:08am
casainho wrote:
Jun 01 2020 3:06pm
vshitikov wrote:
Jun 01 2020 2:56pm
We should probably upload this troubleshooting in wiki so it may help other people. And also tell people not to set the battery cutoff voltage to low.
Maybe a specific page with explanation of the sysptoms, why that happens and the solution. That page could be linked both from configurations battery cut off voltage and FAQ.
Hi Casainho,
Just updated Wiki with the troubleshooting information when controller firmware gets corrupted and how to restore it using option bytes. I could not upload pictures right away in the wiki, it requires push access to the directory. But the pictures are not necessary anyways.
Please prepare the option bytes HEX file and full notes, as you made it with external dependencies: "First find the option bytes from the ECO cycles website" -- is possible that external website change the link or simple disappears and we should try avoid this dependency.

1. can you please save that HEX file for the option bytes?
2. write the instructions? - maybe you can create a specific wiki page with the instructions and then link it on the FAQ page. I can give you write access or if is more simple to you, just send me by PM.
- EBike wireless standard: wireless motor, wireless cycling GPS display Garmin Edge and wireless remote with wireless brake sensor
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of OpenSource knowledge and technology for ebikes: Wireless EBike standard ANT+ and Bluetooth, TSDZ2 OpenSource firmware, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

Please consider a donation to help developments: paypal.me/jorgecasa

Nfer   10 W

10 W
Posts: 84
Joined: Sep 17 2019 6:51am

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by Nfer » Jun 08 2020 10:50am

cavi wrote:
Jun 02 2020 8:58pm
For the best hill start performance I would setup as the following:

Motor current control = torque
Assist w/o pedal = enable
Startup BOOST = disable
Startup BOOST duration = 5
Startup BOOST fade = 6.5
Motor current ramp = 10a (maximum)
Calibrate your torque sensor then enable calibrations
Motor current max = 20a
I used these settings and it solved the lack of the boost function. The assist w/o pedal rotation enable helps to deliver the power quicker.
I prefer to use the control power instead of torque. I am using high cadence and low gears.

casainho   100 GW

100 GW
Posts: 5022
Joined: Feb 14 2011 2:43pm

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by casainho » Jun 08 2020 11:26am

Nfer wrote:
Jun 08 2020 10:50am
I prefer to use the control power instead of torque. I am using high cadence and low gears.
So I am not alone, in the preference to control motor current - power mode and using high cadence and low gears. The field weaking is really great for the ones that prefer high cadence!!
- EBike wireless standard: wireless motor, wireless cycling GPS display Garmin Edge and wireless remote with wireless brake sensor
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of OpenSource knowledge and technology for ebikes: Wireless EBike standard ANT+ and Bluetooth, TSDZ2 OpenSource firmware, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

Please consider a donation to help developments: paypal.me/jorgecasa

jeff.page.rides   100 W

100 W
Posts: 228
Joined: Aug 13 2019 10:16am

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by jeff.page.rides » Jun 08 2020 12:08pm

Nfer wrote:
Jun 08 2020 10:50am
cavi wrote:
Jun 02 2020 8:58pm
For the best hill start performance I would setup as the following:

Motor current control = torque
Assist w/o pedal = enable
Startup BOOST = disable
Startup BOOST duration = 5
Startup BOOST fade = 6.5
Motor current ramp = 10a (maximum)
Calibrate your torque sensor then enable calibrations
Motor current max = 20a
I used these settings and it solved the lack of the boost function. The assist w/o pedal rotation enable helps to deliver the power quicker.
I prefer to use the control power instead of torque. I am using high cadence and low gears.
Motor control / Motor ctrl torque If set to "torque", the motor current (torque) will be equal to: measured pedal torque * assist level factor. If set to "power", the motor current will be equal to: measured pedal power * assist level factor (the measured pedal power is equal to: pedal torque * pedal cadence).

I don't have this setting available?
I have V1.0.0, Is there a newer version of 1.0.0 were you can change motor current control to or from the torque control or power control?

casainho   100 GW

100 GW
Posts: 5022
Joined: Feb 14 2011 2:43pm

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by casainho » Jun 08 2020 12:21pm

jeff.page.rides wrote:
Jun 08 2020 12:08pm
Where in the settings with version 1.0.0 do you change motor current control to or from the torque control or power control?
Find it on the configurations wiki page.
- EBike wireless standard: wireless motor, wireless cycling GPS display Garmin Edge and wireless remote with wireless brake sensor
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of OpenSource knowledge and technology for ebikes: Wireless EBike standard ANT+ and Bluetooth, TSDZ2 OpenSource firmware, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

Please consider a donation to help developments: paypal.me/jorgecasa

HughF   100 W

100 W
Posts: 215
Joined: Jan 23 2020 6:13pm

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by HughF » Jun 08 2020 1:21pm

Nfer wrote:
Jun 08 2020 10:50am
cavi wrote:
Jun 02 2020 8:58pm
For the best hill start performance I would setup as the following:

Motor current control = torque
Assist w/o pedal = enable
Startup BOOST = disable
Startup BOOST duration = 5
Startup BOOST fade = 6.5
Motor current ramp = 10a (maximum)
Calibrate your torque sensor then enable calibrations
Motor current max = 20a
I used these settings and it solved the lack of the boost function. The assist w/o pedal rotation enable helps to deliver the power quicker.
I prefer to use the control power instead of torque. I am using high cadence and low gears.
I am glad that the settings worked well for you. Many miles of riding and testing on hills around here during lockdown helped me find those settings.
Genesis iOiD Alfine8 Hard tail MTB, 36v TSDZ2, 13s battery, SW102 display
Raleigh reynolds road frame from the 80's, TSDZ2, SW102 display, 1x10 drivetrain, gravel tyres

jeff.page.rides   100 W

100 W
Posts: 228
Joined: Aug 13 2019 10:16am

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by jeff.page.rides » Jun 08 2020 1:45pm

casainho wrote:
Jun 08 2020 12:21pm
jeff.page.rides wrote:
Jun 08 2020 12:08pm
Where in the settings with version 1.0.0 do you change motor current control to or from the torque control or power control?
Find it on the configurations wiki page.
I found it on the wiki page see below, but when I go into the motor configuration screen I don't have the option to choose.
Motor control / Motor ctrl torque If set to "torque", the motor current (torque) will be equal to: measured pedal torque * assist level factor. If set to "power", the motor current will be equal to: measured pedal power * assist level factor (the measured pedal power is equal to: pedal torque * pedal cadence).

User avatar
mallesepp   100 mW

100 mW
Posts: 37
Joined: May 05 2020 11:07am

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by mallesepp » Jun 08 2020 3:17pm

jeff.page.rides wrote:
Jun 08 2020 1:45pm
casainho wrote:
Jun 08 2020 12:21pm
jeff.page.rides wrote:
Jun 08 2020 12:08pm
Where in the settings with version 1.0.0 do you change motor current control to or from the torque control or power control?
Find it on the configurations wiki page.
I found it on the wiki page see below, but when I go into the motor configuration screen I don't have the option to choose.
Motor control / Motor ctrl torque If set to "torque", the motor current (torque) will be equal to: measured pedal torque * assist level factor. If set to "power", the motor current will be equal to: measured pedal power * assist level factor (the measured pedal power is equal to: pedal torque * pedal cadence).
Then you have installed 1.0.0 X Alpha. Casainho only implemented torque control from 1.0.0 beta and final.
Hardtail Canyon AL 6.0 (2014) TSDZ2 36V 10S5P 860C
RaceBike Canyon AL 9.0 Di2 (2011) Humanpower 200 Watt/120 Minuten
Garmin Edge 1030+, bePro Powermeter, Garmin Edge Remote

jeff.page.rides   100 W

100 W
Posts: 228
Joined: Aug 13 2019 10:16am

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by jeff.page.rides » Jun 09 2020 8:55am

mallesepp wrote:
Jun 08 2020 3:17pm
jeff.page.rides wrote:
Jun 08 2020 1:45pm
casainho wrote:
Jun 08 2020 12:21pm
jeff.page.rides wrote:
Jun 08 2020 12:08pm
Where in the settings with version 1.0.0 do you change motor current control to or from the torque control or power control?
Find it on the configurations wiki page.
I found it on the wiki page see below, but when I go into the motor configuration screen I don't have the option to choose.
Motor control / Motor ctrl torque If set to "torque", the motor current (torque) will be equal to: measured pedal torque * assist level factor. If set to "power", the motor current will be equal to: measured pedal power * assist level factor (the measured pedal power is equal to: pedal torque * pedal cadence).
Then you have installed 1.0.0 X Alpha. Casainho only implemented torque control from 1.0.0 beta and final.
Thanks

Benoit   10 mW

10 mW
Posts: 31
Joined: May 22 2020 3:24am

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by Benoit » Jun 09 2020 4:44pm

casainho wrote:
Jun 07 2020 3:23pm
Benoit wrote:
Jun 07 2020 7:52am
As soon as all will be done, I'll made a pull request.
I am waiting for it!! When you do it, I will test and make a new version.
Auto reset is now working but, there is a case it won't work because of how time is saved. As it is reset to 0 every day (RTC_IRQHandler function in rtc.c file), in some cases auto reset won't occur.
Example : if last trip update occurs at 14h and auto reset feature is set to 24 hours. The next day it then should be reset at 14h.
But as RTC counter is reset to 0 every time counter exceed 86399 (SECONDS_IN_DAY variable), the day after at 14h, I won't be able to know that actually 1 day has passed and I'll compare 14h to 14h so 0 second and so no reset.
So auto reset above 24h can't work.

Is there any reason RTC counter is reset everyday ? As it is stored in two 16 bits integers, that's 2^32 seconds = more than 136 years.
Managing date would be difficult I think, but we don't need it. We could just store amount of seconds passed since time has been set and let it increment every second.

cavi   10 W

10 W
Posts: 79
Joined: Jan 20 2020 7:00pm

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by cavi » Jun 09 2020 5:14pm

Benoit wrote:
Jun 09 2020 4:44pm
casainho wrote:
Jun 07 2020 3:23pm
Benoit wrote:
Jun 07 2020 7:52am
As soon as all will be done, I'll made a pull request.
I am waiting for it!! When you do it, I will test and make a new version.
Auto reset is now working but, there is a case it won't work because of how time is saved. As it is reset to 0 every day (RTC_IRQHandler function in rtc.c file), in some cases auto reset won't occur.
Example : if last trip update occurs at 14h and auto reset feature is set to 24 hours. The next day it then should be reset at 14h.
But as RTC counter is reset to 0 every time counter exceed 86399 (SECONDS_IN_DAY variable), the day after at 14h, I won't be able to know that actually 1 day has passed and I'll compare 14h to 14h so 0 second and so no reset.
So auto reset above 24h can't work.

Is there any reason RTC counter is reset everyday ? As it is stored in two 16 bits integers, that's 2^32 seconds = more than 136 years.
Managing date would be difficult I think, but we don't need it. We could just store amount of seconds passed since time has been set and let it increment every second.
did you add a button to do a manual reset on the screen or do I have to go into the deep settings?

casainho   100 GW

100 GW
Posts: 5022
Joined: Feb 14 2011 2:43pm

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by casainho » Jun 10 2020 2:04am

Benoit wrote:
Jun 09 2020 4:44pm
casainho wrote:
Jun 07 2020 3:23pm
Benoit wrote:
Jun 07 2020 7:52am
As soon as all will be done, I'll made a pull request.
I am waiting for it!! When you do it, I will test and make a new version.
Auto reset is now working but, there is a case it won't work because of how time is saved. As it is reset to 0 every day (RTC_IRQHandler function in rtc.c file), in some cases auto reset won't occur.
Example : if last trip update occurs at 14h and auto reset feature is set to 24 hours. The next day it then should be reset at 14h.
But as RTC counter is reset to 0 every time counter exceed 86399 (SECONDS_IN_DAY variable), the day after at 14h, I won't be able to know that actually 1 day has passed and I'll compare 14h to 14h so 0 second and so no reset.
So auto reset above 24h can't work.

Is there any reason RTC counter is reset everyday ? As it is stored in two 16 bits integers, that's 2^32 seconds = more than 136 years.
Managing date would be difficult I think, but we don't need it. We could just store amount of seconds passed since time has been set and let it increment every second.
Since I recall, I used the sample code from ST for RTC. You are free to change if needed.

I am thinking that maybe next version can have the pedal crank length configuration.
- EBike wireless standard: wireless motor, wireless cycling GPS display Garmin Edge and wireless remote with wireless brake sensor
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of OpenSource knowledge and technology for ebikes: Wireless EBike standard ANT+ and Bluetooth, TSDZ2 OpenSource firmware, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

Please consider a donation to help developments: paypal.me/jorgecasa

Benoit   10 mW

10 mW
Posts: 31
Joined: May 22 2020 3:24am

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by Benoit » Jun 10 2020 2:07am

cavi wrote:
Jun 09 2020 5:14pm
did you add a button to do a manual reset on the screen or do I have to go into the deep settings?
For now, manual reset is only available in a new menu "Trip memories" in the configuration screen, like all other settings.
I'll do better later.
860C_trip_memories.png
860C_trip_memories.png (351.45 KiB) Viewed 1290 times
You can induviduallky reset trip A or B, with "Reset trip ..." option, setting it to "yes" (it'll go back to "no" immediately, just like the "reset all settings" in the "Display" menu).

Post Reply