Skip to content

Commit

Permalink
Merge pull request #8 from leedave/feature/subghz_like_meal_pager
Browse files Browse the repository at this point in the history
Feature/subghz like meal pager
  • Loading branch information
leedave authored Jan 30, 2024
2 parents bb5e131 + 32041e2 commit ff25784
Show file tree
Hide file tree
Showing 42 changed files with 2,199 additions and 900 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

## Current State
- Infrared working
- SubGhz working
- Pause working
- SubGhz in Development
- Edit/Rename/Delete features in development
- IR Timing features in development

## What this is?
This app combines commands used in IR and SubGhz into playlists that can be run with one click
Expand All @@ -30,6 +30,10 @@ Wouldn't it be nicer to simply click one button and let everything happen? This
- Add pauses, becaue target systems are not always fast enough for multiple commands<br>
- Run file containing chained IR & SubGhz commands<br>

### Limitations
SubGhz commands will stop working if you move/rename/delete the original files on your Flipper. This is because
of how the Flippers SubGhz worker expects data.

## How to install on Flipper Zero
- If you do not have one, download a firmware<br>
- Plug your Flipper Zero in via USB. <br>
Expand Down
12 changes: 2 additions & 10 deletions application.fam
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,12 @@ App(
name="Cross Remote",
apptype=FlipperAppType.EXTERNAL,
entry_point="xremote_app",
cdefines=["APP_XREMOTE"],
requires=[
"gui",
"storage",
"dialogs",
],
stack_size=3 * 1024,
order=10,
fap_libs=["assets"],
fap_icon="icons/xremote_10px.png",
fap_icon_assets="icons",
fap_version="1.1",
fap_version="2.0",
fap_category="Infrared",
fap_author="Leedave",
fap_description="One-Click, sends multiple commands",
fap_weburl="https://github.com/leedave/Leeds-Flipper-Zero-Applications"
fap_weburl="https://github.com/leedave/flipper-zero-cross-remote"
)
6 changes: 2 additions & 4 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
## Cross Remote

This app combines your IR commands into a playlist that can be run with one click. Pauses can be set inbetween, as IR devices typically are not so fast.
This app combines your IR and SubGhz commands into a playlist that can be run with one click. Pauses can be set inbetween, as IR/SubGhz devices typically are not so fast.

## Features
- Read out commands you recorded in the IR app
- Read out commands you saved as .sub files
- Combine commands to a chain/playlist
- Add pauses inbetween commands
- Save your command chain / playlist to flipper
- Disable LED effects if not wanted
- Configure duration of IR Signals

## In Development
- Ability to also add SubGhz commands

## What good is this?

Example what you command chain (playlist) could do with one click
Expand Down
10 changes: 9 additions & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
## v2.0
- SubGhz Functionality added
- Slight change in Storage format to enalbe individual IR timings later (feature request)
- Fixed more memory leaks
- Fixed error where Flipper crashes after deleting a command chain
- Updated Manifest for better CFW support
- Updated readme for new inputs

## v1.1
- Patched Memory Leak in storage
- Patched memory leak in storage

## v1.0
- Added option to change IR Signal Timing
Expand Down
53 changes: 53 additions & 0 deletions helpers/subghz/subghz.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/* Reduced variant of the Flipper Zero SubGhz Class */

#include "subghz_i.h"
#include "../../helpers/xremote_custom_event.h"
#include "../../helpers/xremote_led.h"

SubGhz* subghz_alloc() {
SubGhz* subghz = malloc(sizeof(SubGhz));

subghz->file_path = furi_string_alloc();
subghz->txrx = subghz_txrx_alloc();

return subghz;
}

void subghz_free(SubGhz* subghz) {
subghz_txrx_free(subghz->txrx);
furi_string_free(subghz->file_path);

// The rest
free(subghz);
}

void subghz_scene_transmit_callback_end_tx(void* context) {
furi_assert(context);
FURI_LOG_D(TAG, "callback end");
XRemote* app = context;
view_dispatcher_send_custom_event(
app->view_dispatcher, XRemoteCustomEventViewTransmitterSendStop);

//app->state_notifications = SubGhzNotificationStateIDLE;
//subghz_txrx_stop(app->subghz->txrx);
//app->transmitting = false;
//xremote_scene_ir_notification_message(app, SubGhzNotificationMessageBlinkStop);
xremote_cross_remote_set_transmitting(app->cross_remote, XRemoteTransmittingStopSubghz);
}

void subghz_send(void* context, const char* path) {
XRemote* app = context;

subghz_load_protocol_from_file(app->subghz, path);
FURI_LOG_D(TAG, "Starting Transmission");
subghz_txrx_tx_start(
app->subghz->txrx,
subghz_txrx_get_fff_data(app->subghz->txrx)); //Seems like it must be done this way

FURI_LOG_D(TAG, "setting sugbhz raw file encoder worker callback");
subghz_txrx_set_raw_file_encoder_worker_callback_end(
app->subghz->txrx, subghz_scene_transmit_callback_end_tx, app);
app->state_notifications = SubGhzNotificationStateTx;

FURI_LOG_D(TAG, "Finished Transmitting");
}
9 changes: 9 additions & 0 deletions helpers/subghz/subghz.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#pragma once

#include "subghz_i.h"

typedef struct SubGhz SubGhz;

SubGhz* subghz_alloc();
void subghz_free(SubGhz* subghz);
void subghz_send(void* context, const char* path);
14 changes: 14 additions & 0 deletions helpers/subghz/subghz_error_type.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#pragma once

#include <furi.h>
#include <furi_hal.h>

/** SubGhzErrorType */
typedef enum {
SubGhzErrorTypeNoError = 0, /** There are no errors */
SubGhzErrorTypeParseFile =
1, /** File parsing error, or wrong file structure, or missing required parameters. more accurate data can be obtained through the debug port */
SubGhzErrorTypeOnlyRX =
2, /** Transmission on this frequency is blocked by regional settings */
SubGhzErrorTypeParserOthers = 3, /** Error in protocol parameters description */
} SubGhzErrorType;
Loading

0 comments on commit ff25784

Please sign in to comment.