DCC-EX / BaseStation-EX

Partial re-write of DCC++, maintained for historical purposes. Not actively bug-fixed or developed
https://dcc-ex.com
19 stars 8 forks source link

Current Max in motor board setup rather than global #9

Closed kwledbetter closed 4 years ago

kwledbetter commented 4 years ago

I would like to calibrate current sample max to be defined in each supported motor shield. ultimately being selectable for the high power motor shields would be nice as well, something like 3A, 5A,or 10A for the BTS7960 for instance but at least getting the right levels in for a default without user having to go change the code. If could choose in Amps rather than 0-1023 would be desirable as well.

FrightRisk commented 4 years ago

Wish granted. Take a look at frightrisk-current-mod branch. Several files changed. Not sure how you want to handle current, but right now it selects it based on settings we hard code computed from what works. We need to test and come up with actual data. So you would select BTS7960-5A or 10A, etc. I can put more comments into the code or explain what I am doing. Obviously you can do a compare with Master, but quick stix is this:

currentmonitor.h - add board types to an enumerator MOTOR_BOARD_TYPE. Added/Changed private variables in the Motorboard Class

DCCpp.cpp - Add new motor boards to MOTOR_SHIELD_TYPE

currentmonitor.cpp - most of the changes are here to the Motorboard::Motorboard() routine and the Motorboard::Check() routine. Motorboard::GetLastRead() returns a value with the command. We will break JMRI if I have this as current in milliamps right now because it just sends that command and expects a pin reading. We would have to make changes to the JMRI current monitor and think of what we want that current monitor to look like. We can have pin reading, max current and actual current. That can give a graph with percentage power used as exists now with actual milliamps. We know max pin value is 1023 so a reading of 512 is 50%. But what is "max" is may well be below that with short circuit or overheating protection. And how does actual current in milliamps fit in? How accurate is each board's current reporting? So we need some design discussion about that.

See what you think or what you would change or add. If you want to change the current setting at runtime, that is a whole 'nother kettle of fish. But dream big and suggest how things should work if difficulty wasn't a factor.

kwledbetter commented 4 years ago

Really good stuff! I'll look more detailed as I get time and agree some testing and graphs would be useful but really great and is a great improvement!

cwcarr2002 commented 4 years ago

so I am a lil new and had just figured out how to change the current value to increase the available output from the motor shield using 0-1023 in the original dcc++. I have not installed dccex yet. I just downloaded and changed the motor board for a polulu. and I cant tell with the changes to current monitor how to up the power. it looks like its set for 1.49amp. can I just change that number or do I need to change anything else too. thks.

atanisoft commented 4 years ago

it looks like its set for 1.49amp. can I just change that number or do I need to change anything else too.

That would be a bug and the max is either 2.5amp or 3.0amp per channel, the limit is dependent on which Pololu device you have.

cwcarr2002 commented 4 years ago

It's the 3 amp. Can I change by just typing in a higher value revompile and up load. or is it more involved. It does 3a but I was going to set it for 2 or 2.5ThksSent from my Verizon, Samsung Galaxy smartphone -------- Original message --------From: Mike Dunston notifications@github.com Date: 4/14/20 18:39 (GMT-05:00) To: DCC-EX/BaseStation-EX BaseStation-EX@noreply.github.com Cc: cwcarr2002 cwcarr2002@gmail.com, Comment comment@noreply.github.com Subject: Re: [DCC-EX/BaseStation-EX] Current Max in motor board setup rather than global (#9)

it looks like its set for 1.49amp. can I just change that number or do I need to change anything else too.

That would be a bug and the max is either 2.5amp or 3.0amp per channel, the limit is dependent on which Pololu device you have.

—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or unsubscribe. [ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/DCC-EX/BaseStation-EX/issues/9#issuecomment-613715683", "url": "https://github.com/DCC-EX/BaseStation-EX/issues/9#issuecomment-613715683", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

atanisoft commented 4 years ago

Can I change by just typing in a higher value revompile and up load. or is it more involved.

You can set this line from 160 to 220 for 2A, 270 for ~2.5A, 320 for almost 3A.

cwcarr2002 commented 4 years ago

That's great thks. Iam on the road so I am gonna try to change over to EX when I get home. Thank you. Relly cool that Ya'll have picked this ball up and ran with it. Have a great day.Sent from my Verizon, Samsung Galaxy smartphone -------- Original message --------From: Mike Dunston notifications@github.com Date: 4/14/20 21:08 (GMT-05:00) To: DCC-EX/BaseStation-EX BaseStation-EX@noreply.github.com Cc: cwcarr2002 cwcarr2002@gmail.com, Comment comment@noreply.github.com Subject: Re: [DCC-EX/BaseStation-EX] Current Max in motor board setup rather than global (#9)

Can I change by just typing in a higher value revompile and up load. or is it more involved.

You can set this line from 160 to 220 for 2A, 270 for ~2.5A, 320 for almost 3A.

—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or unsubscribe. [ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/DCC-EX/BaseStation-EX/issues/9#issuecomment-613758223", "url": "https://github.com/DCC-EX/BaseStation-EX/issues/9#issuecomment-613758223", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

FrightRisk commented 4 years ago

Look at the new version in development. Let me know if the board settings mentioned here are correct. If not, I will change them. The new values are all in milliAmps which is much easier to relate to than pin readings. It defaults to 2.5A (2500 milliAmps)

cwcarr2002 commented 4 years ago

Cool I'll have to download that and check it out. Will let you know. ThksSent from my Verizon, Samsung Galaxy smartphone -------- Original message --------From: Fred notifications@github.com Date: 5/8/20 14:41 (GMT-05:00) To: DCC-EX/BaseStation-EX BaseStation-EX@noreply.github.com Cc: cwcarr2002 cwcarr2002@gmail.com, Comment comment@noreply.github.com Subject: Re: [DCC-EX/BaseStation-EX] Current Max in motor board setup rather than global (#9) Look at the new version in development. Let me know if the board settings mentioned here are correct. If not, I will change them. The new values are all in milliAmps which is much easier to relate to than pin readings. It defaults to 2.5A (2500 milliAmps)

—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or unsubscribe. [ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/DCC-EX/BaseStation-EX/issues/9#issuecomment-625958973", "url": "https://github.com/DCC-EX/BaseStation-EX/issues/9#issuecomment-625958973", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]