Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions applications/unirfremix/ReadMe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# UniRF Remix App
### Integrated into Flipper Zero Unleashed Firmware 0.58
------------
### Quick Start

- Grab DFU from [Releases](https://github.com/ESurge/flipperzero-firmware-unifxremix/Relases/latest)
- Flash onto Flipper Zero
- Edit [universal\_rf\_map](https://github.com/ESurge/flipperzero-firmware-unirfremix/blob/dev/assets/resources/subghz/assets/universal_rf_map) and upload to SD card under ```/subghz/assets``` folder
------------
### Custom Import

- UniRFRemix folder has the base code. Use ```unirfremix_app``` for ```applications.c```
- Icons used are located at ```assets/icons/UniRFRemix```
- Animated Icon used is located at ```assets/icons/MainMenu/UniRFRemix_14```
- Follow compilation instructions from [Flipper Devices Flipper Zero Firmware GitHub](https://github.com/flipperdevices/flipperzero-firmware)
------------
### Notes
* ##### App Usage
- Press a button to send the assigned capture file.
- Press Back button to set how many repeats the app should send. Capped at 5 repeats.
- Hold Back button to exit app.
- Only RAW SubGhz captures are supported currently.
- 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 to the version included in this repo.
- 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.
- For example: If you set your label or file to ```WWWWWWWWWWWWWWW``` you'll be over the screen limits.

* ##### Firmware
- Code based on the Unleashed firmware
- I modified the wav_player title in applications.c but that's all.

* ##### Issues
- If you find any issues, report them. I am not sure I can fix them, but I will try.
------------
### Screenshots
#### Main Menu:
![unirfremix_mainmenu](https://user-images.githubusercontent.com/982575/169637623-bc41cfa5-6433-4198-a970-8fce42691ad7.png)
#### Idle Screen:
- Repeat indictator is located at the bottom right

![unirfremix-idle](https://user-images.githubusercontent.com/982575/169639427-daef6274-2e38-4684-816a-14ba915aa051.png)

#### Sending Screen:
- Button pressed will highlight when sending
- LED indicator will flash

![unirfremix-sending](https://user-images.githubusercontent.com/982575/169639435-74bdeb9e-da58-4ada-b613-8c4f8f89ab46.png)

#### Invalid Map File:
- If you don't have at least one valid file path set in your ```universal_rf_map``` file, you'll see this screen

![unirfremix-invalidmap](https://user-images.githubusercontent.com/982575/169639438-f1b96944-42c4-476c-9fe2-233d174c6262.png)

#### Missing Map File:
- If you don't have the ```universal_rf_map``` file, you'll see this screen

![unirfremix-missingmap](https://user-images.githubusercontent.com/982575/169639439-6414c81a-3de9-4817-b9b5-235130fd0e56.png)

------------
### Backstory
I saw jimilinuxguy post an idea of having a TouchTunes/Jukebox remote app, and it was basically one screenshot and a link to a repo. At the time, I was reading the Hello World plugin tutorial and wanted to give coding a plugin a shot.

Using the Music_Player plugin as a starting point (instead of using the Hello World example) I began the journey. By referencing some of the code in Universal RF Remote app, I started to get a basic idea of how the Flipper Zero device works.

After a few days of coding, I managed to get the app running pretty good. I proceed with a layout change which helped me learn how to create/import images (as icons). Also, I implemented a few ideas/suggestions which were brought up by various users in the Flipper Devices Discord, and this project is now released.

------------
### Credits
- [Jimilinuxguy](https://github.com/jimilinuxguy) for code base reference and the initial idea
- "Red_Link2" for creating the D-Pad animation
- "Shitposter Simulator" for the idea of adding a notification message for flashing the LED
- A bunch of others for convincing me to release this and also for just being generally good people.
22 changes: 17 additions & 5 deletions applications/unirfremix/unirfremix_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,7 @@ void unirfremix_cfg_set_check(UniRFRemix* app) {
int label_len = 12;

//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))) {
FURI_LOG_I(TAG, "Could not open MAP file %s", string_get_cstr(file_name));
app->file_result = 1;
}
Expand Down Expand Up @@ -277,6 +276,9 @@ void unirfremix_cfg_set_check(UniRFRemix* app) {
//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.

//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
Expand Down Expand Up @@ -564,6 +566,9 @@ static void unirfremix_send_signal(
}

static void unirfremix_process_signal(UniRFRemix* app, string_t signal) {
osMutexRelease(app->model_mutex);
view_port_update(app->view_port);

FURI_LOG_I(TAG, "signal = %s", string_get_cstr(signal));

if(strlen(string_get_cstr(signal)) > 12) {
Expand Down Expand Up @@ -602,7 +607,7 @@ static void unirfremix_process_signal(UniRFRemix* app, string_t signal) {

static void render_callback(Canvas* canvas, void* ctx) {
UniRFRemix* app = ctx;
furi_check(osMutexAcquire(app->model_mutex, 25) == osOK);
furi_check(osMutexAcquire(app->model_mutex, osWaitForever) == osOK);

//setup different canvas settings
if(app->file_result == 1) {
Expand Down Expand Up @@ -694,7 +699,7 @@ UniRFRemix* unirfremix_alloc() {

app->model_mutex = osMutexNew(NULL);

app->input_queue = osMessageQueueNew(1, sizeof(InputEvent), NULL);
app->input_queue = osMessageQueueNew(32, sizeof(InputEvent), NULL);

app->view_port = view_port_alloc();
view_port_draw_callback_set(app->view_port, render_callback, app);
Expand Down Expand Up @@ -759,6 +764,10 @@ int32_t unirfremix_app(void* p) {
app->repeat = 1;
app->button = 0;

//refresh screen to update variables before processing main screen or error screens
osMutexRelease(app->model_mutex);
view_port_update(app->view_port);

//input detect loop start
InputEvent input;
while(1) {
Expand Down Expand Up @@ -892,6 +901,9 @@ int32_t unirfremix_app(void* p) {
view_port_update(app->view_port);
}
} else {
//refresh screen to update variables before processing main screen or error screens
view_port_update(app->view_port);

InputEvent input;
while(1) {
furi_check(osMessageQueueGet(app->input_queue, &input, NULL, osWaitForever) == osOK);
Expand Down Expand Up @@ -933,4 +945,4 @@ int32_t unirfremix_app(void* p) {
unirfremix_free(app);

return 0;
}
}