unirf update

allow selecting custom map files
This commit is contained in:
MX 2022-07-29 21:18:06 +03:00
parent bf088dd585
commit aa757eeb49
No known key found for this signature in database
GPG key ID: 6C4C311DFD4B4AB5
6 changed files with 137 additions and 321 deletions

View file

@ -1,114 +1,116 @@
kind: pipeline
type: docker
name: 'Build firmware'
name: "Build firmware"
steps:
- name: 'Update submodules'
image: alpine/git
commands:
- git submodule sync
- git -c protocol.version=2 submodule update --init --force --recursive
- git submodule foreach git config --local gc.auto 0
- git log -1 --format='%H'
- name: "Update submodules"
image: alpine/git
commands:
- git submodule sync
- git -c protocol.version=2 submodule update --init --force --recursive
- git submodule foreach git config --local gc.auto 0
- git log -1 --format='%H'
- name: 'Build default fw'
image: hfdj/fztools
pull: never
commands:
- export DIST_SUFFIX=${DRONE_TAG}
- export WORKFLOW_BRANCH_OR_TAG=dev-cfw
- ./fbt --with-updater COMPACT=1 DEBUG=0 updater_package
- mkdir artifacts-default
- mv dist/f7-C/* artifacts-default/
- ls -laS artifacts-default
- ls -laS artifacts-default/f7-update-${DRONE_TAG}
environment:
FBT_TOOLS_CUSTOM_LINK:
from_secret: fbt_link
- name: "Build default fw"
image: hfdj/fztools
pull: never
commands:
- export DIST_SUFFIX=${DRONE_TAG}
- export WORKFLOW_BRANCH_OR_TAG=dev-cfw
- ./fbt --with-updater COMPACT=1 DEBUG=0 updater_package
- mkdir artifacts-default
- mv dist/f7-C/* artifacts-default/
- ls -laS artifacts-default
- ls -laS artifacts-default/f7-update-${DRONE_TAG}
environment:
FBT_TOOLS_CUSTOM_LINK:
from_secret: fbt_link
- name: 'Bundle resources'
image: kramos/alpine-zip
commands:
- mkdir sd-card
- mkdir -p sd-card/subghz/assets
- mkdir -p sd-card/nfc/assets
- mkdir -p sd-card/infrared/assets
- cp assets/resources/subghz/assets/universal_rf_map sd-card/subghz/assets/universal_rf_map
- cp assets/resources/subghz/assets/setting_user sd-card/subghz/assets/setting_user
- cp assets/resources/subghz/assets/keeloq_mfcodes sd-card/subghz/assets/keeloq_mfcodes
- cp assets/resources/nfc/assets/mf_classic_dict.nfc sd-card/nfc/assets/mf_classic_dict.nfc
- cp assets/resources/infrared/assets/tv.ir sd-card/infrared/assets/tv.ir
- cp assets/resources/Manifest sd-card/Manifest
- zip -r artifacts-default/sd-card-${DRONE_TAG}.zip sd-card
- rm -rf sd-card
- ls -laS artifacts-default
- name: "Bundle resources"
image: kramos/alpine-zip
commands:
- mkdir sd-card
- mkdir -p sd-card/subghz/assets
- mkdir -p sd-card/nfc/assets
- mkdir -p sd-card/infrared/assets
- mkdir -p sd-card/unirf
- cp assets/resources/subghz/assets/dangerous_settings sd-card/subghz/assets/dangerous_settings
- cp assets/resources/subghz/assets/setting_user sd-card/subghz/assets/setting_user
- cp assets/resources/subghz/assets/keeloq_mfcodes sd-card/subghz/assets/keeloq_mfcodes
- cp assets/resources/nfc/assets/mf_classic_dict.nfc sd-card/nfc/assets/mf_classic_dict.nfc
- cp assets/resources/infrared/assets/tv.ir sd-card/infrared/assets/tv.ir
- cp assets/resources/unirf/unirf_map_example.txt sd-card/unirf/unirf_map_example.txt
- cp assets/resources/Manifest sd-card/Manifest
- zip -r artifacts-default/sd-card-${DRONE_TAG}.zip sd-card
- rm -rf sd-card
- ls -laS artifacts-default
- name: 'Bundle self-update packages'
image: kramos/alpine-zip
commands:
- tar czpf artifacts-default/flipper-z-f7-update-${DRONE_TAG}.tgz -C artifacts-default f7-update-${DRONE_TAG}
- zip -r artifacts-default/flipper-z-f7-update-${DRONE_TAG}.zip artifacts-default/f7-update-${DRONE_TAG}
- rm -rf artifacts-default/f7-update-${DRONE_TAG}
- ls -laS artifacts-default
- name: "Bundle self-update packages"
image: kramos/alpine-zip
commands:
- tar czpf artifacts-default/flipper-z-f7-update-${DRONE_TAG}.tgz -C artifacts-default f7-update-${DRONE_TAG}
- zip -r artifacts-default/flipper-z-f7-update-${DRONE_TAG}.zip artifacts-default/f7-update-${DRONE_TAG}
- rm -rf artifacts-default/f7-update-${DRONE_TAG}
- ls -laS artifacts-default
- name: 'Do Github release'
image: ddplugins/github-release
pull: never
settings:
github_url: https://github.com
repo_owner:
from_secret: github_repoowner
api_key:
from_secret: github_apikey
files:
- artifacts-default/*.tgz
- artifacts-default/*.zip
- artifacts-default/flipper-z-f7-full-${DRONE_TAG}.dfu
title: ${DRONE_TAG}
note: CHANGELOG.md
checksum:
- md5
- sha1
- crc32
- name: "Do Github release"
image: ddplugins/github-release
pull: never
settings:
github_url: https://github.com
repo_owner:
from_secret: github_repoowner
api_key:
from_secret: github_apikey
files:
- artifacts-default/*.tgz
- artifacts-default/*.zip
- artifacts-default/flipper-z-f7-full-${DRONE_TAG}.dfu
title: ${DRONE_TAG}
note: CHANGELOG.md
checksum:
- md5
- sha1
- crc32
- name: 'Send files to telegram'
image: appleboy/drone-telegram
settings:
token:
from_secret: tgtoken
to:
from_secret: tgid
format: markdown
message: "New Unleashed firmware released!
- name: "Send files to telegram"
image: appleboy/drone-telegram
settings:
token:
from_secret: tgtoken
to:
from_secret: tgid
format: markdown
message: "New Unleashed firmware released!
Version: {{build.tag}}
Version: {{build.tag}}
[-Github-](https://github.com/Eng1n33r/flipperzero-firmware/releases/tag/${DRONE_TAG})"
document:
- artifacts-default/flipper-z-f7-full-${DRONE_TAG}.dfu
- artifacts-default/flipper-z-f7-update-${DRONE_TAG}.zip
- artifacts-default/sd-card-${DRONE_TAG}.zip
[-Github-](https://github.com/Eng1n33r/flipperzero-firmware/releases/tag/${DRONE_TAG})"
document:
- artifacts-default/flipper-z-f7-full-${DRONE_TAG}.dfu
- artifacts-default/flipper-z-f7-update-${DRONE_TAG}.zip
- artifacts-default/sd-card-${DRONE_TAG}.zip
- name: 'Send discord notification'
image: appleboy/drone-discord
settings:
webhook_id:
from_secret: ds_wh_id
webhook_token:
from_secret: ds_wh_token
message: "New Unleashed firmware released!
- name: "Send discord notification"
image: appleboy/drone-discord
settings:
webhook_id:
from_secret: ds_wh_id
webhook_token:
from_secret: ds_wh_token
message: "New Unleashed firmware released!
Version: {{build.tag}}
Version: {{build.tag}}
[[Github]](https://github.com/Eng1n33r/flipperzero-firmware/releases/latest)"
[[Github]](https://github.com/Eng1n33r/flipperzero-firmware/releases/latest)"
trigger:
event:
- tag
- tag
node:
typ: haupt
typ: haupt

View file

@ -1,6 +1,7 @@
### New changes
* Added pack of community apps with some fixes/changes - [(Full list)](https://github.com/Eng1n33r/flipperzero-firmware#apps-included)
* BadUSB extra keyboard layouts [(By v1nc)](https://github.com/v1nc/flipperzero-firmware) - [How to use](https://github.com/Eng1n33r/flipperzero-firmware/blob/dev/documentation/BadUSBLayouts.md)
* UniRF app update - now its possible to select any `.txt` map file, instructions updated
* Added ability to extend subghz frequency range
* Updated docs and readme

View file

@ -1,6 +1,7 @@
#include <furi.h>
#include <gui/gui.h>
#include <input/input.h>
#include <dialogs/dialogs.h>
#include <flipper_format/flipper_format_i.h>
#include <lib/toolbox/path.h>
@ -14,6 +15,9 @@
#define TAG "UniRF Remix"
#define UNIRF_APP_PATH_FOLDER "/ext/unirf"
#define UNIRF_APP_PATH_EXTENSION ".txt"
typedef struct {
FuriMutex* model_mutex;
@ -148,13 +152,9 @@ static char* extract_filename(const char* name, int len) {
*/
void unirfremix_cfg_set_check(UniRFRemix* app) {
//set file name to universal_rf_map.txt first
string_t file_name;
string_init(file_name);
string_set(file_name, "/any/subghz/assets/universal_rf_map.txt");
Storage* storage = furi_record_open("storage");
FlipperFormat* fff_data_file = flipper_format_file_alloc(storage);
storage_common_mkdir(storage, UNIRF_APP_PATH_FOLDER);
app->file_result = 3;
app->file_blank = 0;
@ -166,14 +166,25 @@ void unirfremix_cfg_set_check(UniRFRemix* app) {
app->ok_enabled = 1;
int label_len = 12;
int legacy = 0;
DialogsApp* dialogs = furi_record_open("dialogs");
bool select_result = false;
string_t file_name;
string_init(file_name);
string_set_str(file_name, UNIRF_APP_PATH_FOLDER);
bool ret = dialog_file_browser_show(
dialogs, file_name, file_name, UNIRF_APP_PATH_EXTENSION, true, &I_sub1_10px, false);
furi_record_close("dialogs");
if(ret) {
select_result = true;
}
//check that map file exists
if(!flipper_format_file_open_existing(fff_data_file, string_get_cstr(file_name))) {
if(!flipper_format_file_open_existing(fff_data_file, string_get_cstr(file_name)) &&
!select_result) {
FURI_LOG_I(TAG, "Could not open MAP file %s", string_get_cstr(file_name));
legacy = 1;
} else {
legacy = 0;
//Filename Assignment/Check Start
//assign variables to values within map file
@ -354,199 +365,6 @@ void unirfremix_cfg_set_check(UniRFRemix* app) {
flipper_format_free(fff_data_file);
furi_record_close("storage");
if(legacy == 1) {
//check if legacy map exists (universal_rf_map)
string_set(file_name, "/any/subghz/assets/universal_rf_map");
storage = furi_record_open("storage");
fff_data_file = flipper_format_file_alloc(storage);
if(!flipper_format_file_open_existing(fff_data_file, string_get_cstr(file_name))) {
FURI_LOG_I(TAG, "Could not open legacy MAP file %s", string_get_cstr(file_name));
app->file_result = 1;
} else {
//Filename Assignment/Check Start
//assign variables to values within map file
//set missing filenames to N/A
if(!flipper_format_read_string(fff_data_file, "UP", app->up_file)) {
FURI_LOG_I(TAG, "Could not read UP string");
//increment file_blank for processing later
app->file_blank++;
//set label to "N/A"
app->up_label = "N/A";
//disable the ability to process the signal on button press
app->up_enabled = 0;
FURI_LOG_I(TAG, "Up_Enabled: %d", app->up_enabled);
} else {
//check name length for proper screen fit
//then set filename as label. Might be replaced with defined label later on below.
app->up_label = extract_filename(string_get_cstr(app->up_file), label_len);
FURI_LOG_I(TAG, "UP file: %s", string_get_cstr(app->up_file));
}
//Repeat process for Down
if(!flipper_format_read_string(fff_data_file, "DOWN", app->down_file)) {
FURI_LOG_I(TAG, "Could not read DOWN string");
app->file_blank++;
app->down_label = "N/A";
app->down_enabled = 0;
FURI_LOG_I(TAG, "Down_Enabled: %d", app->down_enabled);
} else {
app->down_label = extract_filename(string_get_cstr(app->down_file), label_len);
FURI_LOG_I(TAG, "DOWN file: %s", string_get_cstr(app->down_file));
}
//Repeat process for Left
if(!flipper_format_read_string(fff_data_file, "LEFT", app->left_file)) {
FURI_LOG_I(TAG, "Could not read LEFT string");
app->file_blank++;
app->left_label = "N/A";
app->left_enabled = 0;
FURI_LOG_I(TAG, "Left_Enabled: %d", app->left_enabled);
} else {
app->left_label = extract_filename(string_get_cstr(app->left_file), label_len);
FURI_LOG_I(TAG, "LEFT file: %s", string_get_cstr(app->left_file));
}
//Repeat process for Right
if(!flipper_format_read_string(fff_data_file, "RIGHT", app->right_file)) {
FURI_LOG_I(TAG, "Could not read RIGHT string");
app->file_blank++;
app->right_label = "N/A";
app->right_enabled = 0;
FURI_LOG_I(TAG, "Right_Enabled: %d", app->right_enabled);
} else {
app->right_label = extract_filename(string_get_cstr(app->right_file), label_len);
FURI_LOG_I(TAG, "RIGHT file: %s", string_get_cstr(app->right_file));
}
//Repeat process for Ok
if(!flipper_format_read_string(fff_data_file, "OK", app->ok_file)) {
FURI_LOG_I(TAG, "Could not read OK string");
app->file_blank++;
app->ok_label = "N/A";
app->ok_enabled = 0;
FURI_LOG_I(TAG, "Ok_Enabled: %d", app->ok_enabled);
} else {
app->ok_label = extract_filename(string_get_cstr(app->ok_file), label_len);
FURI_LOG_I(TAG, "OK file: %s", string_get_cstr(app->ok_file));
}
//File definitions are done.
//File checks will follow after label assignment in order to close the universal_rf_map file without the need to reopen it again.
//Label Assignment/Check Start
//assign variables to values within map file
if(!flipper_format_read_string(fff_data_file, "ULABEL", app->up_l)) {
FURI_LOG_I(TAG, "Could not read ULABEL string");
//if Up button is disabled, set the label to "N/A";
if(app->up_enabled == 0) {
app->up_label = "N/A";
}
} else {
//check if button is disabled, and set label to "N/A" from missing map definition above
if(app->up_enabled == 0) {
app->up_label = "N/A";
} else {
//set label from map to variable and shrink to fit screen
app->up_label = char_to_str((char*)string_get_cstr(app->up_l), label_len);
}
FURI_LOG_I(TAG, "UP label: %s", app->up_label);
}
if(!flipper_format_read_string(fff_data_file, "DLABEL", app->down_l)) {
FURI_LOG_I(TAG, "Could not read DLABEL string");
if(app->down_enabled == 0) {
app->down_label = "N/A";
}
} else {
if(app->down_enabled == 0) {
app->down_label = "N/A";
} else {
app->down_label = char_to_str((char*)string_get_cstr(app->down_l), label_len);
}
FURI_LOG_I(TAG, "DOWN label: %s", app->down_label);
}
if(!flipper_format_read_string(fff_data_file, "LLABEL", app->left_l)) {
FURI_LOG_I(TAG, "Could not read LLABEL string");
if(app->left_enabled == 0) {
app->left_label = "N/A";
}
} else {
if(app->left_enabled == 0) {
app->left_label = "N/A";
} else {
app->left_label = char_to_str((char*)string_get_cstr(app->left_l), label_len);
}
FURI_LOG_I(TAG, "LEFT label: %s", app->left_label);
}
if(!flipper_format_read_string(fff_data_file, "RLABEL", app->right_l)) {
FURI_LOG_I(TAG, "Could not read RLABEL string");
if(app->right_enabled == 0) {
app->right_label = "N/A";
}
} else {
if(app->right_enabled == 0) {
app->right_label = "N/A";
} else {
app->right_label =
char_to_str((char*)string_get_cstr(app->right_l), label_len);
}
FURI_LOG_I(TAG, "RIGHT label: %s", app->right_label);
}
if(!flipper_format_read_string(fff_data_file, "OKLABEL", app->ok_l)) {
FURI_LOG_I(TAG, "Could not read OKLABEL string");
if(app->ok_enabled == 0) {
app->ok_label = "N/A";
}
} else {
if(app->ok_enabled == 0) {
app->ok_label = "N/A";
} else {
app->ok_label = char_to_str((char*)string_get_cstr(app->ok_l), label_len);
}
FURI_LOG_I(TAG, "OK label: %s", app->ok_label);
}
app->file_result = 4;
}
flipper_format_free(fff_data_file);
furi_record_close("storage");
}
//File Existence Check
//Check each file definition if not already set to "N/A"
@ -658,6 +476,8 @@ void unirfremix_cfg_set_check(UniRFRemix* app) {
app->file_result = 4;
}
}
string_clear(file_name);
}
static void unirfremix_end_send(UniRFRemix* app) {
@ -779,19 +599,19 @@ static void render_callback(Canvas* canvas, void* ctx) {
//If map is missing
canvas_clear(canvas);
canvas_set_font(canvas, FontPrimary);
canvas_draw_str_aligned(canvas, 62, 5, AlignCenter, AlignTop, "Config file missing.");
canvas_draw_str_aligned(canvas, 62, 5, AlignCenter, AlignTop, "Map file is missing!");
canvas_set_font(canvas, FontSecondary);
canvas_draw_str_aligned(canvas, 62, 25, AlignCenter, AlignTop, "Please configure");
canvas_draw_str_aligned(canvas, 62, 35, AlignCenter, AlignTop, "universal_rf_map");
canvas_draw_str_aligned(canvas, 62, 25, AlignCenter, AlignTop, "Please create");
canvas_draw_str_aligned(canvas, 62, 35, AlignCenter, AlignTop, "map file.");
canvas_draw_str_aligned(canvas, 62, 60, AlignCenter, AlignBottom, "Hold Back to Exit.");
} else if(app->file_result == 2) {
//if map has no valid filenames defined
canvas_clear(canvas);
canvas_set_font(canvas, FontPrimary);
canvas_draw_str_aligned(canvas, 62, 5, AlignCenter, AlignTop, "Config is incorrect.");
canvas_draw_str_aligned(canvas, 62, 5, AlignCenter, AlignTop, "Invalid map file!");
canvas_set_font(canvas, FontSecondary);
canvas_draw_str_aligned(canvas, 62, 25, AlignCenter, AlignTop, "Please configure");
canvas_draw_str_aligned(canvas, 62, 35, AlignCenter, AlignTop, "universal_rf_map");
canvas_draw_str_aligned(canvas, 62, 25, AlignCenter, AlignTop, "Please reconfigure");
canvas_draw_str_aligned(canvas, 62, 35, AlignCenter, AlignTop, "your map file.");
canvas_draw_str_aligned(canvas, 62, 60, AlignCenter, AlignBottom, "Hold Back to Exit.");
} else if(app->file_result == 3) {
//if map has no valid filenames defined

View file

@ -1,5 +1,5 @@
V:0
T:1659108089
T:1659115697
D:badusb
D:dolphin
D:infrared
@ -7,6 +7,7 @@ D:music_player
D:nfc
D:subghz
D:u2f
D:unirf
F:0e41ba26498b7511d7c9e6e6b5e3b149:1592:badusb/demo_macos.txt
F:e538ad2ce5a06ec45e1b5b24824901b1:1552:badusb/demo_windows.txt
D:dolphin/L1_Boxing_128x64
@ -237,7 +238,7 @@ F:111d2b8df83e27fd889fc5e270297865:3231:subghz/assets/keeloq_mfcodes
F:9214f9c10463b746a27e82ce0b96e040:465:subghz/assets/keeloq_mfcodes_user
F:653bd8d349055a41e1152e557d4a52d3:202:subghz/assets/nice_flor_s
F:b6ecaec5fcf45411622d4309c5769009:1590:subghz/assets/setting_user
F:9a50dd284146dfbd8050a2ade62174d9:266:subghz/assets/universal_rf_map
D:u2f/assets
F:7e11e688e39034bbb9d88410044795e1:365:u2f/assets/cert.der
F:f60b88c20ed479ed9684e249f7134618:264:u2f/assets/cert_key.u2f
F:05d7b8afac3c050c6d3dcefcf921f010:221:unirf/unirf_map_example.txt

View file

@ -1,5 +1,3 @@
Filetype: Flipper SubGhz RAW File
Version: 1
UP: /ext/subghz/Up.sub
DOWN: /ext/subghz/Down.sub
LEFT: /ext/subghz/Left.sub

View file

@ -1,32 +1,31 @@
# UniRF Remix
### The UniRF Tool *requires* the following manual changes be made to the `universal_rf_map` file in the `subghz/assets` folder located on the sdcard.
### The UniRF Tool *requires* the creation of custom user map with `.txt` extension in the `unirf` folder on the sdcard.
#### If these custom changes are not made, **you will receive an error each time you try to run the UniRF Tool**.
#### If these files are not exist or not configured properly, **you will receive an error each time you try to select wrong file in the UniRF Tool**.
## You can add as many `.txt` map files as you want, file name doesn't matter!
### App currenty works only with RAW subghz files
## Incorrect or unconfigured file error
If the `universal_rf_map` file has not been properly configured, the following error will be thrown when trying to run the UniRF Remix app:
If the `.txt` file has not been properly configured, the following error will be thrown when trying to run the UniRF Remix app:
```
Config is incorrect.
Invalid map file!
Please configure
universal_rf_map
Please reconfigure
your map file.
Hold Back to Exit
```
### **Update: Now you can create file with `.txt` extension `subghz/assets/universal_rf_map.txt`**
#### **So it can be edited without PC, app looks for this file first, if no `universal_rf_map.txt` file found, standard file will be used**
## Setting up the `subghz/assets/universal_rf_map` file:
## Setting up the `unirf/example.txt` file:
```
Filetype: Flipper SubGhz RAW File
Version: 1
UP: /ext/subghz/Up.sub
DOWN: /ext/subghz/Down.sub
LEFT: /ext/subghz/Left.sub
@ -46,8 +45,6 @@ The ULABEL/DLABEL/LLABEL/RLABEL/OKLABEL variables should be set to the text to b
## Example:
```
Filetype: Flipper SubGhz RAW File
Version: 1
UP: /ext/subghz/Fan1.sub
DOWN: /ext/subghz/Fan2.sub
LEFT: /ext/subghz/Door.sub
@ -69,9 +66,6 @@ OKLABEL: Garage CLOSE
- No skip function.
* ##### Universal RF Map
- Backwards compatible with [jimilinuxguy Universal RF Remote](https://github.com/jimilinuxguy/flipperzero-universal-rf-remote) map file. You should be able to use the map file as is with both versions.
- Recommend that you update the map file (if you using "jimilinuxguy's Universal RF" file) to the version included in this repo.
- You can also create file with `.txt` extension `subghz/assets/universal_rf_map.txt` and this file will be used instead of default file
- File path should not have any spaces or special characters (- and _ excluded).
- Labels are limited to 12 characters.
- Why? This is to prevent overlapping elements on screen.