
<p>
<span style="color: windowtext;">
Hello, again. This is Trey.&nbsp;</span>
</p>
<p>
<span style="color: windowtext;">
&nbsp;</span>
</p>
<p>
<span style="color: windowtext;">
Welcome to part 5 in my Cheap Yellow Display (CYD) Project series.&nbsp;If you are still listening to me ramble about this project, thank you.&nbsp;If you wish to catch up on earlier episodes, you can find them on my </span>
<a href="https://www.hackerpublicradio.org/correspondents/0394.html" rel="noopener noreferrer" target="_blank">
HPR profile page</a>
<span style="color: windowtext;">
</span>
<a href="https://www.hackerpublicradio.org/correspondents/0394.html" rel="noopener noreferrer" target="_blank">
https://www.hackerpublicradio.org/correspondents/0394.html</a>
<span style="color: windowtext;">
&nbsp;&nbsp;</span>
</p>
<p>
<span style="color: windowtext;">
&nbsp;</span>
</p>
<p>
<span style="color: windowtext;">
To review, My project is to build a portable morse code "Keyer memory" which can be connected to any of my HF transceiver radios by simply plugging it in to the code key input port.&nbsp;Then I could transmit stored messages by simply touching their specific icon on the touch screen. I also want to be able to program each macro individually from the graphical user interface (GUI).&nbsp;</span>
</p>
<p>
<span style="color: windowtext;">
&nbsp;</span>
</p>
<p>
<span style="color: windowtext; background-color: inherit;">
To do this, I need to learn how to build a GUI. Most of the CYD resources I have been referencing recommend using Squareline Studio for GUI development on the CYD.&nbsp;Sadly, Squareline Studio is not open source. If any of you have experience with a good, open source alternative to Squareline Studio, please record a show to help the rest of us.&nbsp;Squareline does have a free trial and a free single user / single computer license, which I am using for this project.&nbsp;It will run on Windows, Linux, and Mac.</span>
<span style="color: windowtext;">
&nbsp;</span>
</p>
<p>
<span style="color: windowtext;">
&nbsp;</span>
</p>
<p>
<span style="color: windowtext; background-color: inherit;">
After watching several videos about using the CYD with Squareline, I started to outline the functionality I needed.&nbsp;</span>
<span style="color: windowtext;">
&nbsp;</span>
</p>
<p>
<span style="color: windowtext;">
&nbsp;</span>
</p>
<p>
<span style="color: windowtext; background-color: inherit;">
Squareline provides a wide range of pre-configured boards and interfaces to choose from, in addition to widgets and controls which you can drag onto your screens, and it will automatically generate the supporting code in the background.</span>
<span style="color: windowtext;">
&nbsp;</span>
</p>
<p>
<span style="color: windowtext;">
&nbsp;</span>
</p>
<p>
<span style="color: windowtext;">
The initial page needs to have the macro buttons, with labels for the message they will send when pressed.&nbsp;There also needs to be navigation buttons to move from one page to others.&nbsp;Another important page will be the configuration page, where the user can store the contents of each macro and set the speed at which code will be sent. I would like to have a keyboard page where the user can type a custom message and send it.&nbsp;</span>
</p>
<p>
<span style="color: windowtext;">
&nbsp;</span>
</p>
<p>
<span style="color: windowtext; background-color: inherit;">
I made a few GUI sketches on post-it-notes, then I installed Squareline Studio on my Ubuntu laptop to start designing.&nbsp;There is a bit of a learning curve.&nbsp;Even with guide videos, I found the user experience to be... challenging.&nbsp;</span>
<span style="color: windowtext;">
&nbsp;</span>
</p>
<p>
<span style="color: windowtext;">
&nbsp;</span>
</p>
<p>
<span style="color: windowtext; background-color: inherit;">
Their own GUI leaves much to be desired.&nbsp;It was not designed to run on the laptop's screen size/resolution.&nbsp;I had to switch to a much higher resolution monitor and rearrange frames within the app itself in order to see many of the controls.&nbsp;Button size adjustments, alignments, and label text did not work quite as expected.&nbsp;Getting things sized and aligned properly took quite a bit of fiddling.&nbsp;The text displayed on a button is a separate object from the button itself, so I have had to put some thought into object naming so that I can write code which will change button labels dynamically.&nbsp;&nbsp;</span>
<span style="color: windowtext;">
&nbsp;</span>
</p>
<p>
<span style="color: windowtext;">
&nbsp;</span>
</p>
<p>
<span style="color: windowtext; background-color: inherit;">
I am including some screenshots from Squareline for the interface I designed.&nbsp;&nbsp;</span>
<span style="color: windowtext;">
&nbsp;</span>
</p>
<p>
<span style="color: windowtext;">
&nbsp;</span>
</p>
<p>
<a href="hpr4532_image_1.png">
<img src="hpr4532_image_1_tn.png">
</a>
</p>
<p>
<br>
</p>
<p>
<a href="hpr4532_image_2.png">
<img src="hpr4532_image_2_tn.png">
</a>
</p>
<p>
<span style="color: windowtext;">
&nbsp;</span>
</p>
<p>
<span style="color: windowtext; background-color: inherit;">
One great feature is that you can define actions and conditions for objects in your project.&nbsp;For example, there are buttons on the left which will navigate to specific screens. I defined actions within Squareline, such that when the specific navigation button is pressed, it will change the button appearance to look like it has been pressed and will then scroll left or right to a specified screen.&nbsp;Actions were also valuable for the Speed (WPM) slider on the Config screen.&nbsp;When this slider is moved left and right, the GUI will change the actual number for WPM to the right of the slider. </span>
<span style="color: windowtext;">
&nbsp;</span>
</p>
<p>
<span style="color: windowtext;">
&nbsp;</span>
</p>
<p>
<span style="color: windowtext;">
Next, there is a simulator function which can be used to test how well the GUI works.&nbsp;It took some trial and error, but I was able to build and successfully test, navigational actions and the WPM slider.&nbsp;</span>
</p>
<p>
<span style="color: windowtext;">
&nbsp;</span>
</p>
<p>
<span style="color: windowtext;">
As I was working on building the afore mentioned WPM slider, and thinking about the default words per minute of Morse to use, my ADHD interrupted me (As usual).&nbsp;I decided to change the default speed that I use for the Arduino Nano based Morse code practice keyer which I keep on my desk.&nbsp;You can learn more about this keyer in episode 3 of this series. And we will also discuss Morse code speed in a future episode in this series.&nbsp;The original code (As found on&nbsp;</span>
<a href="https://github.com/jmharvey1/ArduinoCPO" rel="noopener noreferrer" target="_blank">
https://github.com/jmharvey1/ArduinoCPO</a>
<span style="color: windowtext;">
&nbsp;)</span>
<span style="color: windowtext; background-color: inherit;">
&nbsp;specified 12 words per minute (WPM) as the default speed, with buttons to increase or decrease this.&nbsp;However, I am practicing at 20 WPM.&nbsp;Every time I turn on the practice set, I need to turn up the speed and guess when I am close to 20.&nbsp;I went ahead and opened&nbsp;the PracticeOscilator project in Arduino IDE and updated the wpm variable to a value of 20.&nbsp;No, you will not see this change reflected in my own GitHub repo because:</span>
<span style="color: windowtext;">
&nbsp;</span>
</p>
<p>
<span style="color: windowtext;">
&nbsp;</span>
</p>
<p>
<span style="color: windowtext;">
A) I wanted to test it locally first&nbsp;</span>
</p>
<p>
<span style="color: windowtext;">
B) 20 WPM may be a little fast for a default&nbsp;</span>
</p>
<p>
<span style="color: windowtext;">
C) I do not use git the way that it is meant to be used, or the way I SHOULD be using it, with pull requests and all.&nbsp;Bad Trey.&nbsp;</span>
</p>
<p>
<span style="color: windowtext;">
D) I was distracted&nbsp;</span>
</p>
<p>
<span style="color: windowtext;">
&nbsp;</span>
</p>
<p>
<span style="color: windowtext; background-color: inherit;">
ANYWAY,&nbsp;the reason I bring this up is that it is the first time I have used the Arduino IDE to program a board with this system since I upgraded from Ubunto&nbsp;20.04 to Ubuntu 22.04.&nbsp;Try as I might, I was not able to get the Arduino Nano's USB port to be recognized in Linux so that I could upload the updated keyer code. I spent several days troubleshooting, using other Arduino devices, different USB ports, and different cables, all to no avail.&nbsp;If anyone has any recommendations, I am open to suggestions.</span>
<span style="color: windowtext;">
&nbsp;</span>
</p>
<p>
<span style="color: windowtext;">
&nbsp;</span>
</p>
<p>
<span style="color: windowtext; background-color: inherit;">
So, I dug out my son's old Windows 10 PC and started again.&nbsp;I had to install the Arduino IDE, load all the necessary libraries, and my code from Github (Which I had to manually change once again, because I don't fully get git).&nbsp;Finally I was able to update the Arduino Nano&nbsp;with its new code, and it works perfectly.</span>
<span style="color: windowtext;">
&nbsp;</span>
</p>
<p>
<span style="color: windowtext;">
&nbsp;</span>
</p>
<p>
<span style="color: windowtext; background-color: inherit;">
But this revealed the same problem for the CYD.&nbsp;I also could not get it to connect over USB to my Ubuntu system. Time to migrate the entire project to Windows.</span>
<span style="color: windowtext;">
&nbsp;</span>
</p>
<p>
<span style="color: windowtext;">
&nbsp;</span>
</p>
<p>
<span style="color: windowtext; background-color: inherit;">
My next step was to install Squareline Studio on Windows.&nbsp;Here, I ran into another snag, as my trial license was only for one system, so I had to uninstall Squareline from Linux before I could activate the license on Windows.&nbsp;Did I mention that I would love to find an open source, free software product to use instead?&nbsp;If you know of one, please ping me or post a comment.</span>
<span style="color: windowtext;">
&nbsp;</span>
</p>
<p>
<span style="color: windowtext;">
&nbsp;</span>
</p>
<p>
<span style="color: windowtext; background-color: inherit;">
I wasted more time trying to get the GUI project I had written on the Linux machine imported into Squareline on Windows, all the while thinking of improvements I could make if I started again from scratch.&nbsp;It would not load, and would not load.&nbsp;</span>
<span style="color: windowtext;">
&nbsp;</span>
</p>
<p>
<span style="color: windowtext;">
&nbsp;</span>
</p>
<p>
<span style="color: windowtext;">
In the end, I started all over again.&nbsp;&nbsp;&nbsp;</span>
</p>
<p>
<span style="color: windowtext;">
&nbsp;</span>
</p>
<p>
<span style="color: windowtext; background-color: inherit;">
After much blood sweat and tears, my GUI code was working again, and this time in Windows.&nbsp;I was able to run it in the simulation mode and move from page to page successfully and also use the WPM slider.&nbsp;&nbsp;I exported the UI from Squareline, and I loaded the code it generated into a new project within Arduino IE.</span>
<span style="color: windowtext;">
&nbsp;</span>
</p>
<p>
<span style="color: windowtext;">
&nbsp;</span>
</p>
<p>
<span style="color: windowtext;">
Now was the moment of truth.&nbsp;I followed instructions found on the Pang YouTube channel video&nbsp;</span>
<a href="https://www.youtube.com/watch?v=aGM6gu9OpbA" rel="noopener noreferrer" target="_blank">
[ESP32 + LVGL] Configuration input device rotary encoder</a>
<span style="color: windowtext;">
&nbsp;(</span>
<a href="https://www.youtube.com/watch?v=aGM6gu9OpbA" rel="noopener noreferrer" target="_blank">
https://www.youtube.com/watch?v=aGM6gu9OpbA</a>
<span style="color: windowtext;">
&nbsp;).&nbsp;&nbsp;I connected the CYD and uploaded the code.&nbsp;SUCCESS!!&nbsp;</span>
</p>
<p>
<span style="color: windowtext;">
&nbsp;</span>
</p>
<p>
<a href="hpr4532_image_3.jpeg">
<img src="hpr4532_image_3_tn.jpeg">
</a>
</p>
<p>
<span style="color: windowtext;">
&nbsp;</span>
</p>
<p>
<span style="color: windowtext;">
You can see my "Send" screen loaded perfectly!&nbsp;Now to try other screens.&nbsp;&nbsp;</span>
</p>
<p>
<span style="color: windowtext;">
&nbsp;</span>
</p>
<p>
<span style="color: windowtext;">
Wait.&nbsp;Drat.&nbsp;It does not seem like my navigation buttons work.&nbsp;Actually, it does not appear that the touch screen is responding at all.&nbsp;&nbsp;&nbsp;</span>
</p>
<p>
<span style="color: windowtext;">
&nbsp;</span>
</p>
<p>
<span style="color: windowtext;">
I spent the next several days trying to figure out what went wrong.&nbsp;I checked and double checked interrupt and configuration settings (Such as those described in another of Pang's videos,&nbsp;</span>
<a href="https://www.youtube.com/watch?v=qmR-mjJVumU" rel="noopener noreferrer" target="_blank">
[CYD + LVGL] Configuration Cheap Yellow Display | Easy Guide</a>
<span style="color: windowtext;">
&nbsp;(</span>
<a href="https://www.youtube.com/watch?v=qmR-mjJVumU" rel="noopener noreferrer" target="_blank">
https://www.youtube.com/watch?v=qmR-mjJVumU</a>
<span style="color: windowtext;">
&nbsp;).&nbsp;Nothing worked.&nbsp;</span>
</p>
<p>
<span style="color: windowtext;">
&nbsp;</span>
</p>
<p>
<span style="color: windowtext;">
I came to realize that I bit off more than I could chew, and I should NOT have started with such an ambitious project.&nbsp;Instead I should have started with a simple equivalence of "Hello World", where I could build and test simple functionality to make sure I knew exactly what I was doing, then expand on it.&nbsp;</span>
</p>
<p>
<span style="color: windowtext;">
&nbsp;</span>
</p>
<p>
<span style="color: windowtext;">
Lessons learned, and a good stopping point for this episode.&nbsp;I am open to your feedback on what you would recommend, what I should do differently, etc.&nbsp;You can post simple feedback as a comment or send me an email using the address in my HPR profile.&nbsp;As usual, if your feedback is more than a sentence or two, you might want to record it as an episode so that other listeners can benefit from it as well.&nbsp;</span>
</p>
<p>
<span style="color: windowtext;">
&nbsp;</span>
</p>
<p>
<span style="color: windowtext;">
Time for an espresso.&nbsp;Maybe I will make it a double.&nbsp;Or even a triple!&nbsp;</span>
</p>


