IR: buttons move feature rework

This commit is contained in:
nminaylov
2023-08-04 18:52:03 +03:00
committed by MX
parent d09cf6c692
commit becc8edd8c
11 changed files with 280 additions and 176 deletions

View File

@@ -108,19 +108,13 @@ bool infrared_remote_delete_button(InfraredRemote* remote, size_t index) {
return infrared_remote_store(remote);
}
bool infrared_remote_move_button(InfraredRemote* remote, size_t index_orig, size_t index_dest) {
void infrared_remote_move_button(InfraredRemote* remote, size_t index_orig, size_t index_dest) {
furi_assert(index_orig < InfraredButtonArray_size(remote->buttons));
furi_assert(index_dest <= InfraredButtonArray_size(remote->buttons));
if(index_orig == index_dest) {
return true;
}
furi_assert(index_dest < InfraredButtonArray_size(remote->buttons));
InfraredRemoteButton* button;
InfraredButtonArray_pop_at(&button, remote->buttons, index_orig);
if(index_orig > index_dest)
InfraredButtonArray_push_at(remote->buttons, index_dest, button);
else
InfraredButtonArray_push_at(remote->buttons, index_dest - 1, button);
return infrared_remote_store(remote);
InfraredButtonArray_push_at(remote->buttons, index_dest, button);
}
bool infrared_remote_store(InfraredRemote* remote) {