Drawing an icon on the M5Paper from an array
-
On the M5Paper how can I draw an icon using a function with drawPixel() from an array of the form;
static const uint8_t SUNRISE64x64[8192] = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff........}; -
There is an M5Paper weather display that uses that very code. Maybe looking at it will help you figure it out. I am just getting started coding, but I compiled that weather project yesterday and remember seeing that code.
https://github.com/Bastelschlumpf/M5PaperWeather/blob/master/weather/Icons.h
-
Yes indeed, that's the very code I'm using at the moment. The problem is the people over at the Arduino Forum insist that the code is "not allowed" and bad C/C++ coding because the icon arrays are uint8_t and the DrawIcon function uses uint16_t. Here is a link to the discussions this issue appears towards the end of the discussion from post 20/38. Also it is very difficult for me to understand eactly how the DrawIcon function works, even though it most certainly does work. I have tried changing the uint16_t references in the function to uint8_t and the arrays to uint16_t but all I get with both changes is a black square instead of an icon.
-
Hello @Steve1
I had success with the following converter settings.
This creates a array size of 8192 - same as the stock icons and displays correctly using the
DrawIcon()
function from the Weather app.// array size is 8192 static const uint16_t IconCloud64x64[] = { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
Note: I had best results converting jpg using above converter. (png did not work for me and always created an all zero array.)
Thanks
Felix