Display and UI implementation (#169)
* Menu app. Lib: add mlib submodule.
* Menu: new startup lib dependency definition
* Menu: hierarchy in menu. Cube: fix heap1/4 inconsistency, stack protection.
* GUI: rendering pipeline initial version.
* GUI: layered widget composing, FURI record. Menu: FURI record, api.
* GUI: input dispatching. Menu: switch to input from GUI.
* GUI, MENU: code style cleanup, fix type conversion warnings.
* GUI, Menu: syntax check.
* Makefile: check and reinit submodules, format.
* Menu: lock on event processing. Makefile: proper submodule initialization.
* Menu: fix stack corruption by queue.
* GUI: refactor.
* Makefile: format rule fix, st-util pid.
* GUI, Menu, FURI: format with clang-format.
* GUI, MENU: locks in critical sections, fix stack corruption, ready signaling.
* Makefile: clang format rule cleanup.
* GUI,MENU: migrate to new API.
* Applications: PRODUCTION_HW variable, skip drivers build on local target.
* refactor production build
* add git to dockerfile
* GUI: uncomment lock block
Co-authored-by: Aleksandr Kutuzov <aku@plooks.com>
2020-10-14 10:21:55 +00:00
|
|
|
#include "gui.h"
|
|
|
|
#include "gui_i.h"
|
|
|
|
|
[FL-140] Core api dynamic records (#296)
* SYSTEM: tickless mode with deep sleep.
* Move FreeRTOS ticks to lptim2
* API: move all sumbodules init routines to one place. Timebase: working lptim2 at tick source.
* API Timebase: lp-timer routines, timer access safe zones prediction and synchronization. FreeRTOS: adjust configuration for tickless mode.
* NFC: support for tickless mode.
* API Timebase: improve tick error handling in IRQ. Apploader: use insomnia mode to run applications.
* BLE: prevent sleep while core2 starting
* HAL: nap while in insomnia mode
* init records work
* try to implement record delete
* tests and flapp
* flapp subsystem
* new core functions to get app stat, simplify core code
* fix thread termination
* add strdup to core
* fix tests
* Refactoring: remove all unusued parts, update API usage, aggreagate API sources and headers, new record storage
* Refactoring: update furi record api usage, cleanup code
* Fix broken merge for freertos apps
* Core, Target: fix compilation warnings
* Drop firmware target local
* HAL Timebase, Power, Clock: semaphore guarded access to clock and power modes, better sleep mode.
* SD-Filesystem: wait for all deps to arrive before adding widget. Core, BLE: disable debug dump to serial.
* delete old app example-ipc
* delete old app fatfs list
* fix strobe app, add input header
* delete old display driver
* comment old app qr-code
* fix sd-card test, add forced widget update
* remove unused new core test
* increase heap to 128k
* comment and assert old core tests
* fix syntax
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-01-20 16:09:26 +00:00
|
|
|
#include <furi.h>
|
Display and UI implementation (#169)
* Menu app. Lib: add mlib submodule.
* Menu: new startup lib dependency definition
* Menu: hierarchy in menu. Cube: fix heap1/4 inconsistency, stack protection.
* GUI: rendering pipeline initial version.
* GUI: layered widget composing, FURI record. Menu: FURI record, api.
* GUI: input dispatching. Menu: switch to input from GUI.
* GUI, MENU: code style cleanup, fix type conversion warnings.
* GUI, Menu: syntax check.
* Makefile: check and reinit submodules, format.
* Menu: lock on event processing. Makefile: proper submodule initialization.
* Menu: fix stack corruption by queue.
* GUI: refactor.
* Makefile: format rule fix, st-util pid.
* GUI, Menu, FURI: format with clang-format.
* GUI, MENU: locks in critical sections, fix stack corruption, ready signaling.
* Makefile: clang format rule cleanup.
* GUI,MENU: migrate to new API.
* Applications: PRODUCTION_HW variable, skip drivers build on local target.
* refactor production build
* add git to dockerfile
* GUI: uncomment lock block
Co-authored-by: Aleksandr Kutuzov <aku@plooks.com>
2020-10-14 10:21:55 +00:00
|
|
|
#include <m-array.h>
|
2020-10-26 17:00:17 +00:00
|
|
|
#include <stdio.h>
|
Display and UI implementation (#169)
* Menu app. Lib: add mlib submodule.
* Menu: new startup lib dependency definition
* Menu: hierarchy in menu. Cube: fix heap1/4 inconsistency, stack protection.
* GUI: rendering pipeline initial version.
* GUI: layered widget composing, FURI record. Menu: FURI record, api.
* GUI: input dispatching. Menu: switch to input from GUI.
* GUI, MENU: code style cleanup, fix type conversion warnings.
* GUI, Menu: syntax check.
* Makefile: check and reinit submodules, format.
* Menu: lock on event processing. Makefile: proper submodule initialization.
* Menu: fix stack corruption by queue.
* GUI: refactor.
* Makefile: format rule fix, st-util pid.
* GUI, Menu, FURI: format with clang-format.
* GUI, MENU: locks in critical sections, fix stack corruption, ready signaling.
* Makefile: clang format rule cleanup.
* GUI,MENU: migrate to new API.
* Applications: PRODUCTION_HW variable, skip drivers build on local target.
* refactor production build
* add git to dockerfile
* GUI: uncomment lock block
Co-authored-by: Aleksandr Kutuzov <aku@plooks.com>
2020-10-14 10:21:55 +00:00
|
|
|
|
|
|
|
#include "gui_event.h"
|
|
|
|
#include "canvas.h"
|
|
|
|
#include "canvas_i.h"
|
2021-01-29 13:52:16 +00:00
|
|
|
#include "view_port.h"
|
|
|
|
#include "view_port_i.h"
|
Display and UI implementation (#169)
* Menu app. Lib: add mlib submodule.
* Menu: new startup lib dependency definition
* Menu: hierarchy in menu. Cube: fix heap1/4 inconsistency, stack protection.
* GUI: rendering pipeline initial version.
* GUI: layered widget composing, FURI record. Menu: FURI record, api.
* GUI: input dispatching. Menu: switch to input from GUI.
* GUI, MENU: code style cleanup, fix type conversion warnings.
* GUI, Menu: syntax check.
* Makefile: check and reinit submodules, format.
* Menu: lock on event processing. Makefile: proper submodule initialization.
* Menu: fix stack corruption by queue.
* GUI: refactor.
* Makefile: format rule fix, st-util pid.
* GUI, Menu, FURI: format with clang-format.
* GUI, MENU: locks in critical sections, fix stack corruption, ready signaling.
* Makefile: clang format rule cleanup.
* GUI,MENU: migrate to new API.
* Applications: PRODUCTION_HW variable, skip drivers build on local target.
* refactor production build
* add git to dockerfile
* GUI: uncomment lock block
Co-authored-by: Aleksandr Kutuzov <aku@plooks.com>
2020-10-14 10:21:55 +00:00
|
|
|
|
2021-01-29 13:52:16 +00:00
|
|
|
ARRAY_DEF(ViewPortArray, ViewPort*, M_PTR_OPLIST);
|
Display and UI implementation (#169)
* Menu app. Lib: add mlib submodule.
* Menu: new startup lib dependency definition
* Menu: hierarchy in menu. Cube: fix heap1/4 inconsistency, stack protection.
* GUI: rendering pipeline initial version.
* GUI: layered widget composing, FURI record. Menu: FURI record, api.
* GUI: input dispatching. Menu: switch to input from GUI.
* GUI, MENU: code style cleanup, fix type conversion warnings.
* GUI, Menu: syntax check.
* Makefile: check and reinit submodules, format.
* Menu: lock on event processing. Makefile: proper submodule initialization.
* Menu: fix stack corruption by queue.
* GUI: refactor.
* Makefile: format rule fix, st-util pid.
* GUI, Menu, FURI: format with clang-format.
* GUI, MENU: locks in critical sections, fix stack corruption, ready signaling.
* Makefile: clang format rule cleanup.
* GUI,MENU: migrate to new API.
* Applications: PRODUCTION_HW variable, skip drivers build on local target.
* refactor production build
* add git to dockerfile
* GUI: uncomment lock block
Co-authored-by: Aleksandr Kutuzov <aku@plooks.com>
2020-10-14 10:21:55 +00:00
|
|
|
|
2020-10-15 15:05:28 +00:00
|
|
|
struct Gui {
|
|
|
|
GuiEvent* event;
|
2020-12-14 10:50:32 +00:00
|
|
|
Canvas* canvas;
|
2021-01-29 13:52:16 +00:00
|
|
|
ViewPortArray_t layers[GuiLayerMAX];
|
2020-10-26 17:00:17 +00:00
|
|
|
osMutexId_t mutex;
|
Display and UI implementation (#169)
* Menu app. Lib: add mlib submodule.
* Menu: new startup lib dependency definition
* Menu: hierarchy in menu. Cube: fix heap1/4 inconsistency, stack protection.
* GUI: rendering pipeline initial version.
* GUI: layered widget composing, FURI record. Menu: FURI record, api.
* GUI: input dispatching. Menu: switch to input from GUI.
* GUI, MENU: code style cleanup, fix type conversion warnings.
* GUI, Menu: syntax check.
* Makefile: check and reinit submodules, format.
* Menu: lock on event processing. Makefile: proper submodule initialization.
* Menu: fix stack corruption by queue.
* GUI: refactor.
* Makefile: format rule fix, st-util pid.
* GUI, Menu, FURI: format with clang-format.
* GUI, MENU: locks in critical sections, fix stack corruption, ready signaling.
* Makefile: clang format rule cleanup.
* GUI,MENU: migrate to new API.
* Applications: PRODUCTION_HW variable, skip drivers build on local target.
* refactor production build
* add git to dockerfile
* GUI: uncomment lock block
Co-authored-by: Aleksandr Kutuzov <aku@plooks.com>
2020-10-14 10:21:55 +00:00
|
|
|
};
|
|
|
|
|
2021-01-29 13:52:16 +00:00
|
|
|
ViewPort* gui_view_port_find_enabled(ViewPortArray_t array) {
|
|
|
|
size_t view_ports_count = ViewPortArray_size(array);
|
|
|
|
for(size_t i = 0; i < view_ports_count; i++) {
|
|
|
|
ViewPort* view_port = *ViewPortArray_get(array, view_ports_count - i - 1);
|
|
|
|
if(view_port_is_enabled(view_port)) {
|
|
|
|
return view_port;
|
Display and UI implementation (#169)
* Menu app. Lib: add mlib submodule.
* Menu: new startup lib dependency definition
* Menu: hierarchy in menu. Cube: fix heap1/4 inconsistency, stack protection.
* GUI: rendering pipeline initial version.
* GUI: layered widget composing, FURI record. Menu: FURI record, api.
* GUI: input dispatching. Menu: switch to input from GUI.
* GUI, MENU: code style cleanup, fix type conversion warnings.
* GUI, Menu: syntax check.
* Makefile: check and reinit submodules, format.
* Menu: lock on event processing. Makefile: proper submodule initialization.
* Menu: fix stack corruption by queue.
* GUI: refactor.
* Makefile: format rule fix, st-util pid.
* GUI, Menu, FURI: format with clang-format.
* GUI, MENU: locks in critical sections, fix stack corruption, ready signaling.
* Makefile: clang format rule cleanup.
* GUI,MENU: migrate to new API.
* Applications: PRODUCTION_HW variable, skip drivers build on local target.
* refactor production build
* add git to dockerfile
* GUI: uncomment lock block
Co-authored-by: Aleksandr Kutuzov <aku@plooks.com>
2020-10-14 10:21:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2020-10-26 17:00:17 +00:00
|
|
|
void gui_update(Gui* gui) {
|
2020-10-29 06:27:17 +00:00
|
|
|
furi_assert(gui);
|
2020-10-26 17:00:17 +00:00
|
|
|
GuiMessage message;
|
|
|
|
message.type = GuiMessageTypeRedraw;
|
|
|
|
gui_event_messsage_send(gui->event, &message);
|
|
|
|
}
|
|
|
|
|
2020-10-15 15:05:28 +00:00
|
|
|
bool gui_redraw_fs(Gui* gui) {
|
2020-12-14 10:50:32 +00:00
|
|
|
canvas_frame_set(gui->canvas, 0, 0, GUI_DISPLAY_WIDTH, GUI_DISPLAY_HEIGHT);
|
2021-01-29 13:52:16 +00:00
|
|
|
ViewPort* view_port = gui_view_port_find_enabled(gui->layers[GuiLayerFullscreen]);
|
|
|
|
if(view_port) {
|
|
|
|
view_port_draw(view_port, gui->canvas);
|
Display and UI implementation (#169)
* Menu app. Lib: add mlib submodule.
* Menu: new startup lib dependency definition
* Menu: hierarchy in menu. Cube: fix heap1/4 inconsistency, stack protection.
* GUI: rendering pipeline initial version.
* GUI: layered widget composing, FURI record. Menu: FURI record, api.
* GUI: input dispatching. Menu: switch to input from GUI.
* GUI, MENU: code style cleanup, fix type conversion warnings.
* GUI, Menu: syntax check.
* Makefile: check and reinit submodules, format.
* Menu: lock on event processing. Makefile: proper submodule initialization.
* Menu: fix stack corruption by queue.
* GUI: refactor.
* Makefile: format rule fix, st-util pid.
* GUI, Menu, FURI: format with clang-format.
* GUI, MENU: locks in critical sections, fix stack corruption, ready signaling.
* Makefile: clang format rule cleanup.
* GUI,MENU: migrate to new API.
* Applications: PRODUCTION_HW variable, skip drivers build on local target.
* refactor production build
* add git to dockerfile
* GUI: uncomment lock block
Co-authored-by: Aleksandr Kutuzov <aku@plooks.com>
2020-10-14 10:21:55 +00:00
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-29 07:11:16 +00:00
|
|
|
void gui_redraw_status_bar(Gui* gui) {
|
2021-01-29 13:52:16 +00:00
|
|
|
ViewPortArray_it_t it;
|
2020-10-29 07:11:16 +00:00
|
|
|
uint8_t x;
|
|
|
|
uint8_t x_used = 0;
|
|
|
|
uint8_t width;
|
2021-01-29 13:52:16 +00:00
|
|
|
ViewPort* view_port;
|
2020-10-29 07:11:16 +00:00
|
|
|
// Right side
|
|
|
|
x = 128;
|
2021-01-29 13:52:16 +00:00
|
|
|
ViewPortArray_it(it, gui->layers[GuiLayerStatusBarRight]);
|
|
|
|
while(!ViewPortArray_end_p(it) && x_used < GUI_STATUS_BAR_WIDTH) {
|
|
|
|
// Render view_port;
|
|
|
|
view_port = *ViewPortArray_ref(it);
|
|
|
|
if(view_port_is_enabled(view_port)) {
|
|
|
|
width = view_port_get_width(view_port);
|
2020-10-29 07:11:16 +00:00
|
|
|
if(!width) width = 8;
|
|
|
|
x_used += width;
|
2020-12-14 10:50:32 +00:00
|
|
|
x -= (width + 2);
|
|
|
|
canvas_frame_set(gui->canvas, x, GUI_STATUS_BAR_Y, width, GUI_STATUS_BAR_HEIGHT);
|
2021-01-29 13:52:16 +00:00
|
|
|
view_port_draw(view_port, gui->canvas);
|
2020-10-29 07:11:16 +00:00
|
|
|
}
|
2021-01-29 13:52:16 +00:00
|
|
|
ViewPortArray_next(it);
|
2020-10-29 07:11:16 +00:00
|
|
|
}
|
|
|
|
// Left side
|
|
|
|
x = 0;
|
2021-01-29 13:52:16 +00:00
|
|
|
ViewPortArray_it(it, gui->layers[GuiLayerStatusBarLeft]);
|
|
|
|
while(!ViewPortArray_end_p(it) && x_used < GUI_STATUS_BAR_WIDTH) {
|
|
|
|
// Render view_port;
|
|
|
|
view_port = *ViewPortArray_ref(it);
|
|
|
|
if(view_port_is_enabled(view_port)) {
|
|
|
|
width = view_port_get_width(view_port);
|
2020-10-29 07:11:16 +00:00
|
|
|
if(!width) width = 8;
|
|
|
|
x_used += width;
|
2020-12-14 10:50:32 +00:00
|
|
|
canvas_frame_set(gui->canvas, x, GUI_STATUS_BAR_Y, width, GUI_STATUS_BAR_HEIGHT);
|
2021-01-29 13:52:16 +00:00
|
|
|
view_port_draw(view_port, gui->canvas);
|
2020-12-14 10:50:32 +00:00
|
|
|
x += (width + 2);
|
2020-10-29 07:11:16 +00:00
|
|
|
}
|
2021-01-29 13:52:16 +00:00
|
|
|
ViewPortArray_next(it);
|
2020-10-26 17:00:17 +00:00
|
|
|
}
|
Display and UI implementation (#169)
* Menu app. Lib: add mlib submodule.
* Menu: new startup lib dependency definition
* Menu: hierarchy in menu. Cube: fix heap1/4 inconsistency, stack protection.
* GUI: rendering pipeline initial version.
* GUI: layered widget composing, FURI record. Menu: FURI record, api.
* GUI: input dispatching. Menu: switch to input from GUI.
* GUI, MENU: code style cleanup, fix type conversion warnings.
* GUI, Menu: syntax check.
* Makefile: check and reinit submodules, format.
* Menu: lock on event processing. Makefile: proper submodule initialization.
* Menu: fix stack corruption by queue.
* GUI: refactor.
* Makefile: format rule fix, st-util pid.
* GUI, Menu, FURI: format with clang-format.
* GUI, MENU: locks in critical sections, fix stack corruption, ready signaling.
* Makefile: clang format rule cleanup.
* GUI,MENU: migrate to new API.
* Applications: PRODUCTION_HW variable, skip drivers build on local target.
* refactor production build
* add git to dockerfile
* GUI: uncomment lock block
Co-authored-by: Aleksandr Kutuzov <aku@plooks.com>
2020-10-14 10:21:55 +00:00
|
|
|
}
|
|
|
|
|
2020-10-26 17:00:17 +00:00
|
|
|
bool gui_redraw_normal(Gui* gui) {
|
2020-12-14 10:50:32 +00:00
|
|
|
canvas_frame_set(gui->canvas, GUI_MAIN_X, GUI_MAIN_Y, GUI_MAIN_WIDTH, GUI_MAIN_HEIGHT);
|
2021-01-29 13:52:16 +00:00
|
|
|
ViewPort* view_port = gui_view_port_find_enabled(gui->layers[GuiLayerMain]);
|
|
|
|
if(view_port) {
|
|
|
|
view_port_draw(view_port, gui->canvas);
|
2020-10-26 17:00:17 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
Display and UI implementation (#169)
* Menu app. Lib: add mlib submodule.
* Menu: new startup lib dependency definition
* Menu: hierarchy in menu. Cube: fix heap1/4 inconsistency, stack protection.
* GUI: rendering pipeline initial version.
* GUI: layered widget composing, FURI record. Menu: FURI record, api.
* GUI: input dispatching. Menu: switch to input from GUI.
* GUI, MENU: code style cleanup, fix type conversion warnings.
* GUI, Menu: syntax check.
* Makefile: check and reinit submodules, format.
* Menu: lock on event processing. Makefile: proper submodule initialization.
* Menu: fix stack corruption by queue.
* GUI: refactor.
* Makefile: format rule fix, st-util pid.
* GUI, Menu, FURI: format with clang-format.
* GUI, MENU: locks in critical sections, fix stack corruption, ready signaling.
* Makefile: clang format rule cleanup.
* GUI,MENU: migrate to new API.
* Applications: PRODUCTION_HW variable, skip drivers build on local target.
* refactor production build
* add git to dockerfile
* GUI: uncomment lock block
Co-authored-by: Aleksandr Kutuzov <aku@plooks.com>
2020-10-14 10:21:55 +00:00
|
|
|
}
|
|
|
|
|
2020-10-26 17:00:17 +00:00
|
|
|
bool gui_redraw_none(Gui* gui) {
|
2020-12-14 10:50:32 +00:00
|
|
|
canvas_frame_set(gui->canvas, GUI_MAIN_X, GUI_MAIN_Y, GUI_MAIN_WIDTH, GUI_MAIN_HEIGHT);
|
2021-01-29 13:52:16 +00:00
|
|
|
ViewPort* view_port = gui_view_port_find_enabled(gui->layers[GuiLayerNone]);
|
|
|
|
if(view_port) {
|
|
|
|
view_port_draw(view_port, gui->canvas);
|
2020-10-26 17:00:17 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
Display and UI implementation (#169)
* Menu app. Lib: add mlib submodule.
* Menu: new startup lib dependency definition
* Menu: hierarchy in menu. Cube: fix heap1/4 inconsistency, stack protection.
* GUI: rendering pipeline initial version.
* GUI: layered widget composing, FURI record. Menu: FURI record, api.
* GUI: input dispatching. Menu: switch to input from GUI.
* GUI, MENU: code style cleanup, fix type conversion warnings.
* GUI, Menu: syntax check.
* Makefile: check and reinit submodules, format.
* Menu: lock on event processing. Makefile: proper submodule initialization.
* Menu: fix stack corruption by queue.
* GUI: refactor.
* Makefile: format rule fix, st-util pid.
* GUI, Menu, FURI: format with clang-format.
* GUI, MENU: locks in critical sections, fix stack corruption, ready signaling.
* Makefile: clang format rule cleanup.
* GUI,MENU: migrate to new API.
* Applications: PRODUCTION_HW variable, skip drivers build on local target.
* refactor production build
* add git to dockerfile
* GUI: uncomment lock block
Co-authored-by: Aleksandr Kutuzov <aku@plooks.com>
2020-10-14 10:21:55 +00:00
|
|
|
}
|
|
|
|
|
2020-10-15 15:05:28 +00:00
|
|
|
void gui_redraw(Gui* gui) {
|
2020-10-29 06:27:17 +00:00
|
|
|
furi_assert(gui);
|
2020-10-26 17:00:17 +00:00
|
|
|
gui_lock(gui);
|
Display and UI implementation (#169)
* Menu app. Lib: add mlib submodule.
* Menu: new startup lib dependency definition
* Menu: hierarchy in menu. Cube: fix heap1/4 inconsistency, stack protection.
* GUI: rendering pipeline initial version.
* GUI: layered widget composing, FURI record. Menu: FURI record, api.
* GUI: input dispatching. Menu: switch to input from GUI.
* GUI, MENU: code style cleanup, fix type conversion warnings.
* GUI, Menu: syntax check.
* Makefile: check and reinit submodules, format.
* Menu: lock on event processing. Makefile: proper submodule initialization.
* Menu: fix stack corruption by queue.
* GUI: refactor.
* Makefile: format rule fix, st-util pid.
* GUI, Menu, FURI: format with clang-format.
* GUI, MENU: locks in critical sections, fix stack corruption, ready signaling.
* Makefile: clang format rule cleanup.
* GUI,MENU: migrate to new API.
* Applications: PRODUCTION_HW variable, skip drivers build on local target.
* refactor production build
* add git to dockerfile
* GUI: uncomment lock block
Co-authored-by: Aleksandr Kutuzov <aku@plooks.com>
2020-10-14 10:21:55 +00:00
|
|
|
|
2020-12-14 10:50:32 +00:00
|
|
|
canvas_reset(gui->canvas);
|
2020-10-29 07:11:16 +00:00
|
|
|
|
Display and UI implementation (#169)
* Menu app. Lib: add mlib submodule.
* Menu: new startup lib dependency definition
* Menu: hierarchy in menu. Cube: fix heap1/4 inconsistency, stack protection.
* GUI: rendering pipeline initial version.
* GUI: layered widget composing, FURI record. Menu: FURI record, api.
* GUI: input dispatching. Menu: switch to input from GUI.
* GUI, MENU: code style cleanup, fix type conversion warnings.
* GUI, Menu: syntax check.
* Makefile: check and reinit submodules, format.
* Menu: lock on event processing. Makefile: proper submodule initialization.
* Menu: fix stack corruption by queue.
* GUI: refactor.
* Makefile: format rule fix, st-util pid.
* GUI, Menu, FURI: format with clang-format.
* GUI, MENU: locks in critical sections, fix stack corruption, ready signaling.
* Makefile: clang format rule cleanup.
* GUI,MENU: migrate to new API.
* Applications: PRODUCTION_HW variable, skip drivers build on local target.
* refactor production build
* add git to dockerfile
* GUI: uncomment lock block
Co-authored-by: Aleksandr Kutuzov <aku@plooks.com>
2020-10-14 10:21:55 +00:00
|
|
|
if(!gui_redraw_fs(gui)) {
|
2020-10-26 17:00:17 +00:00
|
|
|
if(!gui_redraw_normal(gui)) {
|
|
|
|
gui_redraw_none(gui);
|
|
|
|
}
|
Display and UI implementation (#169)
* Menu app. Lib: add mlib submodule.
* Menu: new startup lib dependency definition
* Menu: hierarchy in menu. Cube: fix heap1/4 inconsistency, stack protection.
* GUI: rendering pipeline initial version.
* GUI: layered widget composing, FURI record. Menu: FURI record, api.
* GUI: input dispatching. Menu: switch to input from GUI.
* GUI, MENU: code style cleanup, fix type conversion warnings.
* GUI, Menu: syntax check.
* Makefile: check and reinit submodules, format.
* Menu: lock on event processing. Makefile: proper submodule initialization.
* Menu: fix stack corruption by queue.
* GUI: refactor.
* Makefile: format rule fix, st-util pid.
* GUI, Menu, FURI: format with clang-format.
* GUI, MENU: locks in critical sections, fix stack corruption, ready signaling.
* Makefile: clang format rule cleanup.
* GUI,MENU: migrate to new API.
* Applications: PRODUCTION_HW variable, skip drivers build on local target.
* refactor production build
* add git to dockerfile
* GUI: uncomment lock block
Co-authored-by: Aleksandr Kutuzov <aku@plooks.com>
2020-10-14 10:21:55 +00:00
|
|
|
gui_redraw_status_bar(gui);
|
|
|
|
}
|
|
|
|
|
2020-12-14 10:50:32 +00:00
|
|
|
canvas_commit(gui->canvas);
|
2020-10-26 17:00:17 +00:00
|
|
|
gui_unlock(gui);
|
Display and UI implementation (#169)
* Menu app. Lib: add mlib submodule.
* Menu: new startup lib dependency definition
* Menu: hierarchy in menu. Cube: fix heap1/4 inconsistency, stack protection.
* GUI: rendering pipeline initial version.
* GUI: layered widget composing, FURI record. Menu: FURI record, api.
* GUI: input dispatching. Menu: switch to input from GUI.
* GUI, MENU: code style cleanup, fix type conversion warnings.
* GUI, Menu: syntax check.
* Makefile: check and reinit submodules, format.
* Menu: lock on event processing. Makefile: proper submodule initialization.
* Menu: fix stack corruption by queue.
* GUI: refactor.
* Makefile: format rule fix, st-util pid.
* GUI, Menu, FURI: format with clang-format.
* GUI, MENU: locks in critical sections, fix stack corruption, ready signaling.
* Makefile: clang format rule cleanup.
* GUI,MENU: migrate to new API.
* Applications: PRODUCTION_HW variable, skip drivers build on local target.
* refactor production build
* add git to dockerfile
* GUI: uncomment lock block
Co-authored-by: Aleksandr Kutuzov <aku@plooks.com>
2020-10-14 10:21:55 +00:00
|
|
|
}
|
|
|
|
|
2020-10-15 15:05:28 +00:00
|
|
|
void gui_input(Gui* gui, InputEvent* input_event) {
|
2020-10-29 06:27:17 +00:00
|
|
|
furi_assert(gui);
|
|
|
|
furi_assert(input_event);
|
|
|
|
|
2020-10-26 17:00:17 +00:00
|
|
|
gui_lock(gui);
|
Display and UI implementation (#169)
* Menu app. Lib: add mlib submodule.
* Menu: new startup lib dependency definition
* Menu: hierarchy in menu. Cube: fix heap1/4 inconsistency, stack protection.
* GUI: rendering pipeline initial version.
* GUI: layered widget composing, FURI record. Menu: FURI record, api.
* GUI: input dispatching. Menu: switch to input from GUI.
* GUI, MENU: code style cleanup, fix type conversion warnings.
* GUI, Menu: syntax check.
* Makefile: check and reinit submodules, format.
* Menu: lock on event processing. Makefile: proper submodule initialization.
* Menu: fix stack corruption by queue.
* GUI: refactor.
* Makefile: format rule fix, st-util pid.
* GUI, Menu, FURI: format with clang-format.
* GUI, MENU: locks in critical sections, fix stack corruption, ready signaling.
* Makefile: clang format rule cleanup.
* GUI,MENU: migrate to new API.
* Applications: PRODUCTION_HW variable, skip drivers build on local target.
* refactor production build
* add git to dockerfile
* GUI: uncomment lock block
Co-authored-by: Aleksandr Kutuzov <aku@plooks.com>
2020-10-14 10:21:55 +00:00
|
|
|
|
2021-01-29 13:52:16 +00:00
|
|
|
ViewPort* view_port = gui_view_port_find_enabled(gui->layers[GuiLayerFullscreen]);
|
|
|
|
if(!view_port) view_port = gui_view_port_find_enabled(gui->layers[GuiLayerMain]);
|
|
|
|
if(!view_port) view_port = gui_view_port_find_enabled(gui->layers[GuiLayerNone]);
|
Display and UI implementation (#169)
* Menu app. Lib: add mlib submodule.
* Menu: new startup lib dependency definition
* Menu: hierarchy in menu. Cube: fix heap1/4 inconsistency, stack protection.
* GUI: rendering pipeline initial version.
* GUI: layered widget composing, FURI record. Menu: FURI record, api.
* GUI: input dispatching. Menu: switch to input from GUI.
* GUI, MENU: code style cleanup, fix type conversion warnings.
* GUI, Menu: syntax check.
* Makefile: check and reinit submodules, format.
* Menu: lock on event processing. Makefile: proper submodule initialization.
* Menu: fix stack corruption by queue.
* GUI: refactor.
* Makefile: format rule fix, st-util pid.
* GUI, Menu, FURI: format with clang-format.
* GUI, MENU: locks in critical sections, fix stack corruption, ready signaling.
* Makefile: clang format rule cleanup.
* GUI,MENU: migrate to new API.
* Applications: PRODUCTION_HW variable, skip drivers build on local target.
* refactor production build
* add git to dockerfile
* GUI: uncomment lock block
Co-authored-by: Aleksandr Kutuzov <aku@plooks.com>
2020-10-14 10:21:55 +00:00
|
|
|
|
2021-01-29 13:52:16 +00:00
|
|
|
if(view_port) {
|
|
|
|
view_port_input(view_port, input_event);
|
Display and UI implementation (#169)
* Menu app. Lib: add mlib submodule.
* Menu: new startup lib dependency definition
* Menu: hierarchy in menu. Cube: fix heap1/4 inconsistency, stack protection.
* GUI: rendering pipeline initial version.
* GUI: layered widget composing, FURI record. Menu: FURI record, api.
* GUI: input dispatching. Menu: switch to input from GUI.
* GUI, MENU: code style cleanup, fix type conversion warnings.
* GUI, Menu: syntax check.
* Makefile: check and reinit submodules, format.
* Menu: lock on event processing. Makefile: proper submodule initialization.
* Menu: fix stack corruption by queue.
* GUI: refactor.
* Makefile: format rule fix, st-util pid.
* GUI, Menu, FURI: format with clang-format.
* GUI, MENU: locks in critical sections, fix stack corruption, ready signaling.
* Makefile: clang format rule cleanup.
* GUI,MENU: migrate to new API.
* Applications: PRODUCTION_HW variable, skip drivers build on local target.
* refactor production build
* add git to dockerfile
* GUI: uncomment lock block
Co-authored-by: Aleksandr Kutuzov <aku@plooks.com>
2020-10-14 10:21:55 +00:00
|
|
|
}
|
2020-10-26 17:00:17 +00:00
|
|
|
|
|
|
|
gui_unlock(gui);
|
Display and UI implementation (#169)
* Menu app. Lib: add mlib submodule.
* Menu: new startup lib dependency definition
* Menu: hierarchy in menu. Cube: fix heap1/4 inconsistency, stack protection.
* GUI: rendering pipeline initial version.
* GUI: layered widget composing, FURI record. Menu: FURI record, api.
* GUI: input dispatching. Menu: switch to input from GUI.
* GUI, MENU: code style cleanup, fix type conversion warnings.
* GUI, Menu: syntax check.
* Makefile: check and reinit submodules, format.
* Menu: lock on event processing. Makefile: proper submodule initialization.
* Menu: fix stack corruption by queue.
* GUI: refactor.
* Makefile: format rule fix, st-util pid.
* GUI, Menu, FURI: format with clang-format.
* GUI, MENU: locks in critical sections, fix stack corruption, ready signaling.
* Makefile: clang format rule cleanup.
* GUI,MENU: migrate to new API.
* Applications: PRODUCTION_HW variable, skip drivers build on local target.
* refactor production build
* add git to dockerfile
* GUI: uncomment lock block
Co-authored-by: Aleksandr Kutuzov <aku@plooks.com>
2020-10-14 10:21:55 +00:00
|
|
|
}
|
|
|
|
|
2020-10-26 17:00:17 +00:00
|
|
|
void gui_lock(Gui* gui) {
|
2020-10-29 06:27:17 +00:00
|
|
|
furi_assert(gui);
|
|
|
|
furi_check(osMutexAcquire(gui->mutex, osWaitForever) == osOK);
|
2020-10-26 17:00:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void gui_unlock(Gui* gui) {
|
2020-10-29 06:27:17 +00:00
|
|
|
furi_assert(gui);
|
|
|
|
furi_check(osMutexRelease(gui->mutex) == osOK);
|
2020-10-26 17:00:17 +00:00
|
|
|
}
|
|
|
|
|
2021-01-29 13:52:16 +00:00
|
|
|
void gui_add_view_port(Gui* gui, ViewPort* view_port, GuiLayer layer) {
|
2020-12-14 10:50:32 +00:00
|
|
|
furi_assert(gui);
|
2021-01-29 13:52:16 +00:00
|
|
|
furi_assert(view_port);
|
2020-10-29 06:27:17 +00:00
|
|
|
furi_check(layer < GuiLayerMAX);
|
2020-10-26 17:00:17 +00:00
|
|
|
|
|
|
|
gui_lock(gui);
|
2021-01-29 13:52:16 +00:00
|
|
|
ViewPortArray_push_back(gui->layers[layer], view_port);
|
|
|
|
view_port_gui_set(view_port, gui);
|
2020-10-26 17:00:17 +00:00
|
|
|
gui_unlock(gui);
|
|
|
|
gui_update(gui);
|
|
|
|
}
|
|
|
|
|
2021-01-29 13:52:16 +00:00
|
|
|
void gui_remove_view_port(Gui* gui, ViewPort* view_port) {
|
2020-12-14 10:50:32 +00:00
|
|
|
furi_assert(gui);
|
2021-01-29 13:52:16 +00:00
|
|
|
furi_assert(view_port);
|
2020-10-26 17:00:17 +00:00
|
|
|
|
|
|
|
gui_lock(gui);
|
|
|
|
|
2021-01-29 13:52:16 +00:00
|
|
|
view_port_gui_set(view_port, NULL);
|
|
|
|
ViewPortArray_it_t it;
|
2020-10-26 17:00:17 +00:00
|
|
|
for(size_t i = 0; i < GuiLayerMAX; i++) {
|
2021-01-29 13:52:16 +00:00
|
|
|
ViewPortArray_it(it, gui->layers[i]);
|
|
|
|
while(!ViewPortArray_end_p(it)) {
|
|
|
|
if(*ViewPortArray_ref(it) == view_port) {
|
|
|
|
ViewPortArray_remove(gui->layers[i], it);
|
2020-10-26 17:00:17 +00:00
|
|
|
}
|
2021-01-29 13:52:16 +00:00
|
|
|
ViewPortArray_next(it);
|
2020-10-26 17:00:17 +00:00
|
|
|
}
|
|
|
|
}
|
2020-10-16 15:25:06 +00:00
|
|
|
|
2020-10-26 17:00:17 +00:00
|
|
|
gui_unlock(gui);
|
|
|
|
}
|
2020-10-15 08:32:48 +00:00
|
|
|
|
2020-10-26 17:00:17 +00:00
|
|
|
Gui* gui_alloc() {
|
|
|
|
Gui* gui = furi_alloc(sizeof(Gui));
|
|
|
|
// Allocate mutex
|
|
|
|
gui->mutex = osMutexNew(NULL);
|
2020-10-29 06:27:17 +00:00
|
|
|
furi_check(gui->mutex);
|
Display and UI implementation (#169)
* Menu app. Lib: add mlib submodule.
* Menu: new startup lib dependency definition
* Menu: hierarchy in menu. Cube: fix heap1/4 inconsistency, stack protection.
* GUI: rendering pipeline initial version.
* GUI: layered widget composing, FURI record. Menu: FURI record, api.
* GUI: input dispatching. Menu: switch to input from GUI.
* GUI, MENU: code style cleanup, fix type conversion warnings.
* GUI, Menu: syntax check.
* Makefile: check and reinit submodules, format.
* Menu: lock on event processing. Makefile: proper submodule initialization.
* Menu: fix stack corruption by queue.
* GUI: refactor.
* Makefile: format rule fix, st-util pid.
* GUI, Menu, FURI: format with clang-format.
* GUI, MENU: locks in critical sections, fix stack corruption, ready signaling.
* Makefile: clang format rule cleanup.
* GUI,MENU: migrate to new API.
* Applications: PRODUCTION_HW variable, skip drivers build on local target.
* refactor production build
* add git to dockerfile
* GUI: uncomment lock block
Co-authored-by: Aleksandr Kutuzov <aku@plooks.com>
2020-10-14 10:21:55 +00:00
|
|
|
// Event dispatcher
|
|
|
|
gui->event = gui_event_alloc();
|
2020-12-14 10:50:32 +00:00
|
|
|
// Drawing canvas
|
|
|
|
gui->canvas = canvas_init();
|
2020-10-26 17:00:17 +00:00
|
|
|
// Compose Layers
|
|
|
|
for(size_t i = 0; i < GuiLayerMAX; i++) {
|
2021-01-29 13:52:16 +00:00
|
|
|
ViewPortArray_init(gui->layers[i]);
|
2020-10-26 17:00:17 +00:00
|
|
|
}
|
2020-10-16 15:25:06 +00:00
|
|
|
|
Display and UI implementation (#169)
* Menu app. Lib: add mlib submodule.
* Menu: new startup lib dependency definition
* Menu: hierarchy in menu. Cube: fix heap1/4 inconsistency, stack protection.
* GUI: rendering pipeline initial version.
* GUI: layered widget composing, FURI record. Menu: FURI record, api.
* GUI: input dispatching. Menu: switch to input from GUI.
* GUI, MENU: code style cleanup, fix type conversion warnings.
* GUI, Menu: syntax check.
* Makefile: check and reinit submodules, format.
* Menu: lock on event processing. Makefile: proper submodule initialization.
* Menu: fix stack corruption by queue.
* GUI: refactor.
* Makefile: format rule fix, st-util pid.
* GUI, Menu, FURI: format with clang-format.
* GUI, MENU: locks in critical sections, fix stack corruption, ready signaling.
* Makefile: clang format rule cleanup.
* GUI,MENU: migrate to new API.
* Applications: PRODUCTION_HW variable, skip drivers build on local target.
* refactor production build
* add git to dockerfile
* GUI: uncomment lock block
Co-authored-by: Aleksandr Kutuzov <aku@plooks.com>
2020-10-14 10:21:55 +00:00
|
|
|
return gui;
|
|
|
|
}
|
|
|
|
|
|
|
|
void gui_task(void* p) {
|
2020-10-15 15:05:28 +00:00
|
|
|
Gui* gui = gui_alloc();
|
2020-10-15 08:32:48 +00:00
|
|
|
|
[FL-140] Core api dynamic records (#296)
* SYSTEM: tickless mode with deep sleep.
* Move FreeRTOS ticks to lptim2
* API: move all sumbodules init routines to one place. Timebase: working lptim2 at tick source.
* API Timebase: lp-timer routines, timer access safe zones prediction and synchronization. FreeRTOS: adjust configuration for tickless mode.
* NFC: support for tickless mode.
* API Timebase: improve tick error handling in IRQ. Apploader: use insomnia mode to run applications.
* BLE: prevent sleep while core2 starting
* HAL: nap while in insomnia mode
* init records work
* try to implement record delete
* tests and flapp
* flapp subsystem
* new core functions to get app stat, simplify core code
* fix thread termination
* add strdup to core
* fix tests
* Refactoring: remove all unusued parts, update API usage, aggreagate API sources and headers, new record storage
* Refactoring: update furi record api usage, cleanup code
* Fix broken merge for freertos apps
* Core, Target: fix compilation warnings
* Drop firmware target local
* HAL Timebase, Power, Clock: semaphore guarded access to clock and power modes, better sleep mode.
* SD-Filesystem: wait for all deps to arrive before adding widget. Core, BLE: disable debug dump to serial.
* delete old app example-ipc
* delete old app fatfs list
* fix strobe app, add input header
* delete old display driver
* comment old app qr-code
* fix sd-card test, add forced widget update
* remove unused new core test
* increase heap to 128k
* comment and assert old core tests
* fix syntax
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-01-20 16:09:26 +00:00
|
|
|
// Create FURI record
|
|
|
|
furi_record_create("gui", gui);
|
2020-10-15 08:32:48 +00:00
|
|
|
|
Display and UI implementation (#169)
* Menu app. Lib: add mlib submodule.
* Menu: new startup lib dependency definition
* Menu: hierarchy in menu. Cube: fix heap1/4 inconsistency, stack protection.
* GUI: rendering pipeline initial version.
* GUI: layered widget composing, FURI record. Menu: FURI record, api.
* GUI: input dispatching. Menu: switch to input from GUI.
* GUI, MENU: code style cleanup, fix type conversion warnings.
* GUI, Menu: syntax check.
* Makefile: check and reinit submodules, format.
* Menu: lock on event processing. Makefile: proper submodule initialization.
* Menu: fix stack corruption by queue.
* GUI: refactor.
* Makefile: format rule fix, st-util pid.
* GUI, Menu, FURI: format with clang-format.
* GUI, MENU: locks in critical sections, fix stack corruption, ready signaling.
* Makefile: clang format rule cleanup.
* GUI,MENU: migrate to new API.
* Applications: PRODUCTION_HW variable, skip drivers build on local target.
* refactor production build
* add git to dockerfile
* GUI: uncomment lock block
Co-authored-by: Aleksandr Kutuzov <aku@plooks.com>
2020-10-14 10:21:55 +00:00
|
|
|
// Forever dispatch
|
|
|
|
while(1) {
|
2020-10-15 15:05:28 +00:00
|
|
|
GuiMessage message = gui_event_message_next(gui->event);
|
|
|
|
if(message.type == GuiMessageTypeRedraw) {
|
Display and UI implementation (#169)
* Menu app. Lib: add mlib submodule.
* Menu: new startup lib dependency definition
* Menu: hierarchy in menu. Cube: fix heap1/4 inconsistency, stack protection.
* GUI: rendering pipeline initial version.
* GUI: layered widget composing, FURI record. Menu: FURI record, api.
* GUI: input dispatching. Menu: switch to input from GUI.
* GUI, MENU: code style cleanup, fix type conversion warnings.
* GUI, Menu: syntax check.
* Makefile: check and reinit submodules, format.
* Menu: lock on event processing. Makefile: proper submodule initialization.
* Menu: fix stack corruption by queue.
* GUI: refactor.
* Makefile: format rule fix, st-util pid.
* GUI, Menu, FURI: format with clang-format.
* GUI, MENU: locks in critical sections, fix stack corruption, ready signaling.
* Makefile: clang format rule cleanup.
* GUI,MENU: migrate to new API.
* Applications: PRODUCTION_HW variable, skip drivers build on local target.
* refactor production build
* add git to dockerfile
* GUI: uncomment lock block
Co-authored-by: Aleksandr Kutuzov <aku@plooks.com>
2020-10-14 10:21:55 +00:00
|
|
|
gui_redraw(gui);
|
2020-10-15 15:05:28 +00:00
|
|
|
} else if(message.type == GuiMessageTypeInput) {
|
Display and UI implementation (#169)
* Menu app. Lib: add mlib submodule.
* Menu: new startup lib dependency definition
* Menu: hierarchy in menu. Cube: fix heap1/4 inconsistency, stack protection.
* GUI: rendering pipeline initial version.
* GUI: layered widget composing, FURI record. Menu: FURI record, api.
* GUI: input dispatching. Menu: switch to input from GUI.
* GUI, MENU: code style cleanup, fix type conversion warnings.
* GUI, Menu: syntax check.
* Makefile: check and reinit submodules, format.
* Menu: lock on event processing. Makefile: proper submodule initialization.
* Menu: fix stack corruption by queue.
* GUI: refactor.
* Makefile: format rule fix, st-util pid.
* GUI, Menu, FURI: format with clang-format.
* GUI, MENU: locks in critical sections, fix stack corruption, ready signaling.
* Makefile: clang format rule cleanup.
* GUI,MENU: migrate to new API.
* Applications: PRODUCTION_HW variable, skip drivers build on local target.
* refactor production build
* add git to dockerfile
* GUI: uncomment lock block
Co-authored-by: Aleksandr Kutuzov <aku@plooks.com>
2020-10-14 10:21:55 +00:00
|
|
|
gui_input(gui, &message.input);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|