1
mirror of https://github.com/DarkFlippers/unleashed-firmware.git synced 2025-12-12 04:34:43 +04:00

Merge branch 'ofw_dev' into dev

This commit is contained in:
MX
2023-10-08 11:43:16 +03:00
9 changed files with 88 additions and 25 deletions

View File

@@ -177,6 +177,12 @@ static void byte_input_draw_input(Canvas* canvas, ByteInputModel* model) {
if(i == model->selected_byte) {
canvas_draw_frame(canvas, text_x + byte_position * 14, text_y - 9, 15, 11);
if(model->selected_row == -2) {
canvas_draw_icon(
canvas, text_x + 6 + byte_position * 14, text_y - 14, &I_arrow_nano_up);
canvas_draw_icon(
canvas, text_x + 6 + byte_position * 14, text_y + 5, &I_arrow_nano_down);
}
if(model->selected_high_nibble) {
canvas_draw_glyph(
@@ -233,6 +239,7 @@ static void byte_input_draw_input(Canvas* canvas, ByteInputModel* model) {
}
if(draw_index_line) {
canvas_draw_icon(canvas, 1, text_y + 8, &I_Hashmark_7x7);
canvas_draw_glyph(
canvas, text_x + 2 + byte_position * 14, text_y2, num_to_char[(i + 1) / 10]);
@@ -600,9 +607,6 @@ static void byte_input_view_draw_callback(Canvas* canvas, void* _model) {
canvas_clear(canvas);
canvas_set_color(canvas, ColorBlack);
canvas_draw_str(canvas, 2, 9, model->header);
canvas_set_font(canvas, FontKeyboard);
if(model->selected_row == -1) {
@@ -613,9 +617,19 @@ static void byte_input_view_draw_callback(Canvas* canvas, void* _model) {
if(model->selected_row == -2) {
canvas_set_font(canvas, FontSecondary);
canvas_draw_icon(canvas, 3, 52, &I_Pin_back_arrow_10x8);
canvas_draw_str_aligned(canvas, 16, 60, AlignLeft, AlignBottom, "back to keyboard");
canvas_draw_icon(canvas, 3, 1, &I_Pin_back_arrow_10x8);
canvas_draw_str_aligned(canvas, 16, 9, AlignLeft, AlignBottom, "back to keyboard");
elements_button_center(canvas, "Save");
} else {
// Draw the header
canvas_set_font(canvas, FontSecondary);
if(model->selected_row == -1) {
canvas_draw_str(canvas, 10, 9, "Move up for alternate input");
canvas_draw_icon(canvas, 3, 4, &I_SmallArrowUp_3x5);
} else {
canvas_draw_str(canvas, 2, 9, model->header);
}
canvas_set_font(canvas, FontKeyboard);
// Draw keyboard
for(uint8_t row = 0; row < keyboard_row_count; row++) {
const uint8_t column_count = byte_input_get_row_size(row);

Binary file not shown.

After

Width:  |  Height:  |  Size: 957 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 949 B

View File

@@ -6,9 +6,9 @@ Flipper uses `.sub` files to store SubGhz transmissions. These are text files in
A `.sub` files consist of 3 parts:
- **header**: contains file type, version, and frequency
- **preset information**: preset type and, in case of a custom preset, transceiver configuration data
- **protocol and its data**: contains protocol name and its specific data, such as key, bit length, etc., or RAW data
- **header**, contains file type, version, and frequency
- **preset information**, preset type and, in case of a custom preset, transceiver configuration data
- **protocol and its data**, contains protocol name and its specific data, such as key, bit length, etc., or RAW data
Flipper's SubGhz subsystem uses presets to configure the radio transceiver. Presets are used to configure modulation, bandwidth, filters, etc. There are several presets available in stock firmware, and there is a way to create custom presets. See [SubGhz Presets](#adding-a-custom-preset) for more details.
@@ -45,10 +45,10 @@ Built-in presets:
Transceiver configuration data is a string of bytes, encoded in hex format, separated by spaces. For CC1101 data structure is: `XX YY XX YY .. 00 00 ZZ ZZ ZZ ZZ ZZ ZZ ZZ ZZ`, where:
- XX holds register address,
- YY contains register value,
- 00 00: marks register block end,
- `ZZ ZZ ZZ ZZ ZZ ZZ ZZ ZZ`: 8 byte PA table (Power amplifier ramp table).
- **XX**, holds register address,
- **YY**, contains register value,
- **00 00**, marks register block end,
- **ZZ ZZ ZZ ZZ ZZ ZZ ZZ ZZ**, 8 byte PA table (Power amplifier ramp table).
You can find more details in the [CC1101 datasheet](https://www.ti.com/lit/ds/symlink/cc1101.pdf) and `furi_hal_subghz` code.
@@ -87,8 +87,8 @@ RAW `.sub` files contain raw signal data that is not processed through protocol-
For RAW files, 2 fields are required:
- `Protocol`, must be `RAW`
- `RAW_Data`, contains an array of timings, specified in microseconds Values must be non-zero, start with a positive number, and interleaved (change sign with each value). Up to 512 values per line. Can be specified multiple times to store multiple lines of data.
- **Protocol**, must be `RAW`
- **RAW_Data**, contains an array of timings, specified in microseconds Values must be non-zero, start with a positive number, and interleaved (change sign with each value). Up to 512 values per line. Can be specified multiple times to store multiple lines of data.
Example of RAW data:
@@ -97,6 +97,43 @@ Example of RAW data:
Long payload not fitting into internal memory buffer and consisting of short duration timings (< 10us) may not be read fast enough from the SD card. That might cause the signal transmission to stop before reaching the end of the payload. Ensure that your SD Card has good performance before transmitting long or complex RAW payloads.
### BIN_RAW Files
BinRAW `.sub` files and `RAW` files both contain data that has not been decoded by any protocol. However, unlike `RAW`, `BinRAW` files only record a useful repeating sequence of durations with a restored byte transfer rate and without broadcast noise. These files can emulate nearly all static protocols, whether Flipper knows them or not.
- Usually, you have to receive the signal a little longer so that Flipper accumulates sufficient data for correct analysis.
For `BinRAW` files, the following parameters are required and must be aligned to the left:
- **Protocol**, must be `BinRAW`.
- **Bit**, is the length of the payload of the entire file, in bits (max 4096).
- **TE**, is the quantization interval, in us.
- **Bit_RAW**, is the length of the payload in the next Data_RAW parameter, in bits.
- **Data_RAW**, is an encoded sequence of durations, where each bit in the sequence encodes one TE interval: 1 - high level (there is a carrier), 0 - low (no carrier).
For example, TE=100, Bit_RAW=8, Data_RAW=0x37 => 0b00110111, that is, `-200 200 -100 300` will be transmitted.
When sending uploads, `Bit_RAW` and `Data_RAW` form a repeating block. Several such blocks are necessary if you want to send different sequences sequentially. However, usually, there will be only one block.
Example data from a `BinRAW` file:
```
...
Protocol: BinRAW
Bit: 1572
TE: 597
Bit_RAW: 260
Data_RAW: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0F 4A B5 55 4C B3 52 AC D5 2D 53 52 AD 4A D5 35 00
Bit_RAW: 263
Data_RAW: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 00 04 D5 32 D2 AB 2B 33 32 CB 2C CC B3 52 D3 00
Bit_RAW: 259
Data_RAW: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03 4A AB 55 34 D5 2D 4C CD 33 4A CD 55 4C D2 B3 00
Bit_RAW: 263
Data_RAW: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0F 7F 4A AA D5 2A CC B2 B4 CB 34 CC AA AB 4D 53 53 00
Bit_RAW: 264
Data_RAW: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 FC 00 00 15 2C CB 34 D3 35 35 4D 4B 32 B2 D3 33 00
Bit_RAW: 263
Data_RAW: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 DE 02 D3 54 D5 4C D2 CC AD 4B 2C B2 B5 54 CC AB 00
```
## File examples
### Key file, standard preset

View File

@@ -9,7 +9,7 @@ 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"])
icons_src += env.GlobRecursive("**/frame_rate", env["ICON_SRC_DIR"])
target = [
target[0].File(env.subst("${ICON_FILE_NAME}.c")),

View File

@@ -157,6 +157,11 @@ class AppBuilder:
for source_type in self.app.sources
)
)
if not app_sources:
raise UserError(f"No source files found for {self.app.appid}")
## Uncomment for debug
# print(f"App sources for {self.app.appid}: {list(f.path for f in app_sources)}")
app_artifacts = FlipperExternalAppInfo(self.app)
app_artifacts.debug = self.app_env.Program(
@@ -239,9 +244,10 @@ class AppBuilder:
# Add dependencies on file assets
for assets_dir in self.app._assets_dirs:
glob_res = self.app_env.GlobRecursive("*", assets_dir)
self.app_env.Depends(
app_artifacts.compact,
(assets_dir, self.app_env.GlobRecursive("*", assets_dir)),
(*glob_res, assets_dir),
)
# Always run the validator for the app's binary when building the app

View File

@@ -48,7 +48,6 @@ def generate(env):
"@.pvsoptions",
"-j${PVSNCORES}",
# "--incremental", # kinda broken on PVS side
"--disableLicenseExpirationCheck",
],
PVSCONVOPTIONS=[
"-a",

View File

@@ -1,6 +1,7 @@
import SCons
from fbt.util import GLOB_FILE_EXCLUSION
from SCons.Script import Flatten
from SCons.Node.FS import has_glob_magic
def GlobRecursive(env, pattern, node=".", exclude=[]):
@@ -9,14 +10,20 @@ def GlobRecursive(env, pattern, node=".", exclude=[]):
results = []
if isinstance(node, str):
node = env.Dir(node)
for f in node.glob("*", source=True, exclude=exclude):
if isinstance(f, SCons.Node.FS.Dir):
results += env.GlobRecursive(pattern, f, exclude)
results += node.glob(
pattern,
source=True,
exclude=exclude,
)
# Only initiate actual recursion if special symbols can be found in 'pattern'
if has_glob_magic(pattern):
for f in node.glob("*", source=True, exclude=exclude):
if isinstance(f, SCons.Node.FS.Dir):
results += env.GlobRecursive(pattern, f, exclude)
results += node.glob(
pattern,
source=True,
exclude=exclude,
)
# Otherwise, just check if that's an existing file path
# NB: still creates "virtual" nodes as part of existence check
elif (file_node := node.File(pattern)).exists() or file_node.rexists():
results.append(file_node)
# print(f"Glob result for {pattern} from {node}: {results}")
return results