ballaswag / guppyscreen

A native Touch UI for 3D Printers running Klipper/Moonraker.
GNU General Public License v3.0
167 stars 14 forks source link

add power devices menu #75

Open kevdliu opened 1 month ago

kevdliu commented 1 month ago

This PR adds a power devices sub-menu to the printer tuning menu that allows users to turn on/off power devices exposed via moonraker. Examples of power devices include smart plugs that the printer is connected to or external fans etc.

I'm pretty new to LGVL so appreciate any feedback you have. The only thing missing is the icon for the menu button as I'm unsure how to generate an icon for the button. I'm using the graph icon as a placeholder for now.

Capture 2Capture

kevdliu commented 1 month ago

I'm trying to cross compile the binary for my Creality Ender V3 KE (which has the same chipset as K1) but keep running into this error:

/home/kevdliu/mips-gcc720-glibc229/bin/../lib/gcc/mips-linux-gnu/7.2.0/../../../../mips-linux-gnu/bin/ld: skipping incompatible spdlog/build/libspdlog.a when searching for -l:libspdlog.a
/home/kevdliu/mips-gcc720-glibc229/bin/../lib/gcc/mips-linux-gnu/7.2.0/../../../../mips-linux-gnu/bin/ld: skipping incompatible spdlog/build/libspdlog.a when searching for -l:libspdlog.a
/home/kevdliu/mips-gcc720-glibc229/bin/../lib/gcc/mips-linux-gnu/7.2.0/../../../../mips-linux-gnu/bin/ld: cannot find -l:libspdlog.a
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:132: default] Error 1
make[1]: Leaving directory '/home/kevdliu/Downloads/guppyscreen'
make: *** [Makefile:162: build] Error 2

I've downloaded the mips sdk and included it in my path. Building natively for x86 works fine but when I set export CROSS_COMPILE=mips-linux-gnu- it throws the above error

ballaswag commented 1 month ago

Thanks for the PR! See https://github.com/ballaswag/guppyscreen/pull/62/files#diff-76ed074a9305c04054cdebb9e9aad2d818052b07091de1f20cad0bbac34ffb52R105 to get around that spdlog issue.

For icons, I use the lvgl image convert tool to convert svg into c arrays (https://github.com/lvgl/lv_img_conv): ./lv_img_conv.js logo_lvgl.png -f -c CF_TRUE_COLOR_ALPHA

The icon set I'm using are from https://pictogrammers.com/library/mdi/ (I'm out of the zbolt icons since that set is custom). There are also 2 sizes because I didn't bother trying to figure out how to dynamically scale them in lvgl.

The default set is 64x64, and the small screen ones are 46x46.

kevdliu commented 1 month ago

Thanks for the PR! See https://github.com/ballaswag/guppyscreen/pull/62/files#diff-76ed074a9305c04054cdebb9e9aad2d818052b07091de1f20cad0bbac34ffb52R105 to get around that spdlog issue.

For icons, I use the lvgl image convert tool to convert svg into c arrays (https://github.com/lvgl/lv_img_conv): ./lv_img_conv.js logo_lvgl.png -f -c CF_TRUE_COLOR_ALPHA

The icon set I'm using are from https://pictogrammers.com/library/mdi/ (I'm out of the zbolt icons since that set is custom). There are also 2 sizes because I didn't bother trying to figure out how to dynamically scale them in lvgl.

The default set is 64x64, and the small screen ones are 46x46.

Thanks for the spdlog suggestion! It's working now. I've updated the PR with a new icon for the power devices menu. Unsure what to do about ZBolt though.

kevdliu commented 1 month ago

New icon: Screenshot from 2024-04-15 21-57-22