Skip to content

Commit

Permalink
update xremote
Browse files Browse the repository at this point in the history
  • Loading branch information
xMasterX committed Mar 20, 2024
1 parent 83d7bdd commit 61bbee6
Show file tree
Hide file tree
Showing 14 changed files with 359 additions and 55 deletions.
60 changes: 55 additions & 5 deletions non_catalog_apps/xremote/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<p align="center">Advanced IR Remote App for Flipper Device</p>

<p align="center">
Version 1.3 - <a href="https://github.com/kala13x/flipper-xremote/blob/main/docs/changelog.md">Changelog</a>
</p>

<p align="center">
<img src="https://github.com/kala13x/flipper-xremote/blob/main/screens/flipperzero.png" alt="XRemote">
<img src="https://github.com/kala13x/flipper-xremote/blob/main/.flipcorg/banner.png" alt="XRemote">
</p>

## Idea
Expand Down Expand Up @@ -31,6 +36,7 @@ The application is compatible with standard `.ir` files. However, to ensure func
Button name | Description
------------|-------------------
`Power` | Power
`Eject` | Eject
`Setup` | Setup/Settings
`Input` | Input/Source
`Menu` | Menu
Expand All @@ -57,12 +63,52 @@ Button name | Description
`Play` | Play
`Stop` | Stop

## Alternative button names
In addition to the predefined names, `XRemote` uses alternative button names to make it as easy as possible to interact with different types of IR dumps. That means if a button with the appropriate name is not found in the file, the application will try to find the same button with alternative names. Ensure this feature is enabled in the application settings before you use it.

The application stores and reads alternate names from the following file:
```
SD Card/apps_data/flipper_xremote/alt_names.txt
```

If the `Alt-Names` option is enabled in the config and the file does not exist, it will be created automatically with default values during the application's startup. You can edit, add, or remove any button or alternate name values from this file. Button names must either have only the first uppercase or be entirely lowercase. As for alternate names, they are case-insensitive. The button can have one or several comma-separated alternate names.

This is the default `alt_names.txt` file:

```
Filetype: XRemote Alt-Names
Version: 1
#
Power: shutdown,off,on,standby
Setup: settings,config,cfg
Input: source,select
Menu: osd,gui
List: guide
Info: display
Mode: aspect,format
Back: return,exit
Ok: enter,select
Up: uparrow
Down: downarrow
Left: leftarrow
Right: rightarrow
Mute: silence,silent,unmute
Vol_up: vol+,volume+,volup,+
Vol_dn: vol-,volume-,voldown,-
Ch_next: ch+,channel+,chup
Ch_prev: ch-,channel-,chdown
Next: next,skip,ffwd
Prev: prev,back,rewind,rew
Fast_fo: fastfwd,fastforward,ff
Fast_ba: fastback,fastrewind,fb
Play_pa: playpause,play,pause
```

## Installation options

1. Install the latest stable version directly from the [application catalog](https://lab.flipper.net/apps/flipper_xremote).

2. Manually install using `.fap` file:
1. Install the latest stable version directly from the official [application catalog](https://lab.flipper.net/apps/flipper_xremote).
2. Install on any firmware from the community driven application catalog [FlipC](https://flipc.org/kala13x/flipper-xremote).
3. Manually install using `.fap` file:
- Download the `.fap` file from the [Releases](https://github.com/kala13x/flipper-xremote/releases) section of this repository.
- Write the `.fap` file to an SD card using [qFlipper](https://docs.flipper.net/qflipper) or any your preferred SD card writer.

Expand All @@ -73,8 +119,10 @@ Button name | Description
- Use deploy script from this repository to build and run the application on the device:

```bash
./deploy.sh --fw=/path/to/the/firmware
./deploy.sh --fw=/path/to/the/firmware -b -l
```

Do not use `-l` (link) option of you are building the project directly from the `applications_user` directory of the firmware.
2. If you don't have the firmware or the Linux please refer to the [official documentation](https://github.com/flipperdevices/flipperzero-firmware/blob/dev/documentation/AppsOnSDCard.md) for build instructions.
## Progress
Expand All @@ -89,6 +137,7 @@ Button name | Description
- [x] Player buttons page
- [x] Custom buttons page
- [x] Edit custom layout
- [x] Alternative button names
- [ ] Add or remove button
- [ ] All buttons page
- [x] Application settings
Expand All @@ -98,6 +147,7 @@ Button name | Description
- [x] Vertical/horizontal views
- [x] IR command repeat count
- [x] Exit button behavior
- [x] Enable/disable alt names
## Screens
Expand Down
2 changes: 1 addition & 1 deletion non_catalog_apps/xremote/application.fam
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ App(
requires=["gui", "dialogs", "infrared"],
stack_size=3 * 1024,
order=1,
fap_version="1.1",
fap_version="1.3",
fap_category="Infrared",
fap_icon_assets="assets",
fap_icon_assets_symbol="xc",
Expand Down
37 changes: 37 additions & 0 deletions non_catalog_apps/xremote/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,40 @@ Play_pa | Play/Pause
Pause | Pause
Play | Play
Stop | Stop

## Alternative button names

In addition to the predefined names, XRemote uses alternative button names to make it as easy as possible to interact with different types of IR dumps. That means if a button with the appropriate name is not found in the file, the application will try to find the same button with alternative names. Ensure this feature is enabled in the application settings before you use it.

The application stores and reads alternate names from the following file:
SD_Card/apps_data/flipper_xremote/alt_names.txt

If the Alt-Names option is enabled in the config and the file does not exist, it will be created automatically with default values during the application's startup. You can edit, add, or remove any button or alternate name values from this file. Button names must either have only the first uppercase or be entirely lowercase. As for alternate names, they are case-insensitive. The button can have one or several comma-separated alternate names.

## Default alternative names

Button name | Alternative names
------------|-------------------
Power | shutdown,off,on,standby
Setup | settings,config,cfg
Input | source,select
Menu | osd,gui
List | guide
Info | display
Mode | aspect,format
Back | return,exit
Ok | enter,select
Up | uparrow
Down | downarrow
Left | leftarrow
Right | rightarrow
Mute | silence,silent,unmute
Vol_up | vol+,volume+,volup,+
Vol_dn | vol-,volume-,voldown,-
Ch_next | ch+,channel+,chup
Ch_prev | ch-,channel-,chdown
Next | next,skip,ffwd
Prev | prev,back,rewind,rew
Fast_fo | fastfwd,fastforward,ff
Fast_ba | fastback,fastrewind,fb
Play_pa | playpause,play,pause
17 changes: 17 additions & 0 deletions non_catalog_apps/xremote/docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
## v1.3

Alternative names

- Implemented alternative names functionality
- Implemented case-insensitive button search
- Added Eject button support
- Fixed bugs and refactored code

## v1.2

Bug fixing and performance improvements

- Fixed build issues with new Flipper Zero SDK
- Fixed several crashes and refactored code
- Improved button search performance

## v1.1

Custom layout and bug fixing
Expand Down
11 changes: 7 additions & 4 deletions non_catalog_apps/xremote/infrared/infrared_remote.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#include <stddef.h>
#include <stdlib.h>
#include <m-array.h>
#include <string.h>
#include <ctype.h>
#include <toolbox/path.h>
#include <storage/storage.h>
#include <core/common_defines.h>
Expand Down Expand Up @@ -89,7 +91,9 @@ InfraredRemoteButton* infrared_remote_get_button(InfraredRemote* remote, size_t
bool infrared_remote_find_button_by_name(InfraredRemote* remote, const char* name, size_t* index) {
for(size_t i = 0; i < InfraredButtonArray_size(remote->buttons); i++) {
InfraredRemoteButton* button = *InfraredButtonArray_get(remote->buttons, i);
if(!strcmp(infrared_remote_button_get_name(button), name)) {
FuriString* furi_name = infrared_remote_button_get_furi_name(button);

if(button && !furi_string_cmpi_str(furi_name, name)) {
*index = i;
return true;
}
Expand All @@ -101,9 +105,8 @@ InfraredRemoteButton*
infrared_remote_get_button_by_name(InfraredRemote* remote, const char* name) {
for(size_t i = 0; i < InfraredButtonArray_size(remote->buttons); i++) {
InfraredRemoteButton* button = *InfraredButtonArray_get(remote->buttons, i);
if(!strcmp(infrared_remote_button_get_name(button), name)) {
return button;
}
FuriString* furi_name = infrared_remote_button_get_furi_name(button);
if(button && !furi_string_cmpi_str(furi_name, name)) return button;
}
return NULL;
}
Expand Down
8 changes: 7 additions & 1 deletion non_catalog_apps/xremote/infrared/infrared_remote_button.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
https://github.com/DarkFlippers/unleashed-firmware
The original project is licensed under the GNU GPLv3
No modifications were made to this file.
Modifications made:
- Added function infrared_remote_button_get_furi_name()
*/

#include "infrared_remote_button.h"
Expand Down Expand Up @@ -36,6 +38,10 @@ const char* infrared_remote_button_get_name(InfraredRemoteButton* button) {
return furi_string_get_cstr(button->name);
}

FuriString* infrared_remote_button_get_furi_name(InfraredRemoteButton* button) {
return button->name;
}

void infrared_remote_button_set_signal(InfraredRemoteButton* button, InfraredSignal* signal) {
infrared_signal_set_signal(button->signal, signal);
}
Expand Down
5 changes: 4 additions & 1 deletion non_catalog_apps/xremote/infrared/infrared_remote_button.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
https://github.com/DarkFlippers/unleashed-firmware
The original project is licensed under the GNU GPLv3
No modifications were made to this file.
Modifications made:
- Added function infrared_remote_button_get_furi_name()
*/

#pragma once
Expand All @@ -17,6 +19,7 @@ void infrared_remote_button_free(InfraredRemoteButton* button);

void infrared_remote_button_set_name(InfraredRemoteButton* button, const char* name);
const char* infrared_remote_button_get_name(InfraredRemoteButton* button);
FuriString* infrared_remote_button_get_furi_name(InfraredRemoteButton* button);

void infrared_remote_button_set_signal(InfraredRemoteButton* button, InfraredSignal* signal);
InfraredSignal* infrared_remote_button_get_signal(InfraredRemoteButton* button);
Loading

0 comments on commit 61bbee6

Please sign in to comment.