Announcement

Collapse
No announcement yet.

Multiple Displays and Multiple Forms Using a Teensy 4.1 as Arduino

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • James_4DSystems
    replied
    32DCT-CLB and 32D-CLB, are both hardened glass fronts.

    Regarding the issue with the loading from uSD, I just want to double check.
    Are you sure when you had the displays connected to the computer with the programmer, you clicked the "Update Banks and Run" from the Tools Menu, for each display, and then changed the project over to uSD destination and loaded the cards, and then put them in the display?
    If you didn't do the Update Banks and Run, then there would be no program in the processor to know how to load from the cards, and it will just be running the last program you loaded to Flash.
    If you didn't then load the card with the updated project, then you would have weird things happening also, it would be running the last program you had on there, etc

    You might want to repeat the process to be sure.

    Do this for each of the displays. Plug the display into the programmer, and open the project for that display in WS4. Go to Tools, and select 'Update Banks and Run' and let it load that to the display. Then select your designation to be uSD card, if it is not already. Put the uSD card into your computer, and then do a Build of the project, and it will load the project onto the uSD card. Remove the card from the computer, and put it in the display. Power up the display, it should then load the card onto the Flashbank1 and then run it.
    Each time you change the project in WS4, take the card out of the display and put it in your computer, Build the project (with designation still on uSD card) and load the card, then put it back in the display and power the display up.

    I hope that helps

    Leave a comment:


  • Riptor919
    replied
    As far as what you said in the 2nd paragraph that is exactly what i am doing. Both were on bank 1. I then programmed the sd cards without plugging the displays into the computer as i did before. When I tried to upload the sd card into the back of the bottom display, it would be stuck on form 1 and the buttons were not responding to my touch on that form like they would not light up when i pressed them and sometimes it would somehow glitch and make it to form 2 on the bottom display and those buttons did respond to my touch, but none of them would perform any sort of function even the main menu button did not execute a simple formActivate attached to the button. The top display also did not respond to anything from the bottom display either. But all of this was fixed when i programmed via the 4D-UPA. As far as the bezel thank you for that information that is very helpful. I will be back tomorrow with updates. Also do you know the exact material of the top layer of the screen like the plexiglass? just want to know what we would be dealing with and if we wanted to replace that layer it would be very helpful to know. the material seems to be the same for both screens
    Last edited by Riptor919; 27 July 2021, 08:39 AM.

    Leave a comment:


  • Riptor919
    commented on 's reply
    I will send a video tomorrow I am pretty sure that the Reset is working properly now though

  • James_4DSystems
    replied
    Hi again,

    RE the super slow performance, if you can take a video, that would help me understand what you are talking about.
    Both of your screens are resetting correctly now after resetting the Teensy? This ensures they are in sync to start with.

    RE the bottom display needing to be programmed using the UPA or else it gives you issues - sorry, can you give more information? I assume you loaded the Update Banks and Run to the module with the 4D-UPA, and have the destination set to uSD after that, and then compile and build the program to load the card in WS4 and put it in your display?

    RE the bezel, are you talking about the glass CLB? You want to trim it? There should not be any CTP signals or anything in the outer CLB edge, however what success you will have I am unsure. If you want something custom, this can be arranged, please just raise it on a Support Ticket and this can be directed to our LCD factory and things can be customised.

    Regards

    Leave a comment:


  • Riptor919
    replied
    So i got everything going I do however have to program the bottom display in the UPA or else it gives me issues. The screen would not work unless I did it that way. Also I have a randomish question where I would not really know where else to ask this. We are thinking about possibly shaving/cutting the bezels of the display and I was wondering if that would cause any issues as far as is there any sort of layers in the screen that would be destroyed that are vital for its function etc or is this doable? Let me know or if you need to you can for sure place this question in a different forum location. Thank you

    Leave a comment:


  • Riptor919
    replied
    Ok i got it actually that destination change makes life so much easier and i now have the double gen4-ib setup working thank you for you help with that. I have this weird issue though where sometimes my screen will perform the functions super quick and other times it will be super super slow say on when it is appending the numbers to the frequencies. Also I moved everything to a PCB we created and it finally started working when I swapped the TX and RX jumpers (go figure). Should I find a way to maybe clear the buffer or something like that? thank you. I am going to reattach everything here so you can just have an idea of where i'm at
    Attached Files
    Last edited by Riptor919; 24 July 2021, 02:26 AM.

    Leave a comment:


  • James_4DSystems
    replied
    So the COM port selection in Workshop4 sets where Genie will talk out of the display.
    Setting it to COM1 means it will use the 2 GPIO pins you have selected out of the 30 way FFC connector, instead of the standard RX/TX pin.
    If you are using the gen4-IB, you MUST use COM0 as only TX/RX come out of the gen4-IB.
    If you are using the 4D-UPA, you MUST use COM1 as the TX/RX is being connected to the USB to Serial chip on the programmer, which makes connecting those pins also to your Arduino, not a good idea. It normally results in comms not working. So this is why you would use COM1 in this situation, BUT you then must take the wires from the 2 GPIO pins you selected in WS4, off the pads on the 4D-UPA and wire them up.

    Remember, changing the COM port in Workshop4, means you have to change the wiring to suit too. Also TX goes to RX, and RX goes to TX, between the teensy and the display.

    So yes, you can use gen4-IB on both displays, like I did in the video I presented. You will just have to unplug the gen4-IB and replace it with the 4D-UPA when you want to program the display, and then switch it back to the gen4-IB to run it again.

    Alternatively, you can set the Destination to uSD in Workshop4, and then load the 'Update Banks and Run' from the Tools menu, so then each time you want to change the project on the Display, you just swap out the uSD card, you dont need to program the display with the 4D-UPA.

    If you press the Reset button on your Teensy, the Teensy program will restart and it will trigger the reset of both displays via the code in your setup() routine. If only 1 display is resetting, then likely the display that is not resetting is not getting the reset signal from the Teensy, so check your GPIO is set correctly in your code (set to output, etc) and check the wiring, or maybe change to a different GPIO. It worked perfectly fine for me on my Arduino, both reset correctly.

    Hope that helps

    Regards

    Leave a comment:


  • Riptor919
    replied
    Actually I just got it to work haha I had two pins on my Teensy Switched in the wrong direction for the Tx and the Rx for the top display :,) I was so certain of the wiring but yeah it works!! I will be back soon with more questions! thank you again for your help thus far

    Leave a comment:


  • Riptor919
    replied
    So that looks great!! I remember being told that i am not able to use COMM 0 since my computer hogs that space so I switched to using COMM 1 and a 4DUPA and yes i have GPIO1 = PA3 as the TX for the bottom display and GPIO10 = PA4 as the RX for the bottom display which correspond from the 4D UPA Schematic. Although now i am questioning whether or not that is set up properly. Do you think that the top display should be set to COMM1 instead of COMM0? I have the top display just connected through a gen4-IB which is connected straight to my Teensy I program the top display through a gen4-IB 4D programming cable combo while I program the bottom display with the 4d-UPA setup and a USB. Also weird thing: I notice that when I press the reset button on my Teensy that only the top display flashes and not the bottom display. Anyways I will work on this for a while an see if I can get it working like you have on your end. Do you think that i could just use 2 gen4-IB adapters instead of 1 and a 4d-UPA? I feel like that might be messing me up. I just triple checked all the connections though and i don't see anything wrong but even when i change the COMM nothing different occurs on the top display. Also do you think that i don't even really need a top display handler since it is not touch screen?
    Last edited by Riptor919; 23 July 2021, 03:57 AM.

    Leave a comment:


  • James_4DSystems
    replied
    So I have loaded this on to 2 display modules I had on hand, just changed your project to suit them, same resolution so easy change.
    Noticed 1 display is set to use COM1 while the other is set to use COM0. So I assume you have set the COM1 version up to be wired like that to your Teensy ? This is the COM port out of the display, ie the 2 Diablo pins you have set COM1 to be, nothing to do with the Arduino. Just checking.
    I set it to be COM0 for my set up as its easier.
    Both are on 9600 baud as you had it.
    I dont have a Teensy 4.1, so I am just using a old Arduino Mega1280.
    Changed the Serial ports to be 2 and 3, instead of the 4 and 5 you had, as this Arduino only goes up to Serial3.
    I also changed the Reset pins to be 6 and 7, just to suit how I connected them.
    So really no changes over what you had.

    I removed the 2 lines which I mentioned earlier, which print to Strings which don't exist.

    I then ran the demo, and forms are changing correctly.

    Made a very basic video, which you can see here.
    Can you see any problems?

    Leave a comment:


  • Riptor919
    commented on 's reply
    Thank you thank you! this is very helpful

  • James_4DSystems
    replied
    Hello again,

    OK I will set up both displays and the Arduino and try and see what the problem is.

    Regarding the form change.

    Basically, if you get the Arduino to change the form of the display, then the display will not report back using 'Reported Message' on the Form object, when the page changes. This is intentional, as if the Arduino says to go to Form 1, then there is no point the display replying saying 'I am on form 1' as the Arduino would already know that given it told the display to change. Typically you would have a variable called Form or something in your project, so when the Arduino change the display form, you update the Form variable with the form number so you know what form that display is on.
    So if you want the Reported Message of Form1 to work, you would use the Form1Activate from a button directly in WS4 on say Form0. That would then fire off the Reported Message to the Arduino when it changes to Form1, as the Arduino will not have known that happened as the display did the form change, not the Arduino. Because the Arduino is not setting the form (and you updating the Form variable), the only way the Arduino will know the page/form has changed is if you can get the display to tell it, which is where this comes in.

    This really is only relevant though if you are wanting to track what form you are currently on, in your Arduino code. You are not doing this, so really this detail is not important to you at the moment.

    But for completeness, to capture the Reported Message from the Form object, you would do this in the appropriate Handler.

    You have this:
    Code:
    if (Event.reportObject.object == GENIE_OBJ_4DBUTTON)
    in your handler, which filters out when the event is about a 4D Button

    And you have this:
    Code:
    else if (Event.reportObject.object == GENIE_OBJ_KEYBOARD)
    in your handler, to filter out when the event is about the Keyboard

    So you would add another one:
    Code:
    else if (Event.reportObject.object == GENIE_OBJ_FORM)
    in your handler, to filter out when the event is about the Form

    This is untested, but something like this likely would work:
    Code:
    else if (Event.reportObject.object == GENIE_OBJ_FORM)
    {
        if (Event.reportObject.index == 0) // If it's Form 0
        {
            Form = Event.reportObject.index; // Copy the index (ie the Form number) into a variable to use elsewhere in your code
            Serial.print("Form ");
            Serial.println(Event.reportObject.index);
        }
    }
    You would then use the Form variable elsewhere in your code, to only write to things that are on that current form, for example. Can help speed the project up, rather than having led digits and gauges etc be updated by the Arduino all the time, you can change the code to only update when you are on a particular form, ie the form that widget is on.
    In the cases that the Arduino is changing the Form, which is done using your 4DButtons at the moment, you would just update the Form variable there, you would need 1 for each display, to keep track of them.

    I hope that is clear what I am trying to explain.

    I will look at your code now. If I find a problem I will update it, and I will add this Form code in your program too so you can see what I am talking about.

    Leave a comment:


  • Riptor919
    replied
    " you have no code to check if a Form Change happened from the display directly"

    Could you give me a code example/snippet for this i am kind of confused on how to do this. Would i just have an if statement? And you said it can only occur if there is a button on screen which activates a specific form with FormXActivate or is it possible for it to work with report message? This doesn't seem doable if I am trying to change the top display form using buttons and forms of the bottom display. I am confused what is going on as far as when you set a form to report message what happens/ what can you do with that and why is it necessary? also I know you said that the code involved with 4DButton2 looked fine but it actually does not change the top display but the bottom display changes, (although its slower than the form activate method). Side question: is there a part number for the 5pin Female to female connector between the gen4-ib that is labeled with +5v, TX, TX, GND, RES as i can not find it anywhere besides in kits.
    Attached Files
    Last edited by Riptor919; 22 July 2021, 08:06 AM.

    Leave a comment:


  • Riptor919
    replied
    I totally forgot to include the other workshop file I'm sorry I was assuming they zipped together since I had them both open it will make more sense with this file as well. Each display is using a separate workshop file which I upload to an SD card and then place the proper one in each display. let me try working what you said into my code for a bit and get back to you
    Attached Files
    Last edited by Riptor919; 22 July 2021, 04:33 AM.

    Leave a comment:


  • James_4DSystems
    replied
    Hello again

    Just a few things to point out, some are minor but I wanted to mention them anyway.

    Code:
    Serial.begin(9600);  // Serial5 @ 9600 (9.6K) Baud -- starts a serial stream to BotDisplay
    The comment is wrong. This is for the Serial Monitor, nothing to do with the Bot Display, and its not Serial 5 as per the comment. Just to make this more readable.

    Code:
    // Attach the user function Event Handler for processing events to BotDisplay and TopDisplay
    BotDisplay.AttachEventHandler(myGenieEventHandlerBot);
    TopDisplay.AttachEventHandler(myGenieEventHandlerTop);
    The comment really should be
    Code:
    // Attach the user function Event Handler for processing events FROM BotDisplay and TopDisplay
    Events come from the display, which is what the Arduino handler is capturing and then handling. It is not for sending things to the display, it is for capturing things like touched buttons, sliders, etc, from the display.

    Code:
     // Write a string to the BotDisplay to show the version of the library used
    BotDisplay.WriteStr(0, GENIE_VERSION);
    TopDisplay.WriteStr(0, GENIE_VERSION);
    You are writing to String0 on both the Top Display and the Bottom Display, however I can not see any String object at all in your WS4 application. This is a big no-no. You can not write to something which does not exist as it can cause all sorts of problems. These lines need to be removed.

    Code:
     } else if (Event.reportObject.index == 11) { // FUEL TANKS -- TANK 2
    TopDisplay.WriteObject(GENIE_OBJ_FORM, 3, 0);
    
    } else if (Event.reportObject.index == 12) { // FUEL TANKS -- TANKS 3, AUX 1, and AUX 2
    TopDisplay.WriteObject(GENIE_OBJ_FORM, 4, 0);
    
    } else if (Event.reportObject.index == 13) { // FUEL TANKS -- TANKS 4 and 5
    TopDisplay.WriteObject(GENIE_OBJ_FORM, 5, 0);
    
    } else if (Event.reportObject.index == 15) { // FUEL TANKS -- FLOW 1
    TopDisplay.WriteObject(GENIE_OBJ_FORM, 6, 0);
    
    } else if (Event.reportObject.index == 16) { // FUEL TANKS -- FLOW 2
    TopDisplay.WriteObject(GENIE_OBJ_FORM, 7, 0);
    You are writing to Forms which don't exist. In the WS4 code you sent, it has Form0, Form1 and Form2, there is no Form3,4,5,6,7, so this could be causing problems if those buttons are pressed. I assume this is due to this still being developed, but you need to be careful you don't write to things which don't exist in the display.

    Looking at your buttons now.
    On Form0, you have 4DButton0, which has its event set to Reported Message. This looks fine, as you have corresponding code in your Arduino code to check for Button0's event, which resets frequencies or something like that.
    You then have 4DButton1, which is set to Form1Activate, so that will change to Form1 all by itself. That looks fine, you have no code in the Arduino (which wouldnt work anyway as you are not Reporting Message here), so that is fine.
    You have Form0 reporting a message too, but you have no code in your Arduino to check for this. It would only happen if there was a button set to Form0Activate anyway. You currently only capture events for GENIE_OBJ_4DBUTTON and GENIE_OBJ_KEYBOARD, nothing for GENIE_OBJ_FORM yet. Work in progress I assume.

    On Form1, you have 4DButton2, which is Reported Message, and you have Arduino code for it. This then changes both displays Forms. Bottom goes back to Form0 and Top goes to Form1. That should be fine.
    You then have 4DButton3 which does an Form2Activate, which is fine.
    4DButton4 (and 5, 6 and 7) does a Reported Message, but currently no code to handle this in Arduino.
    4DButton8 and 9 do nothing.
    Form1 also Reports a Message itself, but no code to handle this if it was to happen from a Form1Activate button directly.

    On Form2, you have 4DButtons10, 11, 12 and 13, all Reporting Messages, but changing to forms from your arduino code which dont exist in your WS4 application.
    4DButton14 does a Form1Activate, which is fine
    4DButton15 and 16 do the same as 10,11,12,13 above.
    Form2 has Reported Message set also, no code to handle it though.

    So what exactly is not working?
    You are missing lots of forms, so half the buttons wont do anything, and you have no code to check if a Form Change happened from the display directly.

    I haven't looked at the Keyboard stuff, given you have not mentioned that as being a problem.

    I will try and set up some hardware to try and simulate this here, but do both displays use the same Workshop4 application, or are they different?

    Regards

    Leave a comment:

Working...
X