Skip to content

Commit

Permalink
UI Menu to set IR Time
Browse files Browse the repository at this point in the history
  • Loading branch information
David Lee committed Jan 31, 2024
1 parent ff25784 commit dd546b5
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions models/cross/xremote_cross_remote.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,11 @@ void xremote_cross_remote_rename_item(CrossRemote* remote, size_t index, const c
xremote_cross_remote_item_set_name(item, name);
}

int16_t xremote_cross_remote_get_item_type(CrossRemote* remote, size_t index) {
CrossRemoteItem* item = xremote_cross_remote_get_item(remote, index);
return xremote_cross_remote_item_get_type(item);
}

static void xremote_cross_remote_set_name(CrossRemote* remote, const char* name) {
furi_string_set(remote->name, name);
}
Expand Down
1 change: 1 addition & 0 deletions models/cross/xremote_cross_remote.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ void xremote_cross_remote_remove_item(CrossRemote* remote, size_t index);
void xremote_cross_remote_rename_item(CrossRemote* remote, size_t index, const char* name);
size_t xremote_cross_remote_get_item_count(CrossRemote* remote);
CrossRemoteItem* xremote_cross_remote_get_item(CrossRemote* remote, size_t index);
int16_t xremote_cross_remote_get_item_type(CrossRemote* remote, size_t index);

bool xremote_cross_remote_save_new(CrossRemote* remote, const char* name);
bool xremote_cross_remote_delete(CrossRemote* remote);
4 changes: 4 additions & 0 deletions models/cross/xremote_cross_remote_item.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,10 @@ void xremote_cross_remote_item_set_sg_signal(CrossRemoteItem* item, SubGhzRemote
item->sg_signal = subghz;
}

int16_t xremote_cross_remote_item_get_type(CrossRemoteItem* item) {
return item->type;
}

const char* xremote_cross_remote_item_get_name(CrossRemoteItem* item) {
return furi_string_get_cstr(item->name);
}
Expand Down
1 change: 1 addition & 0 deletions models/cross/xremote_cross_remote_item.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ void xremote_cross_remote_item_set_filename(CrossRemoteItem* item, const char* f
const char* xremote_cross_remote_item_get_filename(CrossRemoteItem* item);

void xremote_cross_remote_item_set_type(CrossRemoteItem* item, int type);
int16_t xremote_cross_remote_item_get_type(CrossRemoteItem* item);
void xremote_cross_remote_item_set_time(CrossRemoteItem* item, uint32_t time);
uint32_t xremote_cross_remote_item_get_time(CrossRemoteItem* item);

Expand Down
7 changes: 7 additions & 0 deletions scenes/xremote_scene_edit_item.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

enum SubmenuIndexEdit {
SubmenuIndexRename = 10,
SubmenuIndexTiming,
SubmenuIndexDelete,
};

Expand All @@ -15,6 +16,12 @@ void xremote_scene_edit_item_on_enter(void* context) {
XRemote* app = context;
submenu_add_item(
app->editmenu, "Rename", SubmenuIndexRename, xremote_scene_edit_item_submenu_callback, app);

if(xremote_cross_remote_get_item_type(app->cross_remote, app->edit_item) == XRemoteRemoteItemTypeInfrared) {
submenu_add_item(
app->editmenu, "Set Timing", SubmenuIndexRename, xremote_scene_edit_item_submenu_callback, app);
}

submenu_add_item(
app->editmenu, "Delete", SubmenuIndexDelete, xremote_scene_edit_item_submenu_callback, app);

Expand Down

0 comments on commit dd546b5

Please sign in to comment.