Skip to content

Commit

Permalink
fixed nfc and unknown icons
Browse files Browse the repository at this point in the history
  • Loading branch information
rdefeo committed Apr 3, 2024
1 parent 560e958 commit 90297cb
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 20 deletions.
30 changes: 18 additions & 12 deletions actions/action_ir.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,18 @@ void action_ir_tx(void* context, const FuriString* action_path, FuriString* erro
break;
}

// FURI_LOG_I(
// TAG,
// "IR: Sending parsed => %s %lu %lu",
// infrared_get_protocol_name(signal->payload.message.protocol),
// signal->payload.message.address,
// signal->payload.message.command);
FURI_LOG_I(
TAG,
"IR: Sending (%s) type=parsed => %s %lu %lu",
file_name,
infrared_get_protocol_name(signal->payload.message.protocol),
signal->payload.message.address,
signal->payload.message.command);

infrared_send(&signal->payload.message, 1);

FURI_LOG_I(TAG, "IR: Send complete");

} else if(!furi_string_cmp_str(temp_str, "raw")) {
// FURI_LOG_I(TAG, "IR File is RAW");
signal->is_raw = true;
Expand Down Expand Up @@ -158,19 +161,22 @@ void action_ir_tx(void* context, const FuriString* action_path, FuriString* erro
break;
}

// FURI_LOG_I(
// TAG,
// "IR: Sending raw => %d timings, %lu Hz, %f",
// signal->payload.raw.timings_size,
// signal->payload.raw.frequency,
// (double)signal->payload.raw.duty_cycle);
FURI_LOG_I(
TAG,
"IR: Sending (%s) type=raw => %d timings, %lu Hz, %f",
file_name,
signal->payload.raw.timings_size,
signal->payload.raw.frequency,
(double)signal->payload.raw.duty_cycle);

infrared_send_raw_ext(
signal->payload.raw.timings,
signal->payload.raw.timings_size,
true,
signal->payload.raw.frequency,
signal->payload.raw.duty_cycle);

FURI_LOG_I(TAG, "IR: Send complete");
} else {
ACTION_SET_ERROR("IR: Unknown type: %s", furi_string_get_cstr(temp_str));
break;
Expand Down
2 changes: 1 addition & 1 deletion actions/action_rfid.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ void action_rfid_tx(void* context, const FuriString* action_path, FuriString* er
lfrfid_worker_emulate_start(worker, protocol);

int16_t time_ms = app->settings.rfid_duration;
FURI_LOG_I(TAG, "RFID: Emulating RFID (%s) for %d ms", file_name, time_ms);
FURI_LOG_I(TAG, "RFID: Emulating (%s) for %d ms", file_name, time_ms);
int16_t interval_ms = 100;
while(time_ms > 0) {
furi_delay_ms(interval_ms);
Expand Down
2 changes: 1 addition & 1 deletion application.fam
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ App(
stack_size=2 * 1024,
fap_category="Tools",
# Optional values
fap_version="0.5.1",
fap_version="0.6",
fap_icon="quac.png", # 10x10 1-bit PNG
fap_description="Quick Action remote control app",
fap_author="Roberto De Feo",
Expand Down
Binary file added images/Unknown_10px.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 11 additions & 5 deletions item.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,16 @@ ItemsView* item_get_items_view_from_path(void* context, const FuriString* input_

Item* item = ItemArray_push_new(iview->items);

// Action files have extensions, so item->ext starts with '.'
item->ext[0] = 0;
path_extract_extension(path, item->ext, MAX_EXT_LEN);
item->type = item_get_item_type_from_extension(item->ext);
FileInfo fileinfo;
if(storage_common_stat(app->storage, found_path, &fileinfo) == FSE_OK &&
file_info_is_dir(&fileinfo)) {
item->type = Item_Group;
} else {
// Action files have extensions, so item->ext starts with '.'
item->ext[0] = 0;
path_extract_extension(path, item->ext, MAX_EXT_LEN);
item->type = item_get_item_type_from_extension(item->ext);
}

item->name = furi_string_alloc();
path_extract_filename_no_ext(found_path, item->name);
Expand Down Expand Up @@ -147,7 +153,7 @@ void item_prettify_name(FuriString* name) {
}

ItemType item_get_item_type_from_extension(const char* ext) {
ItemType type = Item_Group;
ItemType type = Item_Unknown;

if(!strcmp(ext, ".sub")) {
type = Item_SubGhz;
Expand Down
1 change: 1 addition & 0 deletions item.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ typedef enum {
Item_Playlist,
Item_Group,
Item_Settings,
Item_Unknown,
Item_count
} ItemType;

Expand Down
2 changes: 1 addition & 1 deletion quac.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// #pragma GCC optimize("O0")

#define QUAC_NAME "Quac!"
#define QUAC_VERSION "v0.5.1"
#define QUAC_VERSION "v0.6"
#define QUAC_ABOUT \
"Quick Action remote control\n" QUAC_VERSION "\n" \
"github.com/rdefeo/quac"
Expand Down
4 changes: 4 additions & 0 deletions scenes/scene_action_settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,12 @@ static bool scene_action_settings_import_file_browser_callback(
memcpy(*icon, icon_get_data(&I_RFID_10px), 32);
} else if(!strcmp(ext, ".ir")) {
memcpy(*icon, icon_get_data(&I_IR_10px), 32);
} else if(!strcmp(ext, ".nfc")) {
memcpy(*icon, icon_get_data(&I_NFC_10px), 32);
} else if(!strcmp(ext, ".qpl")) {
memcpy(*icon, icon_get_data(&I_Playlist_10px), 32);
} else {
return false;
}
return true;
}
Expand Down
1 change: 1 addition & 0 deletions scenes/scene_items.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ static const ActionMenuItemType ItemToMenuItem[] = {
[Item_Playlist] = ActionMenuItemTypePlaylist,
[Item_Group] = ActionMenuItemTypeGroup,
[Item_Settings] = ActionMenuItemTypeSettings,
[Item_Unknown] = ActionMenuItemTypeUnknown,
};

void scene_items_item_callback(void* context, int32_t index, InputType type) {
Expand Down
1 change: 1 addition & 0 deletions views/action_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ static const Icon* ActionMenuIcons[] = {
[ActionMenuItemTypePlaylist] = &I_Playlist_10px,
[ActionMenuItemTypeGroup] = &I_Directory_10px,
[ActionMenuItemTypeSettings] = &I_Settings_10px,
[ActionMenuItemTypeUnknown] = &I_Unknown_10px,
};

struct ActionMenuItem {
Expand Down
1 change: 1 addition & 0 deletions views/action_menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ typedef enum {
ActionMenuItemTypePlaylist,
ActionMenuItemTypeGroup,
ActionMenuItemTypeSettings,
ActionMenuItemTypeUnknown,
ActionMenuItemType_count
} ActionMenuItemType;

Expand Down

0 comments on commit 90297cb

Please sign in to comment.