Skip to content

Commit dd546b5

Browse files
author
David Lee
committed
UI Menu to set IR Time
1 parent ff25784 commit dd546b5

File tree

5 files changed

+18
-0
lines changed

5 files changed

+18
-0
lines changed

models/cross/xremote_cross_remote.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,11 @@ void xremote_cross_remote_rename_item(CrossRemote* remote, size_t index, const c
144144
xremote_cross_remote_item_set_name(item, name);
145145
}
146146

147+
int16_t xremote_cross_remote_get_item_type(CrossRemote* remote, size_t index) {
148+
CrossRemoteItem* item = xremote_cross_remote_get_item(remote, index);
149+
return xremote_cross_remote_item_get_type(item);
150+
}
151+
147152
static void xremote_cross_remote_set_name(CrossRemote* remote, const char* name) {
148153
furi_string_set(remote->name, name);
149154
}

models/cross/xremote_cross_remote.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ void xremote_cross_remote_remove_item(CrossRemote* remote, size_t index);
2323
void xremote_cross_remote_rename_item(CrossRemote* remote, size_t index, const char* name);
2424
size_t xremote_cross_remote_get_item_count(CrossRemote* remote);
2525
CrossRemoteItem* xremote_cross_remote_get_item(CrossRemote* remote, size_t index);
26+
int16_t xremote_cross_remote_get_item_type(CrossRemote* remote, size_t index);
2627

2728
bool xremote_cross_remote_save_new(CrossRemote* remote, const char* name);
2829
bool xremote_cross_remote_delete(CrossRemote* remote);

models/cross/xremote_cross_remote_item.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,10 @@ void xremote_cross_remote_item_set_sg_signal(CrossRemoteItem* item, SubGhzRemote
224224
item->sg_signal = subghz;
225225
}
226226

227+
int16_t xremote_cross_remote_item_get_type(CrossRemoteItem* item) {
228+
return item->type;
229+
}
230+
227231
const char* xremote_cross_remote_item_get_name(CrossRemoteItem* item) {
228232
return furi_string_get_cstr(item->name);
229233
}

models/cross/xremote_cross_remote_item.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ void xremote_cross_remote_item_set_filename(CrossRemoteItem* item, const char* f
1515
const char* xremote_cross_remote_item_get_filename(CrossRemoteItem* item);
1616

1717
void xremote_cross_remote_item_set_type(CrossRemoteItem* item, int type);
18+
int16_t xremote_cross_remote_item_get_type(CrossRemoteItem* item);
1819
void xremote_cross_remote_item_set_time(CrossRemoteItem* item, uint32_t time);
1920
uint32_t xremote_cross_remote_item_get_time(CrossRemoteItem* item);
2021

scenes/xremote_scene_edit_item.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
enum SubmenuIndexEdit {
55
SubmenuIndexRename = 10,
6+
SubmenuIndexTiming,
67
SubmenuIndexDelete,
78
};
89

@@ -15,6 +16,12 @@ void xremote_scene_edit_item_on_enter(void* context) {
1516
XRemote* app = context;
1617
submenu_add_item(
1718
app->editmenu, "Rename", SubmenuIndexRename, xremote_scene_edit_item_submenu_callback, app);
19+
20+
if(xremote_cross_remote_get_item_type(app->cross_remote, app->edit_item) == XRemoteRemoteItemTypeInfrared) {
21+
submenu_add_item(
22+
app->editmenu, "Set Timing", SubmenuIndexRename, xremote_scene_edit_item_submenu_callback, app);
23+
}
24+
1825
submenu_add_item(
1926
app->editmenu, "Delete", SubmenuIndexDelete, xremote_scene_edit_item_submenu_callback, app);
2027

0 commit comments

Comments
 (0)