diff --git a/Makefile b/Makefile index a19760f0..7348b472 100644 --- a/Makefile +++ b/Makefile @@ -37,6 +37,7 @@ icons: -not \( -name mJS -prune \) \ -not \( -name SimpleFTPServer -prune \) \ -not \( -name *splash* -prune \) \ + -not \( -name *weather* -prune \) \ -iname *.png \ -exec $(IMAGE2CODE) {} \; diff --git a/firmware/keira/src/apps/gpiomanager.cpp b/firmware/keira/src/apps/gpiomanager.cpp index a4298fe1..f9aa1add 100644 --- a/firmware/keira/src/apps/gpiomanager.cpp +++ b/firmware/keira/src/apps/gpiomanager.cpp @@ -1,5 +1,8 @@ #include "gpiomanager.h" +#include "icons/input.h" +#include "icons/output.h" + GPIOManagerApp::GPIOManagerApp() : App("GPIOManager") { menu.setTitle("GPIO"); // Set default pin mode @@ -39,8 +42,8 @@ void GPIOManagerApp::run() { readPinData(); for (int i = 0; i < PIN_COUNT; i++) { menu.addItem( - String(pinNo[i]) + (pinM[i] == INPUT ? " <- IN " : " -> OUT "), - 0, + String(pinNo[i]) + (pinM[i] == INPUT ? " <- IN" : " -> OUT"), + pinM[i] == INPUT ? &input : &output, 0, pinData[i] == HIGH ? "HIGH" : "LOW" ); @@ -55,7 +58,7 @@ void GPIOManagerApp::run() { lilka::serial_log("Menu finished"); int16_t curPos = menu.getCursor(); if (curPos == PIN_COUNT) break; - auto button = menu.getButton(); + lilka::Button button = menu.getButton(); if (button == lilka::Button::A) { if (pinM[curPos] == INPUT) { // alert @@ -76,7 +79,7 @@ void GPIOManagerApp::readSpeedCompare() { lilka::serial_log("Reading pins using REG_READ"); uint8_t pinDataRegRead[64]; uint8_t pinDataDigitalRead[64]; - auto time_begin = micros(); + uint64_t time_begin = micros(); uint32_t gpioValue = (REG_READ(GPIO_IN_REG)); uint32_t gpio1Value = (REG_READ(GPIO_IN1_REG)); // lilka::serial_log("Pin data : %s %s", getStrBits(gpioValue).c_str(), getStrBits(gpio1Value).c_str()); @@ -106,4 +109,4 @@ String GPIOManagerApp::getStrBits(uint32_t num) { bitStr += ((num >> i) & 1 ? "1" : "0"); } return bitStr; -} \ No newline at end of file +} diff --git a/firmware/keira/src/apps/gpiomanager.h b/firmware/keira/src/apps/gpiomanager.h index f7ccf809..7445f4c6 100644 --- a/firmware/keira/src/apps/gpiomanager.h +++ b/firmware/keira/src/apps/gpiomanager.h @@ -1,7 +1,7 @@ #pragma once #include "app.h" #define PIN_COUNT 6 -#define GET_BIT(data, bit_no) (data >> bit_no) & 0b1 +#define GET_BIT(data, bit_no) ((data) >> (bit_no)) & 0b1 class GPIOManagerApp : public App { public: diff --git a/firmware/keira/src/apps/icons/app_group.h b/firmware/keira/src/apps/icons/app_group.h index 4bf9e444..ea21ab8c 100644 --- a/firmware/keira/src/apps/icons/app_group.h +++ b/firmware/keira/src/apps/icons/app_group.h @@ -54,218 +54,218 @@ const uint16_t app_group[] = { 0x0000, 0x0000, 0x0000, + 0xf80e, + 0xf80e, + 0xf80e, + 0xf80e, + 0xf80e, + 0xf80e, + 0xf80e, + 0xf80e, + 0xf80e, 0x0000, 0x0000, + 0xffea, + 0xffea, + 0xffea, + 0xffea, + 0xffea, + 0xffea, + 0xffea, + 0xffea, + 0xffea, 0x0000, 0x0000, 0x0000, 0x0000, + 0xf80e, + 0xf80e, + 0xf80e, + 0xf80e, 0x0000, + 0xf80e, + 0xf80e, + 0xf80e, + 0xf80e, 0x0000, 0x0000, + 0xffea, + 0xffea, + 0xffea, + 0xffea, + 0xffea, + 0xffea, + 0xffea, + 0xffea, + 0xffea, 0x0000, 0x0000, 0x0000, 0x0000, + 0xf80e, + 0xf80e, + 0xf80e, 0x0000, 0x0000, 0x0000, + 0xf80e, + 0xf80e, + 0xf80e, 0x0000, 0x0000, + 0xffea, + 0xffea, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xffea, + 0xffea, 0x0000, 0x0000, 0x0000, 0x0000, + 0xf80e, + 0xf80e, + 0xf80e, 0x0000, 0x0000, 0x0000, + 0xf80e, + 0xf80e, + 0xf80e, 0x0000, 0x0000, + 0xffea, + 0xffea, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xffea, + 0xffea, 0x0000, 0x0000, 0x0000, 0x0000, + 0xf80e, + 0xf80e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xf80e, + 0xf80e, 0x0000, 0x0000, - 0x0000, - 0x0000, - 0xa815, - 0xa815, - 0xa815, - 0xa815, - 0xa815, - 0xa815, - 0xa815, - 0x0000, - 0x0000, - 0x57ea, - 0x57ea, - 0x57ea, - 0x57ea, - 0x57ea, - 0x57ea, - 0x57ea, - 0x0000, - 0x0000, - 0x0000, - 0x0000, + 0xffea, + 0xffea, 0x0000, 0x0000, 0x0000, 0x0000, - 0xa815, - 0xa815, - 0xa815, - 0xa815, - 0xa815, - 0xa815, - 0xa815, 0x0000, + 0xffea, + 0xffea, 0x0000, - 0x57ea, - 0x57ea, - 0x57ea, - 0x57ea, - 0x57ea, - 0x57ea, - 0x57ea, 0x0000, 0x0000, 0x0000, + 0xf80e, + 0xf80e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0xa815, - 0xa815, - 0xa815, - 0xa815, - 0xa815, - 0xa815, - 0xa815, + 0xf80e, + 0xf80e, 0x0000, 0x0000, - 0x57ea, - 0x57ea, - 0x57ea, - 0x57ea, - 0x57ea, - 0x57ea, - 0x57ea, + 0xffea, + 0xffea, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xffea, + 0xffea, 0x0000, 0x0000, 0x0000, - 0xa815, - 0xa815, - 0xa815, - 0xa815, - 0xa815, - 0xa815, - 0xa815, 0x0000, + 0xf80e, 0x0000, - 0x57ea, - 0x57ea, - 0x57ea, - 0x57ea, - 0x57ea, - 0x57ea, - 0x57ea, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xf80e, 0x0000, 0x0000, - 0xa815, - 0xa815, - 0xa815, - 0xa815, - 0xa815, - 0xa815, - 0xa815, + 0xffea, + 0xffea, 0x0000, 0x0000, - 0x57ea, - 0x57ea, - 0x57ea, - 0x57ea, - 0x57ea, - 0x57ea, - 0x57ea, 0x0000, 0x0000, 0x0000, + 0xffea, + 0xffea, 0x0000, 0x0000, 0x0000, 0x0000, + 0xf80e, 0x0000, - 0xa815, - 0xa815, - 0xa815, - 0xa815, - 0xa815, - 0xa815, - 0xa815, 0x0000, 0x0000, - 0x57ea, - 0x57ea, - 0x57ea, - 0x57ea, - 0x57ea, - 0x57ea, - 0x57ea, 0x0000, 0x0000, 0x0000, 0x0000, + 0xf80e, 0x0000, 0x0000, + 0xffea, + 0xffea, + 0xffea, + 0xffea, + 0xffea, + 0xffea, + 0xffea, + 0xffea, + 0xffea, 0x0000, 0x0000, - 0xa815, - 0xa815, - 0xa815, - 0xa815, - 0xa815, - 0xa815, - 0xa815, 0x0000, 0x0000, - 0x57ea, - 0x57ea, - 0x57ea, - 0x57ea, - 0x57ea, - 0x57ea, - 0x57ea, + 0xf80e, + 0xf80e, + 0xf80e, + 0xf80e, + 0xf80e, + 0xf80e, + 0xf80e, + 0xf80e, + 0xf80e, 0x0000, 0x0000, + 0xffea, + 0xffea, + 0xffea, + 0xffea, + 0xffea, + 0xffea, + 0xffea, + 0xffea, + 0xffea, 0x0000, 0x0000, 0x0000, @@ -318,6 +318,15 @@ const uint16_t app_group[] = { 0x0000, 0x0000, 0x0000, + 0x57ea, + 0x57ea, + 0x57ea, + 0x57ea, + 0x57ea, + 0x57ea, + 0x57ea, + 0x57ea, + 0x57ea, 0x0000, 0x0000, 0x57ff, @@ -327,88 +336,72 @@ const uint16_t app_group[] = { 0x57ff, 0x57ff, 0x57ff, + 0x57ff, + 0x57ff, 0x0000, 0x0000, - 0xffea, - 0xffea, - 0xffea, - 0xffea, - 0xffea, - 0xffea, - 0xffea, - 0x0000, 0x0000, 0x0000, + 0x57ea, + 0x57ea, + 0x57ea, 0x0000, 0x0000, 0x0000, + 0x57ea, + 0x57ea, + 0x57ea, 0x0000, 0x0000, 0x57ff, 0x57ff, 0x57ff, 0x57ff, + 0x0000, + 0x57ff, 0x57ff, 0x57ff, 0x57ff, 0x0000, 0x0000, - 0xffea, - 0xffea, - 0xffea, - 0xffea, - 0xffea, - 0xffea, - 0xffea, 0x0000, 0x0000, + 0x57ea, + 0x57ea, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x57ea, + 0x57ea, 0x0000, 0x0000, 0x57ff, 0x57ff, 0x57ff, - 0x57ff, + 0x0000, + 0x0000, + 0x0000, 0x57ff, 0x57ff, 0x57ff, 0x0000, 0x0000, - 0xffea, - 0xffea, - 0xffea, - 0xffea, - 0xffea, - 0xffea, - 0xffea, 0x0000, 0x0000, + 0x57ea, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x57ff, - 0x57ff, - 0x57ff, - 0x57ff, - 0x57ff, - 0x57ff, - 0x57ff, 0x0000, + 0x57ea, 0x0000, - 0xffea, - 0xffea, - 0xffea, - 0xffea, - 0xffea, - 0xffea, - 0xffea, 0x0000, + 0x57ff, 0x0000, 0x0000, 0x0000, @@ -417,48 +410,23 @@ const uint16_t app_group[] = { 0x0000, 0x0000, 0x57ff, - 0x57ff, - 0x57ff, - 0x57ff, - 0x57ff, - 0x57ff, - 0x57ff, - 0x0000, - 0x0000, - 0xffea, - 0xffea, - 0xffea, - 0xffea, - 0xffea, - 0xffea, - 0xffea, 0x0000, 0x0000, 0x0000, 0x0000, + 0x57ea, 0x0000, 0x0000, 0x0000, 0x0000, - 0x57ff, - 0x57ff, - 0x57ff, - 0x57ff, - 0x57ff, - 0x57ff, - 0x57ff, 0x0000, 0x0000, - 0xffea, - 0xffea, - 0xffea, - 0xffea, - 0xffea, - 0xffea, - 0xffea, 0x0000, + 0x57ea, 0x0000, 0x0000, + 0x57ff, + 0x57ff, 0x0000, 0x0000, 0x0000, @@ -466,26 +434,11 @@ const uint16_t app_group[] = { 0x0000, 0x57ff, 0x57ff, - 0x57ff, - 0x57ff, - 0x57ff, - 0x57ff, - 0x57ff, - 0x0000, - 0x0000, - 0xffea, - 0xffea, - 0xffea, - 0xffea, - 0xffea, - 0xffea, - 0xffea, - 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x57ea, 0x0000, 0x0000, 0x0000, @@ -493,43 +446,90 @@ const uint16_t app_group[] = { 0x0000, 0x0000, 0x0000, + 0x57ea, 0x0000, 0x0000, + 0x57ff, + 0x57ff, + 0x57ff, 0x0000, 0x0000, 0x0000, + 0x57ff, + 0x57ff, + 0x57ff, 0x0000, 0x0000, 0x0000, 0x0000, + 0x57ea, + 0x57ea, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x57ea, + 0x57ea, 0x0000, 0x0000, + 0x57ff, + 0x57ff, 0x0000, 0x0000, + 0x57ff, 0x0000, 0x0000, + 0x57ff, + 0x57ff, 0x0000, 0x0000, 0x0000, 0x0000, + 0x57ea, + 0x57ea, + 0x57ea, 0x0000, 0x0000, 0x0000, + 0x57ea, + 0x57ea, + 0x57ea, 0x0000, 0x0000, + 0x57ff, + 0x57ff, 0x0000, + 0x57ff, + 0x57ff, + 0x57ff, 0x0000, + 0x57ff, + 0x57ff, 0x0000, 0x0000, 0x0000, 0x0000, + 0x57ea, + 0x57ea, + 0x57ea, + 0x57ea, + 0x57ea, + 0x57ea, + 0x57ea, + 0x57ea, + 0x57ea, 0x0000, 0x0000, + 0x57ff, + 0x57ff, + 0x57ff, + 0x57ff, + 0x57ff, + 0x57ff, + 0x57ff, + 0x57ff, + 0x57ff, 0x0000, 0x0000, 0x0000, diff --git a/firmware/keira/src/apps/icons/app_group.png b/firmware/keira/src/apps/icons/app_group.png index f50f5f9f..b97bbe12 100644 Binary files a/firmware/keira/src/apps/icons/app_group.png and b/firmware/keira/src/apps/icons/app_group.png differ diff --git a/firmware/keira/src/apps/icons/input.h b/firmware/keira/src/apps/icons/input.h new file mode 100644 index 00000000..ffc13a61 --- /dev/null +++ b/firmware/keira/src/apps/icons/input.h @@ -0,0 +1,584 @@ +// This is a generated file, do not edit. +// clang-format off +#include +const uint16_t input_width = 24; +const uint16_t input_height = 24; +const uint16_t input[] = { + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x87f0, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x87f0, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x87f0, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x87f0, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x87f0, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x87f0, + 0x87f0, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x87f0, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x87f0, + 0x87f0, + 0x87f0, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x87f0, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x87f0, + 0x87f0, + 0x87f0, + 0x87f0, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x87f0, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x87f0, + 0x87f0, + 0x87f0, + 0x87f0, + 0x87f0, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x87f0, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x87f0, + 0x87f0, + 0x87f0, + 0x87f0, + 0x87f0, + 0x87f0, + 0x87f0, + 0x87f0, + 0x87f0, + 0x87f0, + 0x87f0, + 0x87f0, + 0x87f0, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x87f0, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x87f0, + 0x87f0, + 0x87f0, + 0x87f0, + 0x87f0, + 0x87f0, + 0x87f0, + 0x87f0, + 0x87f0, + 0x87f0, + 0x87f0, + 0x87f0, + 0x87f0, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x87f0, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x87f0, + 0x87f0, + 0x87f0, + 0x87f0, + 0x87f0, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x87f0, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x87f0, + 0x87f0, + 0x87f0, + 0x87f0, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x87f0, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x87f0, + 0x87f0, + 0x87f0, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x87f0, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x87f0, + 0x87f0, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x87f0, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x87f0, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x87f0, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x87f0, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, +}; +// clang-format on diff --git a/firmware/keira/src/apps/icons/input.png b/firmware/keira/src/apps/icons/input.png new file mode 100644 index 00000000..e48c283c Binary files /dev/null and b/firmware/keira/src/apps/icons/input.png differ diff --git a/firmware/keira/src/apps/icons/output.h b/firmware/keira/src/apps/icons/output.h new file mode 100644 index 00000000..32bee8d0 --- /dev/null +++ b/firmware/keira/src/apps/icons/output.h @@ -0,0 +1,584 @@ +// This is a generated file, do not edit. +// clang-format off +#include +const uint16_t output_width = 24; +const uint16_t output_height = 24; +const uint16_t output[] = { + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0xfc10, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0xfc10, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0xfc10, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0xfc10, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0xfc10, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0xfc10, + 0xfc10, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0xfc10, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0xfc10, + 0xfc10, + 0xfc10, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0xfc10, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0xfc10, + 0xfc10, + 0xfc10, + 0xfc10, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0xfc10, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0xfc10, + 0xfc10, + 0xfc10, + 0xfc10, + 0xfc10, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0xfc10, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0xfc10, + 0xfc10, + 0xfc10, + 0xfc10, + 0xfc10, + 0xfc10, + 0xfc10, + 0xfc10, + 0xfc10, + 0xfc10, + 0xfc10, + 0xfc10, + 0xfc10, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0xfc10, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0xfc10, + 0xfc10, + 0xfc10, + 0xfc10, + 0xfc10, + 0xfc10, + 0xfc10, + 0xfc10, + 0xfc10, + 0xfc10, + 0xfc10, + 0xfc10, + 0xfc10, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0xfc10, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0xfc10, + 0xfc10, + 0xfc10, + 0xfc10, + 0xfc10, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0xfc10, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0xfc10, + 0xfc10, + 0xfc10, + 0xfc10, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0xfc10, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0xfc10, + 0xfc10, + 0xfc10, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0xfc10, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0xfc10, + 0xfc10, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0xfc10, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0xfc10, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0xfc10, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0xfc10, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, +}; +// clang-format on diff --git a/firmware/keira/src/apps/icons/output.png b/firmware/keira/src/apps/icons/output.png new file mode 100644 index 00000000..a3e1e2c1 Binary files /dev/null and b/firmware/keira/src/apps/icons/output.png differ diff --git a/sdk/lib/lilka/src/lilka/menu.cpp b/sdk/lib/lilka/src/lilka/menu.cpp index 8115439b..df134ce7 100644 --- a/sdk/lib/lilka/src/lilka/menu.cpp +++ b/sdk/lib/lilka/src/lilka/menu.cpp @@ -11,8 +11,9 @@ Menu::Menu(String title) { this->scroll = 0; this->setCursor(0); this->done = false; - this->iconImage = new Image(24, 24, colors::Black, 12, 12); - this->iconCanvas = new Canvas(24, 24); + this->iconImage = + new Image(menu_icon_width, menu_icon_height, colors::Black, menu_icon_width / 2, menu_icon_height / 2); + this->iconCanvas = new Canvas(menu_icon_width, menu_icon_height); this->lastCursorMove = millis(); this->button = Button::COUNT; this->activationButtons.push_back(Button::A); @@ -116,6 +117,14 @@ void Menu::draw(Arduino_GFX* canvas) { this->firstRender = millis(); } + constexpr int16_t scrollbarWidth = 8; + constexpr int16_t scrollbarLeftPadding = 4; + constexpr int16_t postfixLeftPadding = 4; + constexpr int16_t iconWidth = 32; + constexpr int16_t titleTextHeight = 40; + constexpr int16_t itemsY = 80; + constexpr int16_t itemHeight = menu_icon_height; + canvas->fillScreen(lilka::colors::Black); int8_t angleShift = sin(millis() / 1000.0) * 16; // Draw triangle in top-left @@ -135,15 +144,17 @@ void Menu::draw(Arduino_GFX* canvas) { const uint16_t titleWidthAvailable = canvas->width() - 64; if (titleWidth > titleWidthAvailable) { // Marquee - Canvas marquee(titleWidthAvailable, 40); + Canvas marquee(titleWidthAvailable, titleTextHeight); marquee.fillScreen(lilka::colors::Black); marquee.setFont(FONT_6x13); marquee.setTextSize(2); - marquee.setCursor(calculateMarqueeShift(millis() - firstRender, titleWidth - titleWidthAvailable, 50), 40); + marquee.setCursor( + calculateMarqueeShift(millis() - firstRender, titleWidth - titleWidthAvailable, 50), titleTextHeight + ); marquee.setTextColor(lilka::colors::White); marquee.println(title); canvas->draw16bitRGBBitmapWithTranColor( - 32, 0, marquee.getFramebuffer(), lilka::colors::Black, titleWidthAvailable, 40 + 32, 0, marquee.getFramebuffer(), lilka::colors::Black, titleWidthAvailable, titleTextHeight ); } else { // Text fits @@ -155,13 +166,19 @@ void Menu::draw(Arduino_GFX* canvas) { canvas->println(title); } - canvas->fillRect(0, (cursor * 24 + 80 - 20) - scroll * 24, canvas->width(), 24, lilka::colors::Orange_red); + canvas->fillRect( + 0, + (cursor * itemHeight + itemsY - 20) - scroll * itemHeight, + canvas->width(), + itemHeight, + lilka::colors::Orange_red + ); uint16_t menu_size = items.size(); for (int i = scroll; i < MIN(scroll + MENU_HEIGHT, menu_size); i++) { int16_t screenI = i - scroll; const menu_icon_t* icon = items[i].icon; - canvas->setTextBound(0, 80 + screenI * 24 - 20, canvas->width(), 24); + canvas->setTextBound(0, itemsY + screenI * itemHeight - 20, canvas->width(), itemHeight); if (icon) { if (cursor == i) { memcpy(iconImage->pixels, *icon, sizeof(menu_icon_t)); @@ -170,11 +187,21 @@ void Menu::draw(Arduino_GFX* canvas) { iconCanvas->fillScreen(lilka::colors::Black); iconCanvas->drawImageTransformed(iconImage, 12, 12, t); canvas->draw16bitRGBBitmapWithTranColor( - 0, 80 + screenI * 24 - 20, iconCanvas->getFramebuffer(), lilka::colors::Black, 24, 24 + 0, + itemsY + screenI * itemHeight - 20, + iconCanvas->getFramebuffer(), + lilka::colors::Black, + menu_icon_width, + menu_icon_height ); } else { canvas->draw16bitRGBBitmapWithTranColor( - 0, 80 + screenI * 24 - 20, const_cast(*icon), lilka::colors::Black, 24, 24 + 0, + itemsY + screenI * itemHeight - 20, + const_cast(*icon), + lilka::colors::Black, + menu_icon_width, + menu_icon_height ); } } @@ -192,12 +219,14 @@ void Menu::draw(Arduino_GFX* canvas) { (void)h; canvas->setTextBound(0, 0, canvas->width(), canvas->height()); canvas->getTextBounds(items[i].postfix, 0, 0, &x1, &y1, &postfixWidth, &h); - canvas->setCursor(canvas->width() - postfixWidth - 8, 80 + screenI * 24); + canvas->setCursor( + canvas->width() - postfixWidth - scrollbarWidth - scrollbarLeftPadding, itemsY + screenI * itemHeight + ); canvas->println(items[i].postfix); } int16_t widthAvailable = - canvas->width() - 32 - postfixWidth - 8 - 8; // 8 pixels for scrollbar, 8 more for padding + canvas->width() - iconWidth - postfixWidth - scrollbarWidth - scrollbarLeftPadding - postfixLeftPadding; if (widthAvailable < 0) { // No space for title continue; @@ -206,21 +235,26 @@ void Menu::draw(Arduino_GFX* canvas) { uint16_t nameWidth = getTextWidth(FONT_10x20, items[i].title.c_str()) + 1; if (nameWidth > widthAvailable && cursor == i) { // Marquee - Canvas marquee(widthAvailable, 24); + Canvas marquee(widthAvailable, itemHeight); marquee.fillScreen(lilka::colors::Black); marquee.setFont(FONT_10x20); marquee.setCursor(calculateMarqueeShift(millis() - lastCursorMove, nameWidth - widthAvailable, 50), 20); marquee.setTextColor(lilka::colors::White); marquee.println(items[i].title); canvas->draw16bitRGBBitmapWithTranColor( - 32, 80 + screenI * 24 - 20, marquee.getFramebuffer(), lilka::colors::Black, widthAvailable, 24 + iconWidth, + itemsY + screenI * itemHeight - 20, + marquee.getFramebuffer(), + lilka::colors::Black, + widthAvailable, + itemHeight ); } else { // Text fits canvas->setTextSize(1); canvas->setFont(FONT_10x20); - canvas->setCursor(32, 80 + screenI * 24); - canvas->setTextBound(32, 80 + screenI * 24 - 20, widthAvailable, 24); + canvas->setCursor(iconWidth, itemsY + screenI * itemHeight); + canvas->setTextBound(iconWidth, itemsY + screenI * itemHeight - 20, widthAvailable, itemHeight); if (items[i].color && cursor != i) { canvas->setTextColor(items[i].color); } else { @@ -232,9 +266,11 @@ void Menu::draw(Arduino_GFX* canvas) { // Draw scrollbar if (menu_size > MENU_HEIGHT) { - int top = 80 - 20; - int height = MENU_HEIGHT * 24; - canvas->fillRect(canvas->width() - 8, top, 8, height, canvas->color565(96, 96, 96)); + int top = itemsY - 20; + int height = MENU_HEIGHT * itemHeight; + canvas->fillRect(canvas->width() - 5, top, 2, height, lilka::colors::White); + canvas->fillRect(canvas->width() - 8, top, 8, 2, lilka::colors::White); + canvas->fillRect(canvas->width() - 8, top + height - 2, 8, 2, lilka::colors::White); int barHeight = height * MENU_HEIGHT / menu_size; int barTop = top + scroll * height / menu_size; canvas->fillRect(canvas->width() - 8, barTop, 8, barHeight, lilka::colors::White); diff --git a/sdk/lib/lilka/src/lilka/ui.h b/sdk/lib/lilka/src/lilka/ui.h index 39c5ef36..a0976c78 100644 --- a/sdk/lib/lilka/src/lilka/ui.h +++ b/sdk/lib/lilka/src/lilka/ui.h @@ -7,7 +7,9 @@ #include "display.h" #include "controller.h" -typedef uint16_t const menu_icon_t[576]; // 24x24px icon +constexpr uint16_t menu_icon_width = 24; +constexpr uint16_t menu_icon_height = 24; +typedef uint16_t const menu_icon_t[menu_icon_width * menu_icon_height]; // 24x24px icon (576*2 bytes) namespace lilka {