Merge branch 'ofw-dev' into dev

This commit is contained in:
MX 2023-08-11 18:08:12 +03:00
commit 4b81046b6f
No known key found for this signature in database
GPG key ID: 7CCC66B7DBDD1C83
78 changed files with 398 additions and 118 deletions

View file

@ -1,6 +1,7 @@
#include <storage/storage.h>
#include <assets_icons.h>
#include <gui/gui.h>
#include <gui/gui_i.h>
#include <gui/view_stack.h>
#include <notification/notification.h>
#include <notification/notification_messages.h>
@ -37,7 +38,6 @@ static void desktop_loader_callback(const void* message, void* context) {
view_dispatcher_send_custom_event(desktop->view_dispatcher, DesktopGlobalAfterAppFinished);
}
}
static void desktop_lock_icon_draw_callback(Canvas* canvas, void* context) {
UNUSED(context);
furi_assert(canvas);
@ -50,96 +50,63 @@ static void desktop_dummy_mode_icon_draw_callback(Canvas* canvas, void* context)
canvas_draw_icon(canvas, 0, 0, &I_GameMode_11x8);
}
static void desktop_clock_upd_time(Desktop* desktop, bool forced) {
static void desktop_clock_update(Desktop* desktop) {
furi_assert(desktop);
FuriHalRtcDateTime curr_dt;
furi_hal_rtc_get_datetime(&curr_dt);
bool time_format_12 = locale_get_time_format() == LocaleTimeFormat12h;
if(forced) {
desktop->clock_type = (locale_get_time_format() == LocaleTimeFormat24h);
}
if(forced || (desktop->minute != curr_dt.minute)) {
if(desktop->clock_type) {
desktop->hour = curr_dt.hour;
} else {
desktop->hour = (curr_dt.hour > 12) ? curr_dt.hour - 12 :
((curr_dt.hour == 0) ? 12 : curr_dt.hour);
}
desktop->minute = curr_dt.minute;
if(desktop->time_hour != curr_dt.hour || desktop->time_minute != curr_dt.minute ||
desktop->time_format_12 != time_format_12) {
desktop->time_format_12 = time_format_12;
desktop->time_hour = curr_dt.hour;
desktop->time_minute = curr_dt.minute;
view_port_update(desktop->clock_viewport);
}
}
static void desktop_clock_toggle_view(Desktop* desktop, bool is_enabled) {
static void desktop_clock_reconfigure(Desktop* desktop) {
furi_assert(desktop);
desktop_clock_upd_time(desktop, true);
desktop_clock_update(desktop);
if(is_enabled) { // && !furi_timer_is_running(desktop->update_clock_timer)) {
if(desktop->settings.display_clock) {
furi_timer_start(desktop->update_clock_timer, furi_ms_to_ticks(1000));
} else if(!is_enabled) { //&& furi_timer_is_running(desktop->update_clock_timer)) {
} else {
furi_timer_stop(desktop->update_clock_timer);
}
view_port_enabled_set(desktop->clock_viewport, is_enabled);
view_port_enabled_set(desktop->clock_viewport, desktop->settings.display_clock);
}
static uint8_t desktop_clock_get_num_w(uint8_t num) {
if(num == 1) {
return 3;
} else if(num == 4) {
return 6;
} else {
return 5;
}
}
static const char* digit[10] = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"};
static void desktop_clock_draw_callback(Canvas* canvas, void* context) {
furi_assert(context);
furi_assert(canvas);
Desktop* desktop = context;
uint8_t d[4] = {
desktop->minute % 10,
desktop->minute / 10,
desktop->hour % 10,
desktop->hour / 10,
};
canvas_set_font(canvas, FontPrimary);
uint8_t new_w = desktop_clock_get_num_w(d[0]) + //c1
desktop_clock_get_num_w(d[1]) + //c2
desktop_clock_get_num_w(d[2]) + //c3
desktop_clock_get_num_w(d[3]) + //c4
2 + 4; // ":" + 4 separators
uint8_t hour = desktop->time_hour;
if(desktop->time_format_12) {
if(hour > 12) {
hour -= 12;
}
if(hour == 0) {
hour = 12;
}
}
// further away from the battery charge indicator, if the smallest minute is 1
view_port_set_width(desktop->clock_viewport, new_w - !(d[0] == 1));
char buffer[20];
snprintf(buffer, sizeof(buffer), "%02u:%02u", hour, desktop->time_minute);
uint8_t x = new_w;
// ToDo: never do that, may cause visual glitches
view_port_set_width(
desktop->clock_viewport,
canvas_string_width(canvas, buffer) - 1 + (desktop->time_minute % 10 == 1));
uint8_t y = 8;
uint8_t offset_r;
canvas_draw_str_aligned(canvas, x, y, AlignRight, AlignBottom, digit[d[0]]);
offset_r = desktop_clock_get_num_w(d[0]);
canvas_draw_str_aligned(canvas, x -= (offset_r + 1), y, AlignRight, AlignBottom, digit[d[1]]);
offset_r = desktop_clock_get_num_w(d[1]);
canvas_draw_str_aligned(canvas, x -= (offset_r + 1), y - 1, AlignRight, AlignBottom, ":");
offset_r = 2;
canvas_draw_str_aligned(canvas, x -= (offset_r + 1), y, AlignRight, AlignBottom, digit[d[2]]);
offset_r = desktop_clock_get_num_w(d[2]);
canvas_draw_str_aligned(canvas, x -= (offset_r + 1), y, AlignRight, AlignBottom, digit[d[3]]);
canvas_draw_str_aligned(canvas, 0, 8, AlignLeft, AlignBottom, buffer);
}
static void desktop_stealth_mode_icon_draw_callback(Canvas* canvas, void* context) {
@ -163,7 +130,7 @@ static bool desktop_custom_event_callback(void* context, uint32_t event) {
// locking and unlocking
DESKTOP_SETTINGS_LOAD(&desktop->settings);
desktop_clock_toggle_view(desktop, desktop->settings.display_clock);
desktop_clock_reconfigure(desktop);
desktop_auto_lock_arm(desktop);
return true;
@ -234,8 +201,8 @@ static void desktop_clock_timer_callback(void* context) {
furi_assert(context);
Desktop* desktop = context;
if(gui_get_count_of_enabled_view_port_in_layer(desktop->gui, GuiLayerStatusBarLeft) < 6) {
desktop_clock_upd_time(desktop, false);
if(gui_active_view_port_count(desktop->gui, GuiLayerStatusBarLeft) < 6) {
desktop_clock_update(desktop);
view_port_enabled_set(desktop->clock_viewport, true);
} else {
@ -436,11 +403,6 @@ Desktop* desktop_alloc() {
desktop->update_clock_timer =
furi_timer_alloc(desktop_clock_timer_callback, FuriTimerTypePeriodic, desktop);
FuriHalRtcDateTime curr_dt;
furi_hal_rtc_get_datetime(&curr_dt);
desktop_clock_upd_time(desktop, true);
furi_record_create(RECORD_DESKTOP, desktop);
return desktop;
@ -487,7 +449,7 @@ int32_t desktop_srv(void* p) {
view_port_enabled_set(desktop->dummy_mode_icon_viewport, desktop->settings.dummy_mode);
desktop_clock_toggle_view(desktop, desktop->settings.display_clock);
desktop_clock_reconfigure(desktop);
desktop_main_set_dummy_mode_state(desktop->main_view, desktop->settings.dummy_mode);
animation_manager_set_dummy_mode_state(

View file

@ -78,6 +78,10 @@ struct Desktop {
uint8_t minute;
bool clock_type : 1; // true - 24h false - 12h
uint8_t time_hour;
uint8_t time_minute;
bool time_format_12 : 1; // 1 - 12 hour, 0 - 24H
bool in_transition : 1;
};

View file

@ -17,11 +17,12 @@ ViewPort* gui_view_port_find_enabled(ViewPortArray_t array) {
return NULL;
}
uint8_t gui_get_count_of_enabled_view_port_in_layer(Gui* gui, GuiLayer layer) {
size_t gui_active_view_port_count(Gui* gui, GuiLayer layer) {
furi_assert(gui);
furi_check(layer < GuiLayerMAX);
uint8_t ret = 0;
size_t ret = 0;
gui_lock(gui);
ViewPortArray_it_t it;
ViewPortArray_it_last(it, gui->layers[layer]);
while(!ViewPortArray_end_p(it)) {
@ -31,6 +32,8 @@ uint8_t gui_get_count_of_enabled_view_port_in_layer(Gui* gui, GuiLayer layer) {
}
ViewPortArray_previous(it);
}
gui_unlock(gui);
return ret;
}

View file

@ -75,6 +75,12 @@ struct Gui {
ViewPort* ongoing_input_view_port;
};
/** Find enabled ViewPort in ViewPortArray
*
* @param[in] array The ViewPortArray instance
*
* @return ViewPort instance or NULL
*/
ViewPort* gui_view_port_find_enabled(ViewPortArray_t array);
/** Update GUI, request redraw
@ -83,8 +89,30 @@ ViewPort* gui_view_port_find_enabled(ViewPortArray_t array);
*/
void gui_update(Gui* gui);
/** Input event callback
*
* Used to receive input from input service or to inject new input events
*
* @param[in] value The value pointer (InputEvent*)
* @param ctx The context (Gui instance)
*/
void gui_input_events_callback(const void* value, void* ctx);
/** Get count of view ports in layer
*
* @param gui The Gui instance
* @param[in] layer GuiLayer that we want to get count of view ports
*/
size_t gui_active_view_port_count(Gui* gui, GuiLayer layer);
/** Lock GUI
*
* @param gui The Gui instance
*/
void gui_lock(Gui* gui);
/** Unlock GUI
*
* @param gui The Gui instance
*/
void gui_unlock(Gui* gui);

View file

@ -166,6 +166,7 @@ bool desktop_settings_scene_start_on_event(void* context, SceneManagerEvent even
consumed = true;
break;
case SCENE_EVENT_SELECT_AUTO_LOCK_DELAY:
case SCENE_EVENT_SELECT_CLOCK_DISPLAY:
consumed = true;
break;
case SCENE_EVENT_SELECT_BATTERY_DISPLAY:

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 980 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 979 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 988 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 259 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 922 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 895 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 831 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 803 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 859 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 854 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 821 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 791 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 871 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 954 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 871 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 926 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 889 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 933 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 873 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 907 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 803 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 769 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 909 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 915 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 918 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 883 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,020 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 788 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 997 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 949 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,016 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 988 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 991 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 778 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 830 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 720 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 576 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 398 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 474 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 970 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -0,0 +1,284 @@
Filetype: Flipper Animation
Version: 1
Width: 128
Height: 64
Passive frames: 31
Active frames: 55
Frames order: 0 1 2 3 4 5 0 1 6 7 8 5 9 10 11 12 13 14 15 0 1 2 3 4 5 0 1 6 7 8 5 9 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 53 54 53 55 56 57 58 59 60 61 62 4 5
Active cycles: 1
Frame rate: 2
Duration: 3600
Active cooldown: 6
Bubble slots: 4
Slot: 0
X: 65
Y: 14
Text: All by myself
AlignH: Left
AlignV: Bottom
StartFrame: 45
EndFrame: 51
Slot: 0
X: 5
Y: 16
Text: Don't want
AlignH: Right
AlignV: Bottom
StartFrame: 56
EndFrame: 58
Slot: 0
X: 15
Y: 15
Text: to be
AlignH: Right
AlignV: Bottom
StartFrame: 59
EndFrame: 60
Slot: 0
X: 14
Y: 14
Text: All by myself
AlignH: Right
AlignV: Bottom
StartFrame: 63
EndFrame: 69
Slot: 0
X: 81
Y: 25
Text: anymore
AlignH: Left
AlignV: Bottom
StartFrame: 72
EndFrame: 74
Slot: 1
X: 65
Y: 14
Text: Nevermind
AlignH: Left
AlignV: Bottom
StartFrame: 45
EndFrame: 48
Slot: 1
X: 65
Y: 14
Text: I'll find
AlignH: Left
AlignV: Bottom
StartFrame: 49
EndFrame: 52
Slot: 1
X: 2
Y: 16
Text: Someone like
AlignH: Right
AlignV: Bottom
StartFrame: 56
EndFrame: 58
Slot: 1
X: 11
Y: 16
Text: youuuuu
AlignH: Right
AlignV: Bottom
StartFrame: 59
EndFrame: 60
Slot: 1
X: 3
Y: 14
Text: I wish nothing
AlignH: Right
AlignV: Bottom
StartFrame: 64
EndFrame: 66
Slot: 1
X: 6
Y: 14
Text: but the best
AlignH: Right
AlignV: Bottom
StartFrame: 67
EndFrame: 70
Slot: 1
X: 81
Y: 25
Text: for you
AlignH: Left
AlignV: Bottom
StartFrame: 72
EndFrame: 74
Slot: 2
X: 65
Y: 14
Text: What have I
AlignH: Left
AlignV: Bottom
StartFrame: 45
EndFrame: 48
Slot: 2
X: 65
Y: 14
Text: become
AlignH: Left
AlignV: Bottom
StartFrame: 47
EndFrame: 51
Slot: 2
X: 6
Y: 16
Text: My dearest
AlignH: Right
AlignV: Bottom
StartFrame: 56
EndFrame: 58
Slot: 2
X: 14
Y: 16
Text: friend
AlignH: Right
AlignV: Bottom
StartFrame: 59
EndFrame: 60
Slot: 2
X: 17
Y: 14
Text: Everyone
AlignH: Right
AlignV: Bottom
StartFrame: 63
EndFrame: 64
Slot: 2
X: 17
Y: 14
Text: I know
AlignH: Right
AlignV: Bottom
StartFrame: 65
EndFrame: 67
Slot: 2
X: 17
Y: 14
Text: goes away
AlignH: Right
AlignV: Bottom
StartFrame: 68
EndFrame: 70
Slot: 2
X: 81
Y: 25
Text: in the\n end
AlignH: Left
AlignV: Bottom
StartFrame: 72
EndFrame: 74
Slot: 3
X: 73
Y: 14
Text: We could\n have been
AlignH: Left
AlignV: Bottom
StartFrame: 45
EndFrame: 48
Slot: 3
X: 73
Y: 14
Text: so good\n together
AlignH: Left
AlignV: Bottom
StartFrame: 49
EndFrame: 51
Slot: 3
X: 7
Y: 17
Text: We could\n have lived
AlignH: Right
AlignV: Bottom
StartFrame: 55
EndFrame: 57
Slot: 3
X: 7
Y: 17
Text: this dance\n forever
AlignH: Right
AlignV: Bottom
StartFrame: 58
EndFrame: 60
Slot: 3
X: 12
Y: 14
Text: But now
AlignH: Right
AlignV: Bottom
StartFrame: 64
EndFrame: 65
Slot: 3
X: 5
Y: 14
Text: who's gonna
AlignH: Right
AlignV: Bottom
StartFrame: 66
EndFrame: 67
Slot: 3
X: 7
Y: 14
Text: dance with
AlignH: Right
AlignV: Bottom
StartFrame: 68
EndFrame: 69
Slot: 3
X: 26
Y: 14
Text: me?
AlignH: Right
AlignV: Bottom
StartFrame: 70
EndFrame: 70
Slot: 3
X: 81
Y: 25
Text: Please
AlignH: Left
AlignV: Bottom
StartFrame: 72
EndFrame: 74
Slot: 3
X: 81
Y: 25
Text: stay
AlignH: Left
AlignV: Bottom
StartFrame: 74
EndFrame: 75

View file

@ -162,6 +162,13 @@ Min level: 3
Max level: 3
Weight: 3
Name: L1_Sad_song_128x64
Min butthurt: 8
Max butthurt: 13
Min level: 1
Max level: 3
Weight: 4
Name: L3_Fireplace_128x64
Min butthurt: 0

View file

@ -1470,6 +1470,7 @@ Function,+,gui_add_framebuffer_callback,void,"Gui*, GuiCanvasCommitCallback, voi
Function,+,gui_add_view_port,void,"Gui*, ViewPort*, GuiLayer"
Function,+,gui_direct_draw_acquire,Canvas*,Gui*
Function,+,gui_direct_draw_release,void,Gui*
Function,-,gui_active_view_port_count,size_t,"Gui*, GuiLayer"
Function,+,gui_get_framebuffer_size,size_t,const Gui*
Function,+,gui_remove_framebuffer_callback,void,"Gui*, GuiCanvasCommitCallback, void*"
Function,+,gui_remove_view_port,void,"Gui*, ViewPort*"

1 entry status name type params
1470 Function + gui_add_view_port void Gui*, ViewPort*, GuiLayer
1471 Function + gui_direct_draw_acquire Canvas* Gui*
1472 Function + gui_direct_draw_release void Gui*
1473 Function - gui_active_view_port_count size_t Gui*, GuiLayer
1474 Function + gui_get_framebuffer_size size_t const Gui*
1475 Function + gui_remove_framebuffer_callback void Gui*, GuiCanvasCommitCallback, void*
1476 Function + gui_remove_view_port void Gui*, ViewPort*

View file

@ -1678,7 +1678,7 @@ Function,+,gui_add_framebuffer_callback,void,"Gui*, GuiCanvasCommitCallback, voi
Function,+,gui_add_view_port,void,"Gui*, ViewPort*, GuiLayer"
Function,+,gui_direct_draw_acquire,Canvas*,Gui*
Function,+,gui_direct_draw_release,void,Gui*
Function,-,gui_get_count_of_enabled_view_port_in_layer,uint8_t,"Gui*, GuiLayer"
Function,-,gui_active_view_port_count,size_t,"Gui*, GuiLayer"
Function,+,gui_get_framebuffer_size,size_t,const Gui*
Function,+,gui_remove_framebuffer_callback,void,"Gui*, GuiCanvasCommitCallback, void*"
Function,+,gui_remove_view_port,void,"Gui*, ViewPort*"

1 entry status name type params
1678 Function + gui_add_view_port void Gui*, ViewPort*, GuiLayer
1679 Function + gui_direct_draw_acquire Canvas* Gui*
1680 Function + gui_direct_draw_release void Gui*
1681 Function - gui_get_count_of_enabled_view_port_in_layer gui_active_view_port_count uint8_t size_t Gui*, GuiLayer
1682 Function + gui_get_framebuffer_size size_t const Gui*
1683 Function + gui_remove_framebuffer_callback void Gui*, GuiCanvasCommitCallback, void*
1684 Function + gui_remove_view_port void Gui*, ViewPort*

View file

@ -2,6 +2,7 @@ import os
import re
from dataclasses import dataclass, field
from enum import Enum
from fbt.util import resolve_real_dir_node
from typing import Callable, ClassVar, List, Optional, Tuple, Union
@ -152,7 +153,7 @@ class AppManager:
FlipperApplication(
*args,
**kw,
_appdir=app_dir_node,
_appdir=resolve_real_dir_node(app_dir_node),
_apppath=os.path.dirname(app_manifest_path),
_appmanager=self,
),

View file

@ -45,7 +45,7 @@ def single_quote(arg_list):
return " ".join(f"'{arg}'" if " " in arg else str(arg) for arg in arg_list)
def extract_abs_dir(node):
def resolve_real_dir_node(node):
if isinstance(node, SCons.Node.FS.EntryProxy):
node = node.get()
@ -53,15 +53,7 @@ def extract_abs_dir(node):
if os.path.exists(repo_dir.abspath):
return repo_dir
def extract_abs_dir_path(node):
abs_dir_node = extract_abs_dir(node)
if abs_dir_node is None:
raise StopError(f"Can't find absolute path for {node.name}")
# Don't return abspath attribute (type is str), it will break in
# OverrideEnvironment.subst_list() by splitting path on spaces
return abs_dir_node
raise StopError(f"Can't find absolute path for {node.name} ({node})")
def path_as_posix(path):

View file

@ -8,11 +8,14 @@ from SCons.Errors import StopError
def icons_emitter(target, source, env):
icons_src = env.GlobRecursive("*.png", env["ICON_SRC_DIR"])
icons_src += env.GlobRecursive("frame_rate", env["ICON_SRC_DIR"])
target = [
target[0].File(env.subst("${ICON_FILE_NAME}.c")),
target[0].File(env.subst("${ICON_FILE_NAME}.h")),
]
return target, source
return target, icons_src
def proto_emitter(target, source, env):
@ -104,17 +107,12 @@ def proto_ver_generator(target, source, env):
def CompileIcons(env, target_dir, source_dir, *, icon_bundle_name="assets_icons"):
# Gathering icons sources
icons_src = env.GlobRecursive("*.png", source_dir)
icons_src += env.GlobRecursive("frame_rate", source_dir)
icons = env.IconBuilder(
return env.IconBuilder(
target_dir,
source_dir,
None,
ICON_SRC_DIR=source_dir,
ICON_FILE_NAME=icon_bundle_name,
)
env.Depends(icons, icons_src)
return icons
def generate(env):
@ -137,7 +135,7 @@ def generate(env):
BUILDERS={
"IconBuilder": Builder(
action=Action(
'${PYTHON3} ${ASSETS_COMPILER} icons ${ABSPATHGETTERFUNC(SOURCE)} ${TARGET.dir} --filename "${ICON_FILE_NAME}"',
'${PYTHON3} ${ASSETS_COMPILER} icons ${ICON_SRC_DIR} ${TARGET.dir} --filename "${ICON_FILE_NAME}"',
"${ICONSCOMSTR}",
),
emitter=icons_emitter,

View file

@ -11,7 +11,7 @@ from fbt.appmanifest import FlipperApplication, FlipperAppType, FlipperManifestE
from fbt.elfmanifest import assemble_manifest_data
from fbt.fapassets import FileBundler
from fbt.sdk.cache import SdkCache
from fbt.util import extract_abs_dir_path
from fbt.util import resolve_real_dir_node
from SCons.Action import Action
from SCons.Builder import Builder
from SCons.Errors import UserError
@ -50,7 +50,8 @@ class AppBuilder:
def _setup_app_env(self):
self.app_env = self.fw_env.Clone(
FAP_SRC_DIR=self.app._appdir, FAP_WORK_DIR=self.app_work_dir
FAP_SRC_DIR=self.app._appdir,
FAP_WORK_DIR=self.app_work_dir,
)
self.app_env.VariantDir(self.app_work_dir, self.app._appdir, duplicate=False)
@ -119,7 +120,7 @@ class AppBuilder:
CPPDEFINES=lib_def.cdefines,
CPPPATH=list(
map(
lambda cpath: extract_abs_dir_path(self.app._appdir.Dir(cpath)),
lambda cpath: resolve_real_dir_node(self.app._appdir.Dir(cpath)),
lib_def.cincludes,
)
),
@ -133,7 +134,7 @@ class AppBuilder:
def _build_app(self):
self.app_env.Append(
LIBS=[*self.app.fap_libs, *self.private_libs],
CPPPATH=self.app_env.Dir(self.app_work_dir),
CPPPATH=[self.app_env.Dir(self.app_work_dir), self.app._appdir],
)
app_sources = list(

View file

@ -1,12 +1,11 @@
from SCons.Platform import TempFileMunge
from SCons.Node import FS
from SCons.Errors import UserError
import os
import multiprocessing
import os
import pathlib
from SCons.Errors import UserError
from SCons.Node import FS
from SCons.Platform import TempFileMunge
SetOption("num_jobs", multiprocessing.cpu_count())
SetOption("max_drift", 1)
# SetOption("silent", False)
@ -67,16 +66,15 @@ core_env.Append(CPPDEFINES=GetOption("extra_defines"))
# Now we can import stuff bundled with SDK - it was added to sys.path by ufbt_state
from fbt.util import (
tempfile_arg_esc_func,
single_quote,
extract_abs_dir,
extract_abs_dir_path,
wrap_tempfile,
path_as_posix,
)
from fbt.appmanifest import FlipperAppType, FlipperApplication
from fbt.appmanifest import FlipperApplication, FlipperAppType
from fbt.sdk.cache import SdkCache
from fbt.util import (
path_as_posix,
resolve_real_dir_node,
single_quote,
tempfile_arg_esc_func,
wrap_tempfile,
)
# Base environment with all tools loaded from SDK
env = core_env.Clone(
@ -107,7 +105,7 @@ env = core_env.Clone(
PROGSUFFIX=".elf",
TEMPFILEARGESCFUNC=tempfile_arg_esc_func,
SINGLEQUOTEFUNC=single_quote,
ABSPATHGETTERFUNC=extract_abs_dir_path,
ABSPATHGETTERFUNC=resolve_real_dir_node,
APPS=[],
UFBT_API_VERSION=SdkCache(
core_env.subst("$SDK_DEFINITION"), load_version_only=True
@ -277,7 +275,7 @@ for app in known_extapps:
continue
app_artifacts = appenv.BuildAppElf(app)
app_src_dir = extract_abs_dir(app_artifacts.app._appdir)
app_src_dir = resolve_real_dir_node(app_artifacts.app._appdir)
app_artifacts.installer = [
appenv.Install(app_src_dir.Dir("dist"), app_artifacts.compact),
appenv.Install(app_src_dir.Dir("dist").Dir("debug"), app_artifacts.debug),

View file

@ -3,7 +3,7 @@ from fbt.util import (
tempfile_arg_esc_func,
single_quote,
wrap_tempfile,
extract_abs_dir_path,
resolve_real_dir_node,
)
import os
@ -59,7 +59,7 @@ coreenv = VAR_ENV.Clone(
PROGSUFFIX=".elf",
ENV=forward_os_env,
SINGLEQUOTEFUNC=single_quote,
ABSPATHGETTERFUNC=extract_abs_dir_path,
ABSPATHGETTERFUNC=resolve_real_dir_node,
# Setting up temp file parameters - to overcome command line length limits
TEMPFILEARGESCFUNC=tempfile_arg_esc_func,
ROOT_DIR=Dir("#"),