-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #326 from 4ms/v1.0-dev
Screen support (text only)
- Loading branch information
Showing
40 changed files
with
4,382 additions
and
695 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
## MetaModule License | ||
|
||
MetaModule is copyright (c) 2024 4ms Company. | ||
|
||
This program is free software: you can redistribute it and/or modify it under | ||
the terms of the GNU General Public License as published by the Free Software | ||
Foundation, either version 3 of the License, or (at your option) any later | ||
version. | ||
|
||
See LICENSE-GPL-v3.txt for the text of the license. | ||
|
||
The MetaModule name is copyright (c) 2024 4ms Company. It may not be used in | ||
derivative works. However, you may use any of the phrases "works with | ||
MetaModule" or "compatible with MetaModule" or "for MetaModule" when promoting | ||
a plugin which was built with the MetaModule Plugin SDK and runs on the | ||
MetaModule hardware. | ||
|
||
Third-party libraries are licensed by the respective licenses of the copyright | ||
holders, which are included in their respective sub-directories. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#pragma once | ||
#include "CoreModules/elements/elements.hh" | ||
#include "debug.hh" | ||
#include "gui/elements/context.hh" | ||
#include "gui/images/paths.hh" | ||
#include "lvgl.h" | ||
#include "patch_data.hh" | ||
#include "patch_play/text_display.hh" | ||
#include "pr_dbg.hh" | ||
#include "util/overloaded.hh" | ||
|
||
namespace MetaModule | ||
{ | ||
|
||
inline bool redraw_text(lv_obj_t *obj, std::string_view text) { | ||
bool is_label = lv_obj_has_class(obj, &lv_label_class); | ||
if (is_label) { | ||
if (text != lv_label_get_text(obj)) { | ||
lv_label_set_text(obj, text.data()); | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
|
||
inline bool redraw_display(DrawnElement &drawn_el, | ||
unsigned this_module_id, | ||
std::array<WatchedTextDisplay, TextDisplayWatcher::MaxDisplaysToWatch> &watch_displays) { | ||
|
||
bool was_redrawn = false; | ||
if (drawn_el.element.index() == Element{DynamicTextDisplay{}}.index()) { | ||
|
||
// Scan all watch_displays to find a match | ||
for (auto &d : watch_displays) { | ||
if (!d.is_active()) | ||
continue; | ||
if (d.module_id != this_module_id) | ||
continue; | ||
if (d.light_id != drawn_el.gui_element.idx.light_idx) | ||
continue; | ||
|
||
was_redrawn = redraw_text(drawn_el.gui_element.obj, d.text); | ||
break; | ||
} | ||
} | ||
return was_redrawn; | ||
} | ||
|
||
} // namespace MetaModule |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.