Use static constexpr to force compile time initialization

This commit is contained in:
Riku Isokoski 2022-05-19 12:13:36 +03:00 committed by JF
parent 254c85246e
commit c6026aa617

View file

@ -71,9 +71,9 @@ void Counter::Create() {
lv_obj_set_auto_realign(number, true); lv_obj_set_auto_realign(number, true);
lv_label_set_text_static(number, "00"); lv_label_set_text_static(number, "00");
static const uint8_t padding = 5; static constexpr uint8_t padding = 5;
const uint8_t width = lv_obj_get_width(number) + padding * 2; const uint8_t width = lv_obj_get_width(number) + padding * 2;
static const uint8_t btnHeight = 50; static constexpr uint8_t btnHeight = 50;
const uint8_t containerHeight = btnHeight * 2 + lv_obj_get_height(number) + padding * 2; const uint8_t containerHeight = btnHeight * 2 + lv_obj_get_height(number) + padding * 2;
lv_obj_set_size(counterContainer, width, containerHeight); lv_obj_set_size(counterContainer, width, containerHeight);