Merge branch 'ul-dev' into xfw-dev

This commit is contained in:
Willy-JL
2023-04-07 23:40:28 +01:00
107 changed files with 3653 additions and 607 deletions
+32 -13
View File
@@ -386,17 +386,35 @@ bool subghz_remote_key_load(
FURI_LOG_E(TAG, "Could not read Protocol.");
break;
}
if(!furi_string_cmp_str(preset->protocol, "RAW")) {
subghz_protocol_raw_gen_fff_data(fff_data, path);
// repeat
if(!flipper_format_insert_or_update_uint32(fff_data, "Repeat", &preset->repeat, 1)) {
FURI_LOG_E(TAG, "Unable to insert or update Repeat");
break;
}
if(!flipper_format_rewind(fff_data)) {
FURI_LOG_E(TAG, "Rewind error");
return false;
}
} else {
stream_copy_full(
flipper_format_get_raw_stream(fff_file), flipper_format_get_raw_stream(fff_data));
// repeat
if(!flipper_format_insert_or_update_uint32(fff_data, "Repeat", &preset->repeat, 1)) {
FURI_LOG_E(TAG, "Unable to insert or update Repeat");
break;
}
if(!flipper_format_rewind(fff_data)) {
FURI_LOG_E(TAG, "Rewind error");
return false;
}
}
// repeat
if(!flipper_format_insert_or_update_uint32(fff_file, "Repeat", &preset->repeat, 1)) {
FURI_LOG_E(TAG, "Unable to insert or update Repeat");
break;
if(!flipper_format_rewind(fff_file)) {
FURI_LOG_E(TAG, "Rewind error");
return false;
}
preset->decoder = subghz_receiver_search_decoder_base_by_name(
@@ -435,9 +453,6 @@ bool subghz_remote_save_protocol_to_file(FlipperFormat* fff_file, const char* de
path_extract_dirname(dev_file_name, file_dir);
do {
flipper_format_delete_key(fff_file, "Repeat");
//flipper_format_delete_key(fff_file, "Manufacture");
if(!storage_simply_mkdir(storage, furi_string_get_cstr(file_dir))) {
FURI_LOG_E(TAG, "(save) Cannot mkdir");
break;
@@ -475,14 +490,18 @@ void subghz_remote_tx_stop(SubGHzRemote* app) {
//FURI_LOG_I(TAG, "TX Done!");
subghz_transmitter_stop(app->tx_transmitter);
FURI_LOG_D(TAG, "Checking if protocol is dynamic");
//FURI_LOG_D(TAG, "Checking if protocol is dynamic");
const SubGhzProtocolRegistry* protocol_registry_items =
subghz_environment_get_protocol_registry(app->environment);
const SubGhzProtocol* proto = subghz_protocol_registry_get_by_name(
protocol_registry_items, furi_string_get_cstr(app->txpreset->protocol));
FURI_LOG_D(TAG, "Protocol-TYPE %d", proto->type);
//FURI_LOG_D(TAG, "Protocol-TYPE %d", proto->type);
if(proto && proto->type == SubGhzProtocolTypeDynamic) {
FURI_LOG_D(TAG, "Protocol is dynamic. Saving key");
//FURI_LOG_D(TAG, "Protocol is dynamic. Saving key");
// Remove repeat if it was present
flipper_format_delete_key(app->tx_fff_data, "Repeat");
subghz_remote_save_protocol_to_file(app->tx_fff_data, app->tx_file_path);
keeloq_reset_mfname();
@@ -682,15 +701,15 @@ static void render_callback(Canvas* canvas, void* ctx) {
break;
case 2:
canvas_draw_icon(canvas, 113, 15, &I_Pin_cell_13x13);
canvas_draw_icon(canvas, 116, 17, &I_Pin_arrow_down_7x9);
canvas_draw_icon_ex(canvas, 116, 17, &I_Pin_arrow_up_7x9, IconRotation180);
break;
case 3:
canvas_draw_icon(canvas, 113, 15, &I_Pin_cell_13x13);
canvas_draw_icon(canvas, 115, 18, &I_Pin_arrow_right_9x7);
canvas_draw_icon_ex(canvas, 115, 18, &I_Pin_arrow_up_7x9, IconRotation90);
break;
case 4:
canvas_draw_icon(canvas, 113, 15, &I_Pin_cell_13x13);
canvas_draw_icon(canvas, 115, 18, &I_Pin_arrow_left_9x7);
canvas_draw_icon_ex(canvas, 115, 18, &I_Pin_arrow_up_7x9, IconRotation270);
break;
case 5:
canvas_draw_icon(canvas, 113, 15, &I_Pin_cell_13x13);