[FL-1929, FL-2164] IR App migrate to FFF (#949)
* IR app move to FFF * [FL-2164] Hide unimplemented submenus * Fix brute force fail * Fix FFF endless reading * Reformat TV bruteforce lib to FFF * fixes & cleanup * Infrared: switch to constexpr. Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "../irda_app.h"
|
||||
#include "../irda_app_event.h"
|
||||
#include "irda.h"
|
||||
#include <irda_worker.h>
|
||||
|
||||
static void signal_received_callback(void* context, IrdaWorkerSignal* received_signal) {
|
||||
@@ -15,7 +16,8 @@ static void signal_received_callback(void* context, IrdaWorkerSignal* received_s
|
||||
const uint32_t* timings;
|
||||
size_t timings_cnt;
|
||||
irda_worker_get_raw_signal(received_signal, &timings, &timings_cnt);
|
||||
IrdaAppSignal signal(timings, timings_cnt);
|
||||
IrdaAppSignal signal(
|
||||
timings, timings_cnt, IRDA_COMMON_CARRIER_FREQUENCY, IRDA_COMMON_DUTY_CYCLE);
|
||||
app->set_received_signal(signal);
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#include "../irda_app.h"
|
||||
#include <file_worker_cpp.h>
|
||||
#include "irda.h"
|
||||
#include "../irda_app_file_parser.h"
|
||||
#include <memory>
|
||||
|
||||
static void dialog_result_callback(DialogExResult result, void* context) {
|
||||
@@ -76,8 +76,8 @@ bool IrdaAppSceneLearnSuccess::on_event(IrdaApp* app, IrdaAppEvent* event) {
|
||||
break;
|
||||
}
|
||||
case DialogExResultRight: {
|
||||
IrdaAppFileParser file_parser;
|
||||
if(file_parser.check_errors()) {
|
||||
FileWorkerCpp file_worker;
|
||||
if(file_worker.check_errors()) {
|
||||
app->switch_to_next_scene(IrdaApp::Scene::LearnEnterName);
|
||||
} else {
|
||||
app->switch_to_previous_scene();
|
||||
|
@@ -1,21 +1,35 @@
|
||||
#include "../irda_app.h"
|
||||
#include "irda/irda_app_event.h"
|
||||
#include <text_store.h>
|
||||
#include <file_worker_cpp.h>
|
||||
|
||||
void IrdaAppSceneRemoteList::on_enter(IrdaApp* app) {
|
||||
IrdaAppFileParser file_parser;
|
||||
bool success = false;
|
||||
furi_assert(app);
|
||||
|
||||
FileWorkerCpp file_worker;
|
||||
bool result = false;
|
||||
bool file_select_result;
|
||||
auto remote_manager = app->get_remote_manager();
|
||||
auto last_selected_remote = remote_manager->get_remote_name();
|
||||
auto selected_file = file_parser.file_select(
|
||||
last_selected_remote.size() ? last_selected_remote.c_str() : nullptr);
|
||||
if(!selected_file.empty()) {
|
||||
if(remote_manager->load(selected_file)) {
|
||||
const char* last_selected_remote_name =
|
||||
last_selected_remote.size() ? last_selected_remote.c_str() : nullptr;
|
||||
auto filename_ts = std::make_unique<TextStore>(IrdaAppRemoteManager::max_remote_name_length);
|
||||
|
||||
file_select_result = file_worker.file_select(
|
||||
IrdaApp::irda_directory,
|
||||
IrdaApp::irda_extension,
|
||||
filename_ts->text,
|
||||
filename_ts->text_size,
|
||||
last_selected_remote_name);
|
||||
|
||||
if(file_select_result) {
|
||||
if(remote_manager->load(std::string(filename_ts->text))) {
|
||||
app->switch_to_next_scene(IrdaApp::Scene::Remote);
|
||||
success = true;
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!success) {
|
||||
if(!result) {
|
||||
app->switch_to_previous_scene();
|
||||
}
|
||||
}
|
||||
|
@@ -21,9 +21,6 @@ void IrdaAppSceneUniversal::on_enter(IrdaApp* app) {
|
||||
Submenu* submenu = view_manager->get_submenu();
|
||||
|
||||
submenu_add_item(submenu, "TV's", SubmenuIndexUniversalTV, submenu_callback, app);
|
||||
submenu_add_item(submenu, "Audio Players", SubmenuIndexUniversalAudio, submenu_callback, app);
|
||||
submenu_add_item(
|
||||
submenu, "Air Conditioners", SubmenuIndexUniversalAirConditioner, submenu_callback, app);
|
||||
submenu_set_selected_item(submenu, submenu_item_selected);
|
||||
submenu_item_selected = 0;
|
||||
|
||||
|
Reference in New Issue
Block a user