Friday, October 8, 2021

More USB HID Implementation

In this blog post, I discussed the issues I was having with the RAD Studio Delphi compiler and the JEDI VCL implementation of a Windows USB HID Device. Eventually tracing it down to a HID device on one laptop that was causing the issue.  At the conclusion of that debugging exercise, I postulated that there was some issue with the JEDI VCL implementation of the USB HID device that needed improvement.

I spent a few hours today in between other projects attempting to track it down further.   Mostly because it was beginning to bug me.  I dont believe there is an error in the code, it works as designed. What is missing in all of my implementations is the OnDeviceCreateError handler. I have never seen documentation that this is to be implemented, other than a short comment in the read me file that it was included. It is not in any of the examples either.  

After tracing through the code, the absence of this handler was causing the code to fail out completely, since the error is not handled. The code snippet below is what appears to be the minimum required. So far it is working on two projects. Depending on why the device is failing, your implementation may need more error processing than shown here.  

procedure TformXXX.JvHidCtrlDeviceCreateError(Controller:
          TJvHidDeviceController; PnPInfo: TJvHidPnPInfo; var Handled, RetryCreate:Boolean);
begin
     Handled:= TRUE;
     RetryCreate:= FALSE;
     FreeAndNil(PnPInfo);
end; 

My only issue is that in development you will continue to receive the error message that the device cannot be identified, which is what started this. The error message appears when you open the project and close the project. So maybe there is some improvement that can still be done. But for me right now, this has dropped far down on my list of things to do. 

 

 


 

 

 

Monday, October 4, 2021

Train Layout Progress #5

 Connecting the two sections

I knew this was going to be difficult.  The plan was to line up the two pieces, push them together to the point that the track would start to touch.  Then use the bolts to slowly pull the two pieces together.  First I had to build a shelf for the top deck to rest on.  Prior to cutting it, both the underlying plywood and the homasote layer extended over the junction of the two pieces. 

Tightening the bolts slowly brought the two pieces together.  Lining up the track and keeping it lined up was hard.  There was lots of loosening and tightening until it went together.  The bottom deck was fairly easy.   The top deck had a relatively large gap in it as seen in these pictures.  


I used an oscillating saw to cut this.  The gap was not the large when I cut it.  I had to redo the connection of each track that crossed the gap with was different combination of tracks.  This gap had to caused when I dropped this during packing.  The whole upper deck must have moved back on the supports when it hit the floor.  I looked at trying to pull it back, but there was nothing to grab with a clamp to pull against.  I just added more track and will fill the gap with acrylic filler when the time comes.

This completes the train update.  More later on some trees I bought on Amazon, a more thorough track testing and explanation of the wireless train control I am using.





Friday, October 1, 2021

Train Layout Progress #4

Signals

The station yard has 4 tracks.  Three on the triple switch and one to the left, which is also a bypass path.  Then on the main lines that loop the station yard there are two more signals.  One can be seen on the right next to the steam engine.  The other is in the lower left. All of these are Marklin 7239 type signals.  The three on the triple switch are more cosmetic than providing train control functionality.  The three tracks are all dead ends at the station building. 

On all of these Marklin 7239 type signals I separated them from the base and mounted the signal mast on the supplied bracket.  The picture below shows the three bases mounted underneath. All of the wiring from the signal mast is 30 gauge multi strand wire or smaller.  It will break easily.  I used 30 gauge solid core wire wrap wire to extend these wires to the bases.

The bases do not have any type mounting frame.  They are meant to be attached to the track.  But there was a small flange on each side.

As the above picture shows I used a large fender washer to clamp the base to the wooden support frame.  Four of these are holding the three bases.  They are more than secure enough, especially sense they are not under any strain.  The following picture shows the three mounted on the wooden support frame.  On the far side is another signal base connected to another signal.

Here is another signal base mounted with smaller washers.

In the station yard there is a signal mast mounting bracket, but no signal mast. When I did the first layout design many years ago, this line was just a pass through the station.  But now it has become a stop and feeds into the main line going to the tunnel.  It should have a signal there to control the train going through.

A note on automated train control.  Going back to the original picture.  There are six lines that feed the final triple switch at the top of the picture.  This becomes the single track main line going into the downward direction of the helix that lowers the train to the lower level.  In an automated control system, all six of these tracks need to wait on a train that has entered the helix climbing up.  Once it has cleared to the right mainline or into the station, then a train waiting can proceed.

Wiring

What a mess😊.  The following three pictures show what is looks like right now.  The wiring can get concentrated at choke points like a controller or passing though a hole in the bench work.

For the most part I have followed the Original Marklin wire color coding.

RED - track power

YELLOW -  accessory power

BROWN - power return

ORANGE - catenary power

BLUE - turnout control lines

But in the "rats nest"  that all of these wires turn into, determining which blue wire is the left or right turnout is becoming difficult.  I had put a small piece of green shrink tubing on the blue wire with the green plug.  This became tedious so I move to a new scheme.  Almost all turnout and signal control wires will need to be extended.  I found some very flexible 28 gauge wire with a silicone jacket.  It is easy to strip and solder, thus it made ideal.  Now I extend the turnout signal control lines with green for the green plug and blue for the red plug.  For the few three wire controls I have, I will use orange for the orange plug.  Not ideal, but there are only three of them right now, so I it is manageable.  Using red wire to extend the reg plug control wire would have unmanageable. It would have bee to easy to cross that with track power. 

Here is a picture of the wire and the link to Amazon where I got it.

I have a wireless train control for turnouts, signals, track control that I designed my self.  It follows the early digital control ideas.  While the PC interface is mostly done, the GUI needs lots of work to be useful.  In the mean time I need control of turnouts and signals.  This especially true of those items that cannot be easily reached.  A great example is the large number of turnouts that control the hidden yard.  These are under the second deck with catenary across most of the tracks.  They are just not reachable.  

Using my new scheme I wired up the mechanical button controls for a lot of these signals and turnouts.  Here two 4 button blocks control the important turnouts on the lower deck.

Here two 4 button blocks control the five signals in the station yard and one turnout there.  The remaining two buttons control two signals on the low deck.


This has actually only scratched the surface of the wiring.  It is not complex, there are just a large number of them, which can make the task daunting.