Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add changes from "fixed memory usage #2380" to about_simple file generator. #2381

Merged
merged 7 commits into from
Nov 22, 2024
Merged
11 changes: 6 additions & 5 deletions firmware/tools/generate_ui-about-simple.cpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@
import sys

cppheader = """#include "ui_about_simple.hpp"
#include <string_view>

#define ROLL_SPEED_FRAME_PER_LINE 60
// cuz frame rate of pp screen is probably 60, scroll per sec

namespace ui {

// Information: a line starting with a '#' will be yellow coloured
const std::"""
constexpr std::"""

cppfooter = """
AboutView::AboutView(NavigationView& nav) {
Expand All @@ -52,18 +53,18 @@
button_ok.focus();
};

for (const std::string& authors_line : authors_list) {
for (auto& authors_line : authors_list) {
// if it's starting with #, it's a title and we have to substract the '#' and paint yellow
if (authors_line.size() > 0) {
if (authors_line[0] == '#') {
menu_view.add_item(
{authors_line.substr(1, authors_line.size() - 1),
{(std::string)authors_line.substr(1, authors_line.size() - 1),
ui::Theme::getInstance()->fg_yellow->foreground,
nullptr,
nullptr});
} else {
menu_view.add_item(
{authors_line,
{(std::string)authors_line,
Theme::getInstance()->bg_darkest->foreground,
nullptr,
nullptr});
Expand Down Expand Up @@ -169,7 +170,7 @@ def pp_create_ui_about_simple_cpp(cpp_file, cppheader, cppcontent, cppfooter):

def pp_change_ui_about_simple_cpp(cpp_file, cppcontent):
content = []
content_pattern = re.compile(r"string authors_list\[\] = {\n(?:\s+(?:.*,\n)+\s+.*};\n)", re.MULTILINE)
content_pattern = re.compile(r"string:view authors_list\[\] = {\n(?:\s+(?:.*,\n)+\s+.*};\n)", re.MULTILINE)
bernd-herzog marked this conversation as resolved.
Show resolved Hide resolved

# Read original file
with open(cpp_file, 'r') as file:
Expand Down
Loading