Junior Software Engineer - KE8TIZ
Tyler - 2022-02-16 22:26:26
Views - 58
Hello again! Its been a while, so I figured I would write about a project I did this past winter break; my dashboard!
This dashboard is a single TV with Pi that is showing some basic info about my network and some of the services I run for myself. It really is just a frontend for a bunch of json API endpoints both inside and outside my network.
This guy is all written by yours truly using C++ and SDL2. Its quite fast while running on a Pi3 A. Really the only delays are network delays when it fetches information.
By far the selling point in my opinion is just how easy it is to create your own panels if you know some C++, SDL2, and rapidjson (I know thats alot, but its great for those three people who also know these few libraries). The general gist is you create a class that inherets from the base panel class, then add it to an array in config.cpp, and thats it! From then on it will call a few functions you define (namely update() and draw()) and these will update the internal state of the object and then update an SDL2 texture which is then applied to the renderer.
This system is a great example of the tradeoff between customization and complexity. This system is more complex than an html front end for example, however it is much more customizable. It allows for anything from custom OpenGL shaders to determining exatly how your memory of your graphics are managed.
Speaking of graphics thats another part of this I'm very proud of! I wrote a custom LRU Cache just for this application that calls the constructor of the mapped type with the key as an argument whenever an element is accessed in the cache but it does not exist. This with a few wrapper classes makes a near no cost abstraction for memory management of run time generated string textures displayed on screen! I'm really proud of the performance numbers I got with it.
Here is a the git repo on my server and here is a mirror of it on github. Feel free to try it out and message me with any questions you may have setting it up! This really feels like the first "complete" project I've done in terms of lots of planning, design, and a medium amount of complexity and scale. For this reason, I would like some feedback if you have any!