For the last two days, I mostly spent time making the code clearer. Some big functions got divided to make them easier to read and to modify once we will get the test PCB.
The second thing was to add semaphores to protect the variable shared between our threads on both the ESP and the STM. I also create a new thread that will be used to display the image or the animation we receive from the ESP. So far it only prints on the console the value of each bytes but having it already created allowed me to add the semaphores on the image so that when we will be trying to display images with the coils we will simply have to deal with the coils.
Finally the main thing I did was to add the deal of the animation on the server. To do so, I created a new thread that will send animations every 20 seconds on an other topic. The ESP will either subscribe to the topic of the animation or the topic of the images depending on what the user choose through a button. I have done a first version of this that works but still need some coding to be done. I will add a post probably tomorrow when it will be finished to explain how it works and to add a log of the execution.