DCC++ Hardware - Throttles

KE4NYV Jan 25, 2016

  1. David Bodnar

    David Bodnar TrainBoard Member

    264
    481
    13
    HVT and Scott Eric Catalano like this.
  2. UK Steve

    UK Steve TrainBoard Member

    453
    683
    12
    Dave,

    I've posted several suggested changes back in the original code box on page 15.
    It's pretty rudimentary stuff, but clears out some SRAM hogs.
    Hope it helps.

    S.
     
    Scott Eric Catalano likes this.
  3. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    Dave
    Ver 2.8 compiles, loads but when page 2 displays I get no response from the LCD ...... the old code V2.3 still works.
    Steve F
     
    Last edited: Sep 3, 2016
    Scott Eric Catalano likes this.
  4. UK Steve

    UK Steve TrainBoard Member

    453
    683
    12
    All,

    An amateur attempt at video but you'll get the idea.
    Note the rapid Base Station command output in the monitor lower left.
    Before you ask, the pretty IDE is Platformio a recently new open source offering, you can do much much more than just Arduino.

    Steve



    So where next guys route setting, simple turnout control ???
    CV programming ???
     
    Last edited: Sep 4, 2016
    Scott Eric Catalano likes this.
  5. David Bodnar

    David Bodnar TrainBoard Member

    264
    481
    13
    I'll have to see what is up - I may have changed the HMI file a bit - I'll work on it tomorrow and let you know
    dave
     
    Scott Eric Catalano likes this.
  6. David Bodnar

    David Bodnar TrainBoard Member

    264
    481
    13
    Scott Eric Catalano likes this.
  7. David Bodnar

    David Bodnar TrainBoard Member

    264
    481
    13
    Works well, Steve - curious about the first digits you display on the screen - I thought it would be the loco ID but it changes..... can you enlighten me?

    dave
     
    Scott Eric Catalano likes this.
  8. UK Steve

    UK Steve TrainBoard Member

    453
    683
    12
    If you watch it in a larger view it's somewhat easier to see. It's just a debug line of the binary data that should be changing on each key-press.
    Serves no useful purpose in an actual application, see the code on page 15 and all will be clear.

    Here's a snippet
    Code:
    void sendFn0_4() {
      byte mask = 31;
      byte fn = fnbtns[f] & mask;
      Serial.print("Binary = "); <--------This and the next line
      Serial.println(fn, BIN);
      Serial.print("<f");
      Serial.print(loco[f]);
      Serial.print(" ");
      Serial.print(fn + 128);
      Serial.println(">");
      Serial.println();
    }
    This morning, I'm playing with your Nextion code, see if I can help out there a little.

    Steve.
     
    Scott Eric Catalano likes this.
  9. UK Steve

    UK Steve TrainBoard Member

    453
    683
    12
    Dave,

    I've emailed some files to info@trainelectronics.

    Steve.
     
    Scott Eric Catalano likes this.
  10. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    Dave
    Uploaded HMI V 8 to my Nextion got error: "Model does not match device" While waiting for an Enhanced LCD (NX4024K032) to arrive from China I ordered one from Amazon ..... thought it was the Enhanced version but it is the Standard ((NX4024T032) which according to UK Steve does not have EEPROM capability... probably why your latest HMI is not working ..... yet, your earlier code worked on a Pro Mini. So now I will have to wait for the Enhanced version to arrive. Interesting though, the earlier HMI on a NANO holds loco addresses on reboot on the Standard Nextion.... obviously using the NANOs EEPROM ..... can you adjust the HMI v 8 code to accommodate both?
    Hope I haven't confused you thoroughly, but just trying to give you some feedback to keep the project moving forward ..... I take it you are using an Enhanced version.
    Steve F
     
    Last edited: Sep 4, 2016
    Scott Eric Catalano likes this.
  11. UK Steve

    UK Steve TrainBoard Member

    453
    683
    12
    Steve,

    After you have loaded the HMI file into the Editor, you should first check that you have the correct target device selected. I think that is where the problem is.

    Click the Setting ID tab
    CaptureN1.JPG

    Then this window pops up.

    Make sure you're set to the correct display and that the orientation is correct on the DISPLAY tab (lower left).


    CaptureN2.JPG

    Dave's configuration holds the loco addresses in Arduino EEPROM and updates the display.
    You don't need an enhanced model for all this to work.

    Steve.
     
    Last edited: Sep 4, 2016
    Scott Eric Catalano likes this.
  12. UK Steve

    UK Steve TrainBoard Member

    453
    683
    12
    Steve, Dave,

    Out of curiosity, I loaded the file to Nextion Editor and reset the parameters to my display.
    Surprisingly after a successful compile it loads to my 3.5" model, but as the original file is for a lower res screen, I'm left with some whitespace.
    However it is still functional. Great I can do some proper testing !

    S.
     
    Scott Eric Catalano likes this.
  13. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    Steve
    Thanks for jumping in .... did all that originally and just re-did it, compiled, loaded .tft to SD card and still get "Model does not match device model NX4024T032-011R"
    ..... as I said earlier, Daves earlier HMI loaded to the LCD without a problem. Are you sure your using nextion keypad project-8.HMI? What did you set in Display?
    Steve F
     
    Last edited: Sep 4, 2016
    Scott Eric Catalano likes this.
  14. UK Steve

    UK Steve TrainBoard Member

    453
    683
    12
    Scott Eric Catalano likes this.
  15. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    Did that earlier .... same error!
    EDIT .... tried a different SD card and solved that problem..... BUT as I stated in my original post .. I get the opening splash screen, tap and get page 2 but get no response on page 2 to any touches ... just a frozen screen using both a fresh compile and Daves .tft.
    Steve F
     
    Last edited: Sep 4, 2016
    Scott Eric Catalano likes this.
  16. UK Steve

    UK Steve TrainBoard Member

    453
    683
    12
    Steve,

    Lets do step by step.

    1. Load HMI to Nextion Editor.
    2. Check target device (this must match your device exactly)
    3. Compile and note the time.
    4. Copy the .tft to your SD card (make sure its creation time is as you noted) The card should have only that ONE file on it.
    5. Load to the display

    If that doesn't work, I'm lost !

    Steve.
     
    Scott Eric Catalano likes this.
  17. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    Steve
    Cross post ...... thanks, as I said I now can load the tft (different SD card) but the original problem persists .... page 2 freezes .. no response to any touch. Using Daves older version 2 everything works .. so something in version 8 is causing my problem. At least I feel I'm learning a lot.
    Steve F
     
    Scott Eric Catalano likes this.
  18. UK Steve

    UK Steve TrainBoard Member

    453
    683
    12
    Steve,

    OK, great stuff,

    Have a go at making an Fn key page or something, I'll have a look into it as time permits.
    Dave is obviously busy right now too.
    Guess you saw my video up this page a little ?

    I've proposed a few changes to the project myself, so this is very much still in the experimental stage.

    Steve.
     
    Scott Eric Catalano likes this.
  19. David Bodnar

    David Bodnar TrainBoard Member

    264
    481
    13
    Steve F - no idea on your issue - I am not using the enhanced unit just the plain vanilla unit -
    I downloaded the two files from my web page and successfully got my unit to work......
    Sometimes if I walk away for a time ideas pop into my head!
    Keep us posted
    dave
     
    Scott Eric Catalano likes this.
  20. UK Steve

    UK Steve TrainBoard Member

    453
    683
    12
    @ Steve F.

    I think the problem is the Software Serial pins to the Nextion.

    Dave has changed the config but not the comment

    Code:
    #include "Arduino.h"
    #include <SoftwareSerial.h>
    #include <Nextion.h>
    #include<EEPROM.h>
    SoftwareSerial nextion(2, 3);// Nextion TX to pin 2 and RX to pin 3 of Arduino
    
    Is currently
    
    #include "Arduino.h"
    #include <SoftwareSerial.h>
    #include <Nextion.h>
    #include<EEPROM.h>
    SoftwareSerial nextion(4, 5);// Nextion TX to pin 2 and RX to pin 3 of Arduino
    A quick swap should have you running again.

    Steve.
     
    Scott Eric Catalano likes this.

Share This Page