Does anyone have Delphi?

guerney

Esteemed Pedelecer
Sep 7, 2021
10,222
3,000
I'm posting this here because this is probably the most visited part of the forum. If anyone here has access to Delphi, please could you read and possibly respond to this post regarding editing the Open Source Code for Penov's Bafang Configuration Tool, to compile a version to attempt to enable a UK legal 6km/h speed limit for Bafang BBSXX(X) Throttles? It's a bit of a long shot, because Delphi is somewhat rare these days and not cheap. There are programmers out there somewhere who still have Delphi...

 
Last edited:

Woosh

Trade Member
May 19, 2012
19,527
16,464
Southend on Sea
wooshbikes.co.uk
  • Like
Reactions: guerney

guerney

Esteemed Pedelecer
Sep 7, 2021
10,222
3,000
I did have Delphi in the 90s before it became kylix. It has probably evolved a lot since.
You can download the newest version here to see if the codebase still compiles.
Download the Free Delphi: Community Edition - Embarcadero
If it does, I can take a look at the code for you.
That's when I last looked at Delphi myself, but I didn't look at it for long, because I wasn't being paid to program in Delphi. According to the feature matrix - the Community Edition is "Limited", which could mean a limited library, in which case the source code won't compile. The TComboBox visual object appears to store the throttle speed limit values starting from 15km/h? Adding the 6km/h value into that object using the Delphi visual editor, is all that may be required? Also, there's this line in the CommonFunctions.pas file:

ProfileFile.WriteInteger('Throttle Handle','SL',MainForm.edThrSpeedLim.ItemIndex);

...which suggests the throttle limit value is passed from TComboBox from MainForm. There are no mentions of 15, 16, 17 etc. anywhere else that are viewable using Notepad++ in any of the other files, therefore those values are highly likely to be stored in the TComboBox visual object on MainForm. The source files are here, if you fancy having a crack at it. I might have a go when I get a bit of time.


I've emailed Mr.Penov and requested a UK legal 6km/h throttle option, he hasn't responded. I expect he's lost interest or has better things to do. 16.05.2017 was his last version of Penov's Bafang Configuration Tool.

 
Last edited:

sjpt

Esteemed Pedelecer
Jun 8, 2018
3,679
2,675
Winchester
I haven't used Delphi, but I have recently been using free Lazarus IDE + FreePascal to resuscitate some old (1980's) Pascal (non-Delphi IBM mainframe) code. It claims to be able to use Delphi version of Pascal

You are probably better off with Embarcadero Woosh mentioned above as it is specific to Delphi.
It's a shame Pascal fragmented into so many incompatible dialects.
 
  • Like
Reactions: guerney

guerney

Esteemed Pedelecer
Sep 7, 2021
10,222
3,000
Maybe reprogramming the "Speeed" app is a faster route? I've also emailed that developer requesting a 6km/h UK legal throttle enabling version of his app.



The throttle limit values are listed in the JSON code:

throttle: {
header: "Throttle Assist",
startVoltage: "Start Voltage",
endVoltage: "End Voltage",
mode: {
text: "Mode",
types: ["Speed", "Current"],
},
designatedAssistLevel: {
text: "Designated Assist Level",
types: ["By Display's Command", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
},
speedLimit: {
text: "Speed Limit",
types: [
"By Display's Command",
"15km/h",
"16km/h",
"17km/h",
"18km/h",
"19km/h",
"20km/h",
"21km/h",
"22km/h",
"23km/h",
"24km/h",
"25km/h",
"26km/h",
"27km/h",
"28km/h",
"29km/h",
"30km/h",
"31km/h",
"32km/h",
"33km/h",
"34km/h",
"35km/h",
"36km/h",
"37km/h",
"38km/h",
"39km/h",
"40km/h",
],

},
 
Last edited:

guerney

Esteemed Pedelecer
Sep 7, 2021
10,222
3,000
Thing is, they might make throttles legal on pedelecs soon anyway in the new Transport bill, therefore it may not be worth reprogramming the Bafang BBSXX(X) firmware programming tools...
 
Last edited:

Woosh

Trade Member
May 19, 2012
19,527
16,464
Southend on Sea
wooshbikes.co.uk
According to the feature matrix - the Community Edition is "Limited", which could mean a limited library, in which case the source code won't compile.
that is why someone should install and test the code that Mr Penov has kindly posted.
You are much more interested in adding to Mr Penov's code than any of us so I thought you may want to do that.
I don't want my customers to reprogram the BBSes I sell so I have no vested interest.
 

guerney

Esteemed Pedelecer
Sep 7, 2021
10,222
3,000
that is why someone should install and test the code that Mr Penov has kindly posted.
You are much more interested in adding to Mr Penov's code than any of us so I thought you may want to do that.
I don't want my customers to reprogram the BBSes I sell so I have no vested interest.

Another possibility is forking the Speeed app on Github. I depends on whether this throttle niggle gets to me. The limited Community Edition might not have access to all the required resources for the Delphi project to compile, could be a waste of time. I'll wait to see if it bugs me. Personally, I've adjusted to not having a throttle, but it'd be nice. The new Transport bill might make it moot.

 
Last edited:

guerney

Esteemed Pedelecer
Sep 7, 2021
10,222
3,000
I don't want my customers to reprogram the BBSes I sell so I have no vested interest.
You could program your Bafang BBSXX(X) controllers with UK legal 6km/h throttles before delivery? Seems that UK legal throttles may finally be catching on with manufacturers - a poster in a recent KT thread asked how to remove a factory programmed 6km/h throttle limit.
 

Woosh

Trade Member
May 19, 2012
19,527
16,464
Southend on Sea
wooshbikes.co.uk
You could program your Bafang BBSXX(X) controllers with UK legal 6km/h throttles before delivery? Seems that UK legal throttles may finally be catching on with manufacturers - a poster in a recent KT thread asked how to remove a factory programmed 6km/h throttle limit.
No. The law 1/1/2016 applies only to my fully built e-bikes, not kits.
If I fit one of those BBSes, I have to ask the customer to plug in the throttle.
As a user, he's not limited by the law.
 
  • Informative
Reactions: guerney

guerney

Esteemed Pedelecer
Sep 7, 2021
10,222
3,000
that is why someone should install and test the code that Mr Penov has kindly posted.
You are much more interested in adding to Mr Penov's code than any of us so I thought you may want to do that.
If the BBS01B controller isn't capable of a 6km/h throttle, I could end up with a bricked controller. It doesn't bug me THAT much.
 

guerney

Esteemed Pedelecer
Sep 7, 2021
10,222
3,000
No. The law 1/1/2016 applies only to my fully built e-bikes, not kits.
Bloody hell, there is no winning. What is the point? Time to forget about this 6km/h throttle line of enquiry then lol.
 

Woosh

Trade Member
May 19, 2012
19,527
16,464
Southend on Sea
wooshbikes.co.uk
If the BBS01B controller isn't capable of a 6km/h throttle, I could end up with a bricked controller. It doesn't bug me THAT much.
I think you worry too much about that possibility. It's very unlikely. You kill the controller by overheating, not by limiting its speed. The worse you have to do is to reload the original code.
 

guerney

Esteemed Pedelecer
Sep 7, 2021
10,222
3,000
If I fit one of those BBSes, I have to ask the customer to plug in the throttle.
As a user, he's not limited by the law.
So as a user, if I re-programmed one of the programming tools for the Bafang for a 6km/h throttle, it'd be a legal throttle?
 
Last edited:

guerney

Esteemed Pedelecer
Sep 7, 2021
10,222
3,000
  • Informative
Reactions: Woosh

Woosh

Trade Member
May 19, 2012
19,527
16,464
Southend on Sea
wooshbikes.co.uk
So as a user, if I re-programmed one of the programming tools for the Bafang for a 6km/h throttle, it'd be legal?
the police have indicated since 2015 that they are not interested in whether you have a throttle on your bike or not. It's only the Spanish and French gendarmerie would be looking for them.
In UK law, if you have a twist and go throttle, it should be limited to 6km/h. Non twist and go throttle was not mentioned in the law. I have never heard of anyone prosecuted for having a twist and go throttle but in principle, the police do have the power.
It's a bit of a confusing situation.
If I fit a kit for a customer, I am the manufacturer, my customer is the user. I can fit a throttle but cannot plug it in, my customer not being a manufacturer is not limited by that law so he can.
If you fit a throttle, you are the manufacturer but your wife is a user. Mad or what?
 
Last edited:
  • Informative
Reactions: guerney

guerney

Esteemed Pedelecer
Sep 7, 2021
10,222
3,000
I haven't used Delphi, but I have recently been using free Lazarus IDE + FreePascal to resuscitate some old (1980's) Pascal (non-Delphi IBM mainframe) code. It claims to be able to use Delphi version of Pascal

You are probably better off with Embarcadero Woosh mentioned above as it is specific to Delphi.
It's a shame Pascal fragmented into so many incompatible dialects.
Lazarus: No dice. I may ask a very grumpy old friend who has an old version of Delphi, of the same era that this program was created. He hasn't been the same since getting car doored.
 

guerney

Esteemed Pedelecer
Sep 7, 2021
10,222
3,000
the police have indicated since 2015 that they are not interested in whether you have a throttle on your bike or not. It's only the Spanish and French gendarmerie would be looking for them.
In UK law, if you have a twist and go throttle, it should be limited to 6km/h. Non twist and go throttle was not mentioned in the law. I have never heard of anyone prosecuted for having a twist and go throttle but in principle, the police do have the power.
It's a bit of a confusing situation.
If I fit a kit for a customer, I am the manufacturer, my customer is the user. I can fit a throttle but cannot plug it in, my customer not being a manufacturer is not limited by that law so he can.
If you fit a throttle, you are the manufacturer but your wife is a user. Mad or what?
What permits or licenses would a manufacturer of ebikes need to obtain, in order to test new non-twist and go throttle designs on the public highway? (I'm hoping there's a loophole we manufacturers/DIYers in the strange legally fuzzily defined area that kit bikes inhabit, which we can exploit)
 
Last edited:

John_S

Pedelecer
Jul 27, 2013
161
29
Thing is, they might make throttles legal on pedelecs soon anyway in the new Transport bill, therefore it may not be worth reprogramming the Bafang BBSXX(X) firmware programming tools...
I certainly hope the new bill will result in throttles becoming legal. However, the user Flecc (who is clearly very knowledgeable) believes it is highly unlikely.
 

guerney

Esteemed Pedelecer
Sep 7, 2021
10,222
3,000
I certainly hope the new bill will result in throttles becoming legal. However, the user Flecc (who is clearly very knowledgeable) believes it is highly unlikely.
Now that Boris is on his way out (if he doesn't impose martial law to defend us against Russia hold onto power), I don't anticipate any major changes to pedelec law. I had a faint hope Mogg would upset all apple carts possible, while screeching loudly like a pterodactyl and gesticulating wildly with his leathery wings, about how independent and free thinking the UK now is post Brexit - see number 5 of his stated pitiful 9 "Brexit opportunities":


A quick shift from low gear to a motor assisted high gear, is the method I'm using when entering roundabout systems. The bbs01b has enough torque to make that easy, if the high gear isn't too high.
 
Last edited:
  • :D
Reactions: John_S