-
-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flexible configuration #51
Comments
@sle118 Sorry for the late response. I was very busy with selling ESP32 TouchDowns this week ;) But this is amazing! Number 1 on my priorities list was refactoring the code in a way that it would allow for more actions. I know this is a much requested feature. So in answer to your question, i definitely like to see that! There is a branch called development. Which my idea was to try out all these new things. A branch where I don't have to be afraid that a pull request may break things. I invite you to share your code there! |
ok. Noted. I did quite a bit of refactoring to the code so it might take you a bit of time to adjust to the new reality ;) I'm still in the very early stage and I just reached a clean compile with a ton of "//todo: " in the code to implement the features I had to butcher in order to start doing some surface testing. It took me some time to adjust to the Arduino environment; I am used to the more bare bone environment provided by the ESP-IDF. |
If you have anything to share let me know! Looking forward to it :) |
I will start by reaching a minimum level of stability (e.g no crash/boot loop) and some basic navigation before sharing. But here's a glimpse of the FTAction class and how it leverages arrays to reduce code redundancy. Definitions:
and the embryo of the execute method
I have implemented a std::queue which receives actions. For example, pressing a button will result in a new action being inserted in the queue. Then the queue is processed in the loop()
|
So far that is looking great! |
I'm thinking of implementing something similar to AutoHotkey (a reduced set to begin with) to handle sending keypresses: This would be a complementary method to the ones that are currently implemented so backwards compatibility is preserved. |
I missed this issue, seems like we are working on similar problems. I just created PR #52 that makes the menus sizing configurable, not sure how incompatible this change will be with the work you are doing. I didnt touch much of the action logic, so maybe we can use the work you have done there? Or if your code is in a good state we can cancel my PR and go with your work? |
Well, this is annoying; it looks like the Arduino flavor of the esp-idf is stuck in the past and it's missing several of the newer c++ std features. For instance, there's no std::unique_ptr to reduce the memory footprint of vectors, lists, queues, etc. I'll see how I can work around that, given that Arduino has a broader reach with tinkerers. |
Maybe we can keep that PR open and integrate it to what @sle118 is working on? @sle118 That is annoying, off course for a pre-build binary this wouldn't matter. But I like to keep the whole source accessible for everyone to tinker with as you stated. I Appreciate both your work! |
It is a rather complete refactoring of the effort and unlikely to be compatible with existing pull requests. I will most likely push the changes to my own repo (I forked this repo) so everyone can have a look. |
I will try out your fork when you get it pushed to see how it compares to mine, having just gone through all this I am at least pretty familiar with the codebase now :) So maybe I can help out. |
I'm using a TTGO T-Watch for testing and I have basic navigation, pressing/releasing, and latch working albeit still with some glitches with transparency, which I am just starting to analyse in the original code base. Next I'm going to implement the configuration menu, for which actions are already implemented. I have ordered the following, which is going to be easier to debug using JTAG than the watch: I don't need the camera, but it was cheap enough to try out. Once I am satisfied with the results, I'll push the code to my repo. @coryb I don't plan on fine tuning all the display code, but it will be in a sufficiently good enough state for you to step in if you'd like. Down the road, I am seriously thinking of merging the core functionality with the platform I created for a Logitech media (aka squeezebox) music streamer which I developed with friends. You can see for yourself here: This provides a number of features:
As for the UI engine, littlevgl could be an interesting component to consider. Of course this would be a departure from the current full Arduino based approach, with bare but unleashed esp-idf. However, the Arduino platform can still be used (as a component), which means existing Arduino libraries would still work. Anyhow, I'm just dumping some high level ideas here. I don't expect that this project would follow through such a radical change, but nevertheless I'll always keep the code available for anyone to play with. |
As it happens I have also been working on making the menu system more flexible having just received my device in the post yesterday. My own version is very similar to what @coryb has come up with - but as I am not a true C++ dev it's far less neat. I might be interested in helping out on the frontend side of things once you have all settled on a valid codebase to run with. |
This is getting real funny! Since I do not own the hardware, I will leave it to the group to decide which way they want to go. I have limited bandwidth and definitely cannot resolve all the issues that I have introduced with my changes! There are many areas that I wanted to tackle but didn't get to. |
allright. I made good progress tonight and had navigation up and running. I have pushed whatever I have so far here Note: I'm using VSCode with the Arduino extension, rather than the "pure" Arduino IDE. note that this is only addresses PART of the backend and there's still quite a bit of change to be made to de-couple the code from the hardware but it's a good start (as far as I can tell). Please have a look and comment. thank you! |
The diff between your code and master is so far beyond my abilities to understand 😢 :D |
No thank you! :) This is a massive change and it looks great so far! I have to take some time going through it but this weekend I hope to have some time and will try it out (accepting crashes ;) ). But I like where you are going. |
right now it does crash on start because of my last minute change, leveraging PSRAM if present. I'll try to remediate so you have a somewhat better experience. I am not sure if it will compile on the Arduino IDE, but I think it should, given that VSCode calls it in the backend when building.... it's super super slow compared to native ESP-IDF v4.0, which leverages cMake + Ninja to speed up the build. |
Don't read with the old code in mind; read it as if you were trying to understand another piece of code. |
One more note here. I think I have found out the door cause of the crashes. I will have to overwrite the new operator to allocate memory in psram. Can anyone confirm that the original hardware has a wrover or psram chip on board? Edit: well well... I just found that the touch down hardware doesn't have the luxury of psram. So I'm going to have to rewrite portions of the code to setup arrays in the code space instead of dynamically allocated structures as I'm doing right now. I should also receive my new test board, which will allow me to debug with JTAG instead of fishing for bugs using serial output. Thank you for your patience! |
Update: I just pushed some commits which restore basic navigation. It is no longer crashing! Note that I lost border drawing around buttons and latch mode too. This shouldn't be a major thing to resolve. It turns out using std::vector wasn't a good idea since it stores all data in a contiguous memory location. This means every time I was pushing a new element, the system had to reallocate a new block of memory, possibly resulting in memory fragmentation. |
This is going amazing @sle118 ! Can you DM me your contact details? |
@sle118 while building this I get the following error:
I presume I need to have another library or something for this to work? |
@danielhunt I will push some more changes today. Some minor changes were done, but now a "back button" action is possible. Useful for multi level menus! Edit: changes pushed. Let me know if they compile now. |
Got a few warnings (mostly unused variable, so no big deal). But did get an error. Line 284 of FTAction.cpp:
will always evaluate as true. So, just removing the |
Which Arduino environment are you "officially using"? I'll make sure I compile it there first before committing anything. I've been using vscode with the Arduino extension because it is far better than the basic Arduino IDE and because I'm used to it, but I read that the beta Arduino environment is an improvement over the old one |
ok done that got a long file now [I][FreeTouchDeck.ino:155] setup(): Starting system. is the only storage i can find |
Ah! Ok. You have to specify the GPIO for the SD card reader. For the TouchDown, it is Could you remind me which board you are using? |
DOIT ESP32 DEVKIT V1 Board didnt work is there anywhere else i need to define the GPIO the the sd card? |
In UserConfig.h try adding
So it becomes:
Save and reupload the code... |
i just found this already testing |
that why i couldnt find it wasnt in the board section i am using |
The ESP32 DevKitC and TFT combiner board I made uses some slightly different pins. On that board SSDAT3 is on GPIO26. |
got the sd card working now images load abit slow from menu to menu about 2 seconds for all to be loaded 3x4 |
well, I decided to goo full blown on polymorphism for the image handlers, but I have to say this sort of things is easier to do in c# than in c++, especially because my advanced c++ knowledge is rather rusty. So jpg will take a bit of time! |
so i added another menu to my sdcard almost the same as my first one with a few keys changed same icons the only icon changed was the one on the main screen
so i tryed uploading it straght to the eps32 and its fine |
Have a look at the The fact that it works from the internal storage is likely because reading from the SD card takes some additional resources. |
Perhaps this should be called out specifically in the |
i dont use a tft combiner , i also have other thing connected volume sliders on gpio 39,34,35,32,33,25 |
Neat! Did you go and implement AVRCP to get absolute volume controls? How do you keep the sliders levels in sync with the host's volume levels? |
i put another project called deej into ftd send analog data over bluetooth to deej program that hooks into the windows volume thingy carnt remember what its called now |
I just wanted to let everyone know that JPG files are now supported and will be the de-facto format going forward. I did replace all built in icons with JPG files, so you will need to adjust your personal menus. Also, SD card init procedure will now show progress on the TFT screen. I'll push changes when I have done sufficient testing |
I just pushed the changes. JPG is now supported FROM SPIFFS (internal storage). Don't try on SD card yet. SD support needs some attention and I'm not sure if I'm having issues because of a faulty card or because of the code. So for now stay on SPIFFS ;) |
for anyone still following this story, I have just pushed what looks like a somewhat good starting point for SD card support INCLUDING JPG ! Using JPG as opposed to using bmp means there's less data to transfer during drawing of screens, which somewhat compensates for the fact that SD cards in general are slower. I still need to figure out a way to gracefully handle the "unexpected removal" of the card during use, but that'll come! Hoping you all enjoy the added simplicity of editing the configuration straight from the SD card! Comments are welcomed Edit: I spoke too soon. I'm still getting a crash and I'm not sure why. On the regular esp-idf, I would enable core dump to figure out what's wrong, but I doubt this is an option on the Arduino platform. |
I pushed another set of changes today. These are mostly geared towards getting more stability out of the SD card. I did identify one leak and I'm hoping fixing it will have helped a bit. Worst case, there is another memory saving I can do, which is to not initialize the spiffs when SD card is detected |
So for anyone not following on discord, I just pushed some changes
To reduce memory footprint, I also opened a pull request |
And by the way, I'm very close to calling it finish. There's a few renames of variables and methods to do, but overall I'm happy with the current state as I think it has reached a stable enough state. Next I plan on experimenting with the Arduino cli to build for various targets using the GitHub workflows. Being able to pass extra defines on the command line means even the TFT library can be configured without having to mess with include files. I've built something similar on a different repository, except not for Arduino |
#define SDDAT3 25 need to be added to the devkit part =) /* Using the ESP32 DevKit with a screen module */ |
At this point, you might want to fork my repo and submit pull requests. Eventually, I think @DustinWatts would want to merge my code and make it official, so it is well spent efforts ;) |
Well I decided to finally take the plunge with a pull request. I have a couple more renames I'd like to do, but I am fairly certain that the current state of my code reached a state that is stable enough and yet offers very scalable user expansion capabilities with user actions. So there's the beginning of my contribution to this project : #64 Once this gets merge, let's close this issue and continue the discussion on Discord |
Since the changes were merged, I'll go ahead and close this. Anyone interested, I'll be hanging around on Discord |
Amazing work! |
prob a good idea to wait for a easy way to config the menu's, been using urs for a while now and i love it |
This is just a comment. @DustinWatts and the other contributors to this project. Feel free to close it.
I wanted to thank you for taking the time to build this. It was exactly what I was looking for!
I took the time to port the code to the TTGO T-Watch 2020 v1 which I happen to own. This wasn't a huge effort; the watch has the same capacitive touch controller that the project uses. A couple of notable differences are the screen resolution (smaller) as well as the onboard power management chip which needs to be told to power on in order to get the back light to work.
Just for fun, I spent a couple of hours refactoring a bit of the code, especially around how menus/screens are represented and loaded internally. I've done it in a way that would allow any number of menus to be created, each with an arbitrary number of buttons, and an arbitrary number of actions, all the while preserving the JSON format which you are currently using (for the sake of staying compatible with existing installs).
Essentially, there are now a few more classes:
Let me know your thoughts and if this is something which you'd like to see some day.
The text was updated successfully, but these errors were encountered: