Modifications to Dave Bodnar's DCC++ Nextion Throttle

NormHal Jul 16, 2017

  1. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    Norm
    Just got around to actually loading V04.42 into a working throttle……. I know you have more work to do on your proposed modifications but I am perplexed. :(
    1: change of loco address on pg 1 is not reflected on pg 2 and so I have no way of getting a response from a loco.
    2: Function buttons change the binary but do not light (next iteration?).. I can not tell if they function since there is no active loco as per the above.
    3: Speed indication responds to RE but not slider.
    4: +/_ speed buttons get no response from slider
    In this ver should direction button indications respond to press? At present they only respond to RE press.
    The lack of being able to get a loco address assigned, prevents further testing on my part so I await the next version.
    Steve F
     
    Scott Eric Catalano likes this.
  2. NormHal

    NormHal TrainBoard Member

    138
    126
    12
    Hi Steve, are you quite sure you compiled and uploaded both the Nextion HMI and the Arduino sketch?? both have the same name - different extension:)
    Reason I ask is on reading your reply, I immediately downloaded the zip of Version 0.42 into a clean directory, compiled and uploaded both, and I have no visible problems. I am not connected to a layout, nor a base station, so my tests are currently limited to only testing the user interface, watching the data streams being sent to the "virtual" base station, and making sure all parts of the Nextion are correctly updated. Going to Page 1, aborting, or changing an address works (visually) correctly - ie. if functions are set for a specific address and Page 1 is visited, then aborted, the original speed, direction and functions are correctly restored. A new address being entered either as four digits, or with the "Done" button, the new loco has no functions set, direction defaults to forward and speed 0. In short, I too am perplexed at your findings:-( Please revert ASAP as I'd really like to resolve soonest.

    Please let me know if you make any progress?
    Best
    Norm
     
    Last edited: Aug 1, 2017
    Scott Eric Catalano likes this.
  3. NormHal

    NormHal TrainBoard Member

    138
    126
    12
    Message deleted...
     
    Last edited: Aug 1, 2017
  4. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    Norm
    Firstly .. are you using an enhanced 3.2? ...... the only throttle (of 5) that I have Bodnars HC12 on is a basic and I can only assume that that is the prob. Loaded both the .43 .ino to an UNO and .tft to Nextion and get the same result as I mentioned ...... which makes it impossible to even get to pg 1 as the loco buttons do not respond. My experience with Nextion is that anything written for a basic can compile to an enhanced .... I've never tried the reverse ....perhaps that may be the prob
     
    Scott Eric Catalano likes this.
  5. NormHal

    NormHal TrainBoard Member

    138
    126
    12
    Hi Steve, I messed up when loading version 4.3... and have deleted same. I worked all day trying to get around some really peculiar problems which might relate to your problems... Yes, I am using an enhanced version - I have a basic version of the 4.3" Nextion which probably won't help much. Right now I'm having interference of the throttle slider and function keys - I might need to re-think the way I'm interpreting what the Nextion sends.

    But I'll be back:)
    Norm

    To take a check-point, I'm going to look at Version 0.42 again, because it's the last one to fit on the Basic Nextion. I'll implement the changes I made and let's see if it fixes what you're experiencing...
     
    Scott Eric Catalano likes this.
  6. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    Will await your next version
     
    Scott Eric Catalano likes this.
  7. NormHal

    NormHal TrainBoard Member

    138
    126
    12
    Steve, can you please try these two builds? I've added an extra filter in the parsing of the data coming from the Nextion and so far it seems to me to be more predictable:)

    Norm
     

    Attached Files:

    Scott Eric Catalano likes this.
  8. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    In meetings rest of day .... will do in the AM ...... we might want to get on this by email .....
    esfeld@cyberdude.com
     
    Scott Eric Catalano likes this.
  9. NormHal

    NormHal TrainBoard Member

    138
    126
    12
    For anyone interested, here is my latest (work in progress) version 0.43 of the modifications I have done to Dave Bodnar's Nextion based throttle.
    With the help of Steve (esfeld) and Keith Ledbetter this should hopefully be usable on a Nextion 3.2" Enhanced display.

    Please note the whilst the buttons on the bottom of the display modify the Function key assignments, the underlying code is not (yet) in place to handle functions above F8, so any complaints will be ignored...

    'Till next time,
    Norm
     

    Attached Files:

  10. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    Norm:
    Same result as before, the only button on pg 2 that gives a response (green ) is "C" all the other buttons do not respond. The RE shows proper response to push and rotation. If you go to "Debug" the in Nextion editor .. on the Simulator you will see the same results I am getting.
    After a very, admittedly brief, look at your Nextion code ..I fail to even see where you attempt to change to page 1 when a loco "999" button is pressed, so I am beginning to understand why there is no response to any button presses.
    Keith:
    Do you get any proper response to button pushes? Are you using a basic or enhanced Nextion?
     
    Last edited: Aug 2, 2017
    Scott Eric Catalano likes this.
  11. NormHal

    NormHal TrainBoard Member

    138
    126
    12
    Hi Steve,
    You might want to try the latest version - functions 0 to 12 are now supported. The interface shows up to F24, but don't expect any reliable results from them. The rest all seems good to me:) F0/FL appears across all three function groups and can be selected at anytime. IMHO the last remaining task is to fully implement Functions 13 to 24, and add F25 to F28. Real estate and layout constraints are holding me up. I might consider modifying the three function group buttons at the bottom to accommodate more functions

    As always, any feedback is most welcome:)
    Best
    Norm
     

    Attached Files:

  12. NormHal

    NormHal TrainBoard Member

    138
    126
    12
    Had a productive evening and morning:)
    One decision I took was the use of the 'C' button. On the first group of function keys (F1 to F8), the 'C' key will clear all 24 functions. Pressing the 'C' key either on the F9 to F16 group or the F17 to F24 group, will only clear the functions that are on that display. It's a minor mod to make the 'C' always clear all functions of the active loco if that is required:)

    Please test as much as possible and feed back? Unless bugs are found or additional features requested, I consider this close to final. For the time being I am leaving functions 25 to 28 off, although the internal code is all in place. It's going to need some changes to the Nextion layout to get them implemented.

    As a small tip, I have found the most reliable way to have multiple versions of Arduino code on a system is to have a unique directory in the "Arduino" folder of your "Documents" directory. Changing the Sketch folder from default has often given me problems. For the code attached, I would create a folder called "DCCpp_Nextion_Throttle_V0.45" and extract both the .hmi and .ino files into that directory.

    My next item on the todo list is to experiment with the HC12 wireless link to the Base Station. How is your progress Steve:)
    Best,
    Norm
     

    Attached Files:

    Scott Eric Catalano likes this.
  13. Keith Ledbetter

    Keith Ledbetter TrainBoard Member

    279
    195
    12
    SOrry been travelling and off the grid for a couple days. I'll definitely get the latest version loaded either tonight or tomorrow and play with it and let you guys know results. Thanks once again for all your work on this!
     
    Scott Eric Catalano likes this.
  14. NormHal

    NormHal TrainBoard Member

    138
    126
    12
    I've been doing some further testing with the Modified throttle, and have come across a problem I hope someone can help me with.

    When I connect the throttle via USB to a PC as a "stand-alone' device and monitor the data streams transmitted to the serial port, all the data looks 100% correct.

    But when I connect the throttle's Arduino TX pin directly to a Base Station's RX pin, and then try to monitor the data via the USB port of the Base Station, the very same data is corrupted. Is this because the USB port and RX pin are being used in parallel, and if so, is there another way I can monitor the incoming data stream?

    I'd appreciate any thoughts?

    Best
    Norm
     
    Scott Eric Catalano likes this.
  15. Jimbo20

    Jimbo20 TrainBoard Member

    274
    178
    11
    Hi, I have had a similar problem when trying to monitor the base station data when already using its serial lines. You can't use the arduino usb port at the same time as the serial pins. The way I got round it was to use a 'ttl serial to usb ftdi cable' and only connect the cable's ground and rx data wires to the base station ground and either the rx or tx pin, depending on whether you want to monitor the input or output data of the base station. If you need to monitor both input and output at the same time, you would need two ftdi cables, and have two serial monitor windows open on the pc.

    Jim
     
  16. Keith Ledbetter

    Keith Ledbetter TrainBoard Member

    279
    195
    12

    Unfortunately I'm getting same thing. Cant do anything past initial screen. reverted to old version (4.0) and all is well so I'm guessing has somehow to do with our basic (non enhanced) displays? I tried version 4.5 and then 4.4 but no dice. bummer as I really like the look and layout!

    Steve (or anyone else with a basic) any luck with version 4.5?

    I did successfully add a power on and off button to the 4.0 version (copying Norm's code) and it works fine. That was my main goal. More then happy to post that if useful. I may play some more this weekend with it.

    Norm the wireless link with HC 12 is super easy and works outstanding, Honestly you'll have it working in 15 minutes.
     
    Last edited: Aug 4, 2017
    Scott Eric Catalano likes this.
  17. NormHal

    NormHal TrainBoard Member

    138
    126
    12
    This is really distressing:-( I understood the only difference between the Basic and Enhanced was the Flash memory - 4M on the Basic and 16M on the Enhanced. I have a Basic 4.3" display which I compiled V0.45 for and it works visually perfect. The data sent from the Nextion to the serial port is also good when viewed with the serial monitor.

    I'm going to carefully view the changes made between 0.4 and 0.45 to try to identify the difference. I know so far that the major change was that up to and including v0.4 the Arduino code would read the values from the Nextion for the slider which resulted in false data being read if the slider was 'moving'

    Out with the bug squisher - I'm sure we'll get to the bottom of it:)

    Best
    Norm
     
    Scott Eric Catalano likes this.
  18. NormHal

    NormHal TrainBoard Member

    138
    126
    12
    A quick update before I'm off to work... I have established that everything is working - v0.45 on 3.2 Enhanced Nextion, HC12 link or directly wired, There was actually nothing amiss - I hadn't realized that the Serial Port monitor connected to a Base Station presents different information to that coming from the Throttle:-( Thanks Jim for your suggestion BTW:). I connected up an Arduino Motor driver board and can control the Base Station:). Later today I'm going to apply track power to the driver board and connect everything to a small test track - exciting times:)

    Before setting up a conversation with you and Steve, Keith, one question... On V0.4 when you 'slide' the slider, does the 'handle' jitter and the speed randomly reset to 0? If there is a difference between the Basic and Enhanced behaviour, this might be the cause of the problem. If you don't experience the resetting, I could then revert to that version of the code for the Basic version?

    Cheers,
    Norm
     
  19. NormHal

    NormHal TrainBoard Member

    138
    126
    12
    For those who have been following this thread, you will notice that we seem to be having some problems with Nextion HMI files compiled and working on an Enhanced 3.2" Nextion display, but causing problems when compiled for a Basic version.

    Can anyone (else) with an Enhanced 3.2" display and an Arduino (UNO, NANO, or Pro Mini) assist by sharing any fndings related to the differences between Basic and Enhanced, or better still any thoughts as to why the code would work on Enhanced and not Basic? Yes, the HMI is well within the RAM size of both:) - < 1.5M to be specific...

    TIA
    Norm
     
    Scott Eric Catalano likes this.
  20. Keith Ledbetter

    Keith Ledbetter TrainBoard Member

    279
    195
    12
    That's super odd you got it to work on your basic. This weekend I will redownload/recompile/reload everything from scratch and try again as maybe something just buggy happened with both of us.

    I will check the jitter issue. I don't remember it randomly going to zero but I will see.

    Quick question is there anything you can think of that would cause a problem with the screen at 115200 baud. I have my nextion set to that and made the quick one line mod to the arduino code to do the same. Works fine on the 4.0 but maybe something added references it or something? Just trying to think of anything different. On of my tests will be reverting it back to 9600 baud again just to make sure.
     
    Scott Eric Catalano likes this.

Share This Page