Skip to content

Commit

Permalink
Merge remote-tracking branch 'mntm/dev' into mntm-pr-42
Browse files Browse the repository at this point in the history
  • Loading branch information
Willy-JL committed Jan 21, 2025
2 parents 54176bb + b83dbad commit 012329e
Show file tree
Hide file tree
Showing 472 changed files with 43,734 additions and 12,962 deletions.
11 changes: 6 additions & 5 deletions cli_bridge/cli_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ static void tx_handler(const uint8_t* buffer, size_t size) {
furi_stream_buffer_send(cli_tx_stream, buffer, size, FuriWaitForever);
}

static void tx_handler_stdout(const char* buffer, size_t size) {
static void tx_handler_stdout(const char* buffer, size_t size, void* context) {
UNUSED(context);
tx_handler((const uint8_t*)buffer, size);
}

Expand All @@ -32,9 +33,9 @@ static size_t real_rx_handler(uint8_t* buffer, size_t size, uint32_t timeout) {
rx_cnt += len;
}
if(restore_tx_stdout) {
furi_thread_set_stdout_callback(cli_vcp.tx_stdout);
furi_thread_set_stdout_callback(cli_vcp.tx_stdout, NULL);
} else {
furi_thread_set_stdout_callback(tx_handler_stdout);
furi_thread_set_stdout_callback(tx_handler_stdout, NULL);
}
return rx_cnt;
}
Expand Down Expand Up @@ -87,7 +88,7 @@ void clicontrol_hijack(size_t tx_size, size_t rx_size) {
cli_session_close(global_cli);
restore_tx_stdout = false;
cli_session_open(global_cli, session);
furi_thread_set_stdout_callback(prev_stdout);
furi_thread_set_stdout_callback(prev_stdout, NULL);

furi_record_close(RECORD_CLI);
}
Expand Down Expand Up @@ -134,7 +135,7 @@ void clicontrol_unhijack(bool persist) {
FuriThreadStdoutWriteCallback prev_stdout = furi_thread_get_stdout_callback();
cli_session_close(global_cli);
cli_session_open(global_cli, &cli_vcp);
furi_thread_set_stdout_callback(prev_stdout);
furi_thread_set_stdout_callback(prev_stdout, NULL);
furi_record_close(RECORD_CLI);

// Unblock waiting rx handler, restore old cli_vcp.tx_stdout
Expand Down
2 changes: 1 addition & 1 deletion cntdown_timer/application.fam
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ App(
fap_category="Tools",
fap_author="@0w0mewo",
fap_weburl="https://github.com/0w0mewo/fpz_cntdown_timer",
fap_version="1.4",
fap_version="1.5",
fap_description="Simple count down timer",
)
2 changes: 1 addition & 1 deletion cntdown_timer/views/countdown_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#define SCREEN_CENTER_X (SCREEN_WIDTH / 2)
#define SCREEN_CENTER_Y (SCREEN_HEIGHT / 2)

#define INIT_COUNT 10
#define INIT_COUNT 60

typedef enum {
CountDownTimerMinuteUp,
Expand Down
2 changes: 1 addition & 1 deletion color_guess/application.fam
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ App(
order=10,
fap_icon="icons/color_guess_10px.png",
fap_icon_assets="icons",
fap_version="1.5",
fap_version="1.6",
fap_category="Games",
fap_author="Leedave",
fap_description="Color Guessing Game",
Expand Down
7 changes: 0 additions & 7 deletions color_guess/changelog.md

This file was deleted.

5 changes: 0 additions & 5 deletions color_guess/color_guess.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ ColorGuess* color_guess_app_alloc() {
ColorGuess* app = malloc(sizeof(ColorGuess));
app->gui = furi_record_open(RECORD_GUI);
app->notification = furi_record_open(RECORD_NOTIFICATION);
app->error = false;

// Set Defaults if no config exists
app->haptic = 1;
Expand All @@ -38,7 +37,6 @@ ColorGuess* color_guess_app_alloc() {

//Scene additions
app->view_dispatcher = view_dispatcher_alloc();

app->scene_manager = scene_manager_alloc(&color_guess_scene_handlers, app);
view_dispatcher_set_event_callback_context(app->view_dispatcher, app);
view_dispatcher_set_navigation_event_callback(
Expand Down Expand Up @@ -112,9 +110,6 @@ void color_guess_app_free(ColorGuess* app) {
int32_t color_guess_app(void* p) {
UNUSED(p);
ColorGuess* app = color_guess_app_alloc();
if(app->error) {
return 255;
}

view_dispatcher_attach_to_gui(app->view_dispatcher, app->gui, ViewDispatcherTypeFullscreen);

Expand Down
9 changes: 1 addition & 8 deletions color_guess/color_guess.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include "views/color_guess_startscreen.h"
#include "helpers/color_guess_storage.h"

#define COLOR_GUESS_VERSION "1.5"
#define COLOR_GUESS_VERSION "1.6"
#define TAG "Color_Guess"

typedef struct {
Expand All @@ -32,9 +32,7 @@ typedef struct {
ColorGuessPlay* color_guess_play;
ColorGuessStartscreen* color_guess_startscreen;
Submenu* color_guess_settings;
bool error;
uint32_t haptic;
//uint32_t speaker;
uint32_t led;
uint32_t save_settings;
} ColorGuess;
Expand All @@ -52,11 +50,6 @@ typedef enum {
ColorGuessHapticOn,
} ColorGuessHapticState;

typedef enum {
ColorGuessSpeakerOff,
ColorGuessSpeakerOn,
} ColorGuessSpeakerState;

typedef enum {
ColorGuessLedOff,
ColorGuessLedOn,
Expand Down
21 changes: 13 additions & 8 deletions color_guess/docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
## 1.5
## v1.6
- Reducing code
- Removal of deprecated view dispatcher queue

## v1.5
- Additional Memory Management fixes by Willy-JL
- Redraw Issue fixed by Willy-JL
- Added GNU License
- Added version number

## 1.4
- Prevent value changing on win view
- Fix issues with FW build 0.99.x
## v1.4
- Compatibility for FW above 0.99.0
- Fix for Value changing on success screen

## 1.3
- Patched Memory Leak in storage
## v1.3
- Fixed minor memory leak in storage

## v1.2
- Updated compatibility to 0.95.0-rc
- Updated Application for Flipper Zero 0.95.0-rc

## v1.1
- Updated Launch Screen GFX

Added GFX to start screen

## v1.0

Expand Down
33 changes: 1 addition & 32 deletions color_guess/scenes/color_guess_scene_settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,12 @@ const char* const haptic_text[2] = {
"OFF",
"ON",
};

const uint32_t haptic_value[2] = {
ColorGuessHapticOff,
ColorGuessHapticOn,
};

/* Speaker currently not used
const char* const speaker_text[2] = {
"OFF",
"ON",
};
const uint32_t speaker_value[2] = {
ColorGuessSpeakerOff,
ColorGuessSpeakerOn,
};
*/

/* Game doesn't make sense with LED off, but the setting is there */
const char* const led_text[2] = {
"OFF",
Expand All @@ -45,15 +35,6 @@ static void color_guess_scene_settings_set_haptic(VariableItem* item) {
app->haptic = haptic_value[index];
}

/*
static void color_guess_scene_settings_set_speaker(VariableItem* item) {
ColorGuess* app = variable_item_get_context(item);
uint8_t index = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, speaker_text[index]);
app->speaker = speaker_value[index];
}
*/

static void color_guess_scene_settings_set_led(VariableItem* item) {
ColorGuess* app = variable_item_get_context(item);
uint8_t index = variable_item_get_current_value_index(item);
Expand All @@ -78,18 +59,6 @@ void color_guess_scene_settings_on_enter(void* context) {
variable_item_set_current_value_index(item, value_index);
variable_item_set_current_value_text(item, haptic_text[value_index]);

// Sound on/off
/*
item = variable_item_list_add(
app->variable_item_list,
"Sound:",
2,
color_guess_scene_settings_set_speaker,
app);
value_index = value_index_uint32(app->speaker, speaker_value, 2);
variable_item_set_current_value_index(item, value_index);
variable_item_set_current_value_text(item, speaker_text[value_index]);*/

// LED Effects on/off
item = variable_item_list_add(
app->variable_item_list, "LED FX:", 2, color_guess_scene_settings_set_led, app);
Expand Down
9 changes: 9 additions & 0 deletions cross_remote/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
dist/*
.vscode
.clang-format
.clangd
.editorconfig
.env
.ufbt
.clang-format
.vscode/settings.json
6 changes: 6 additions & 0 deletions cross_remote/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Wouldn't it be nicer to simply click one button and let everything happen? This
- Save chained commands to a file<br>
- Add pauses, becaue target systems are not always fast enough for multiple commands<br>
- Run file containing chained IR & SubGhz commands<br>
- Loop Transmissions until quit

### Settings
- LED FX, allow the LED to blink
Expand All @@ -52,5 +53,10 @@ Then run the command:
```
The application will be compiled and copied onto your device.

## Thank you notes
- [Willy-JL](https://github.com/Willy-JL) for distributing in Momentum Firmware
- [Roguemaster](https://github.com/RogueMaster/flipperzero-firmware-wPlugins) for distributing in Roguemaster Firmware
- [Miccayo](https://github.com/miccayo) for contributing the loop transmit feature

## Licensing
This code is open-source and may be used for whatever you want to do with it.
2 changes: 1 addition & 1 deletion cross_remote/application.fam
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ App(
stack_size=3 * 1024,
fap_icon="icons/xremote_10px.png",
fap_icon_assets="icons",
fap_version="2.7",
fap_version="3.0",
fap_category="Infrared",
fap_author="Leedave",
fap_description="One-Click, sends multiple commands",
Expand Down
1 change: 1 addition & 0 deletions cross_remote/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ This app combines your IR and SubGhz commands into a playlist that can be run wi
- Disable LED effects if not wanted
- Configure duration of IR Signals
- Configure default duration of Encoded SubGhz Signals
- Loop Transmissions until quit

## What good is this?

Expand Down
8 changes: 8 additions & 0 deletions cross_remote/docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 3.0
- Added loop transmit feature (thanks to miccayo)
- Replaced transmission counter with animations
- Refactored the transmission part to allow interruption of command chains

## 2.8
- Update SubGhz Protocoll to include flippers official rolling code support

## 2.7
- Replaced custom keyboard for timing with new number_input from Firmware
- Requires minimum OFW version 0.105.0 or custom firmware based on this
Expand Down
1 change: 1 addition & 0 deletions cross_remote/helpers/subghz/subghz.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ SubGhz* subghz_alloc() {

subghz->file_path = furi_string_alloc();
subghz->txrx = subghz_txrx_alloc();
subghz_txrx_set_need_save_callback(subghz->txrx, subghz_save_to_file, subghz);
subghz->dialogs = furi_record_open(RECORD_DIALOGS);

return subghz;
Expand Down
58 changes: 56 additions & 2 deletions cross_remote/helpers/subghz/subghz_i.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,60 @@ SubGhzLoadTypeFile subghz_get_load_type_file(SubGhz* subghz) {
return subghz->load_type_file;
}

bool subghz_save_protocol_to_file(
SubGhz* subghz,
FlipperFormat* flipper_format,
const char* dev_file_name) {
furi_assert(subghz);
furi_assert(flipper_format);
furi_assert(dev_file_name);

Storage* storage = furi_record_open(RECORD_STORAGE);
Stream* flipper_format_stream = flipper_format_get_raw_stream(flipper_format);

bool saved = false;
FuriString* file_dir = furi_string_alloc();

path_extract_dirname(dev_file_name, file_dir);
do {
//removing additional fields
flipper_format_delete_key(flipper_format, "Repeat");
flipper_format_delete_key(flipper_format, "Manufacture");

// Create subghz folder directory if necessary
if(!storage_simply_mkdir(storage, furi_string_get_cstr(file_dir))) {
dialog_message_show_storage_error(subghz->dialogs, "Cannot create\nfolder");
break;
}

if(!storage_simply_remove(storage, dev_file_name)) {
break;
}
stream_seek(flipper_format_stream, 0, StreamOffsetFromStart);
stream_save_to_file(flipper_format_stream, storage, dev_file_name, FSOM_CREATE_ALWAYS);

if(storage_common_stat(storage, dev_file_name, NULL) != FSE_OK) {
break;
}

saved = true;
} while(0);
furi_string_free(file_dir);
furi_record_close(RECORD_STORAGE);
return saved;
}

void subghz_save_to_file(void* context) {
furi_assert(context);
SubGhz* subghz = context;
if(subghz_path_is_file(subghz->file_path)) {
subghz_save_protocol_to_file(
subghz,
subghz_txrx_get_fff_data(subghz->txrx),
furi_string_get_cstr(subghz->file_path));
}
}

bool subghz_load_protocol_from_file(SubGhz* subghz, const char* path) {
furi_assert(subghz);

Expand All @@ -214,9 +268,9 @@ bool subghz_load_protocol_from_file(SubGhz* subghz, const char* path) {
return ret;
}*/

/*bool subghz_path_is_file(FuriString* path) {
bool subghz_path_is_file(FuriString* path) {
return furi_string_end_with(path, SUBGHZ_APP_FILENAME_EXTENSION);
}*/
}

/*void subghz_lock(SubGhz* subghz) {
furi_assert(subghz);
Expand Down
7 changes: 7 additions & 0 deletions cross_remote/helpers/subghz/subghz_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "subghz_txrx.h"

#define SUBGHZ_MAX_LEN_NAME 64
#define SUBGHZ_APP_FILENAME_EXTENSION ".sub"

typedef struct SubGhz SubGhz;

Expand Down Expand Up @@ -67,6 +68,12 @@ struct SubGhz {
//void subghz_set_default_preset(SubGhz* subghz);
//void subghz_blink_start(SubGhz* subghz);
//void subghz_blink_stop(SubGhz* subghz);
bool subghz_save_protocol_to_file(
SubGhz* subghz,
FlipperFormat* flipper_format,
const char* dev_file_name);
void subghz_save_to_file(void* context);
bool subghz_path_is_file(FuriString* path);

// Used on Encoded SubGhz
bool subghz_tx_start(SubGhz* subghz, FlipperFormat* flipper_format);
Expand Down
Loading

0 comments on commit 012329e

Please sign in to comment.