FTDI Community
General Category => Discussion - Hardware => Topic started by: ConfusedIrishMan on October 27, 2019, 04:08:37 PM
-
Hi,
Using the newhaven 7" ft813 connected to an Arduino.
I am using Ft_Gpu_CoCmd_Text(phost,140,30,31,0,"test");
to display the word test on the screen.
However the screen is part of a bigger project (naturally) and I would like to be able to change the text depending on other conditions.
String x = "test";
Something like Ft_Gpu_CoCmd_Text(phost,140,30,31,0,x);
However this obviously isn't as straightforward as that as the function declaration for Ft_Gpu_CoCmd_Text defines the text parameter as a const.
Is there anyway around this? I can think of a few brute force methods such as look up tables etc but just asking incase I am missing something basic.
Thanks for an help.
-
Hi,
You can use string commands (such as sprintf) to write a string into the string variable x. This will allow you to create the string and then display it rather than have the hard-coded text string.
Best Regards,
FTDI Community
-
Thanks for the prompt reply.
Yes I understand I can place a String variable instead of a hard coded string.
However, The string variable that I place inside the function has to be a constant.
Is there any way around this?
I am updating a String variable from elsewhere and would like to display the new String when the variable changes.
Not sure if I am explaining this very well.
-
Hi,
You can use string commands (such as sprintf) to write a string into the string variable x. This will allow you to create the string and then display it rather than have the hard-coded text string.
Best Regards,
FTDI Community
Got this sorted in the end. Your suggestion worked in a roundabout way. Thanks for the help
-
Hi,
Glad it helped and thanks for letting us know,
Just to add, if you were originally trying to update variables on the screen without re-sending the command list, it is generally necessary to re-send the commands to create each screen update rather than have a change reflected on the screen in real time.
There are a couple of techniques that can help minimise the amount of the display which you re-send in AN_340 below and we also use the technique in several other examples such as section 9 of BRT_AN_014 and our sample apps too.
https://brtchip.com/wp-content/uploads/Support/Documentation/Application_Notes/ICs/EVE/AN_340_FT800_Optimising-screen-updates-with-Macro-and-Append.pdf
https://brtchip.com/wp-content/uploads/Support/Documentation/Application_Notes/ICs/EVE/BRT_AN_014_FT81X_Simple_PIC_Library_Examples.pdf
Best Regards, FTDI Community