[FL-2284] IR: Show universal remote loading (#1004)
* [FL-2131] IR: Show universal remote loading * Remove unused hal rtc. Gui: cleanup loading module. Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
#include "../irda_app.h"
|
||||
#include "gui/modules/button_menu.h"
|
||||
#include "input/input.h"
|
||||
#include "irda_worker.h"
|
||||
#include <gui/modules/button_menu.h>
|
||||
#include <input/input.h>
|
||||
#include <irda_worker.h>
|
||||
#include <dolphin/dolphin.h>
|
||||
#include "../irda_app.h"
|
||||
#include "../irda_app_view_manager.h"
|
||||
|
||||
typedef enum {
|
||||
ButtonIndexPlus = -2,
|
||||
|
@@ -1,13 +1,14 @@
|
||||
#include "../irda_app.h"
|
||||
#include "assets_icons.h"
|
||||
#include <dolphin/dolphin.h>
|
||||
#include "gui/modules/button_menu.h"
|
||||
#include "gui/modules/button_panel.h"
|
||||
#include "../view/irda_app_brut_view.h"
|
||||
#include "gui/view.h"
|
||||
#include <gui/modules/button_menu.h>
|
||||
#include <gui/modules/button_panel.h>
|
||||
#include <gui/view.h>
|
||||
#include <gui/view_stack.h>
|
||||
|
||||
#include "../irda_app.h"
|
||||
#include "irda/irda_app_event.h"
|
||||
#include "irda/irda_app_view_manager.h"
|
||||
#include "irda/scene/irda_app_scene.h"
|
||||
#include "../view/irda_progress_view.h"
|
||||
|
||||
void IrdaAppSceneUniversalCommon::irda_app_item_callback(void* context, uint32_t index) {
|
||||
IrdaApp* app = static_cast<IrdaApp*>(context);
|
||||
@@ -19,42 +20,34 @@ void IrdaAppSceneUniversalCommon::irda_app_item_callback(void* context, uint32_t
|
||||
app->get_view_manager()->send_event(&event);
|
||||
}
|
||||
|
||||
static bool irda_popup_brut_input_callback(InputEvent* event, void* context) {
|
||||
static void irda_progress_back_callback(void* context) {
|
||||
furi_assert(context);
|
||||
furi_assert(event);
|
||||
auto app = static_cast<IrdaApp*>(context);
|
||||
bool consumed = false;
|
||||
|
||||
if((event->type == InputTypeShort) && (event->key == InputKeyBack)) {
|
||||
consumed = true;
|
||||
IrdaAppEvent irda_event;
|
||||
|
||||
irda_event.type = IrdaAppEvent::Type::Back;
|
||||
app->get_view_manager()->send_event(&irda_event);
|
||||
}
|
||||
|
||||
return consumed;
|
||||
IrdaAppEvent irda_event = {
|
||||
.type = IrdaAppEvent::Type::Back,
|
||||
};
|
||||
app->get_view_manager()->clear_events();
|
||||
app->get_view_manager()->send_event(&irda_event);
|
||||
}
|
||||
|
||||
void IrdaAppSceneUniversalCommon::remove_popup(IrdaApp* app) {
|
||||
auto button_panel = app->get_view_manager()->get_button_panel();
|
||||
button_panel_set_popup_draw_callback(button_panel, NULL, NULL);
|
||||
button_panel_set_popup_input_callback(button_panel, NULL, NULL);
|
||||
auto stack_view = app->get_view_manager()->get_universal_view_stack();
|
||||
auto progress_view = app->get_view_manager()->get_progress();
|
||||
view_stack_remove_view(stack_view, irda_progress_view_get_view(progress_view));
|
||||
}
|
||||
|
||||
void IrdaAppSceneUniversalCommon::show_popup(IrdaApp* app, int record_amount) {
|
||||
auto button_panel = app->get_view_manager()->get_button_panel();
|
||||
auto popup_brut = app->get_view_manager()->get_popup_brut();
|
||||
popup_brut_set_progress_max(popup_brut, record_amount);
|
||||
button_panel_set_popup_draw_callback(button_panel, popup_brut_draw_callback, popup_brut);
|
||||
button_panel_set_popup_input_callback(button_panel, irda_popup_brut_input_callback, app);
|
||||
auto stack_view = app->get_view_manager()->get_universal_view_stack();
|
||||
auto progress_view = app->get_view_manager()->get_progress();
|
||||
irda_progress_view_set_progress_total(progress_view, record_amount);
|
||||
irda_progress_view_set_back_callback(progress_view, irda_progress_back_callback, app);
|
||||
view_stack_add_view(stack_view, irda_progress_view_get_view(progress_view));
|
||||
}
|
||||
|
||||
bool IrdaAppSceneUniversalCommon::progress_popup(IrdaApp* app) {
|
||||
bool result = popup_brut_increase_progress(app->get_view_manager()->get_popup_brut());
|
||||
auto button_panel = app->get_view_manager()->get_button_panel();
|
||||
with_view_model_cpp(button_panel_get_view(button_panel), void*, model, { return true; });
|
||||
return result;
|
||||
auto progress_view = app->get_view_manager()->get_progress();
|
||||
return irda_progress_view_increase_progress(progress_view);
|
||||
}
|
||||
|
||||
bool IrdaAppSceneUniversalCommon::on_event(IrdaApp* app, IrdaAppEvent* event) {
|
||||
|
@@ -1,3 +1,6 @@
|
||||
#include <stdint.h>
|
||||
#include <gui/modules/loading.h>
|
||||
#include <gui/view_stack.h>
|
||||
#include "irda/scene/irda_app_scene.h"
|
||||
#include "irda/irda_app.h"
|
||||
|
||||
@@ -80,9 +83,32 @@ void IrdaAppSceneUniversalTV::on_enter(IrdaApp* app) {
|
||||
button_panel_add_label(button_panel, 9, 64, FontSecondary, "Vol");
|
||||
button_panel_add_label(button_panel, 43, 64, FontSecondary, "Ch");
|
||||
|
||||
view_manager->switch_to(IrdaAppViewManager::ViewType::ButtonPanel);
|
||||
view_manager->switch_to(IrdaAppViewManager::ViewType::UniversalRemote);
|
||||
|
||||
if(!brute_force.calculate_messages()) {
|
||||
auto stack_view = app->get_view_manager()->get_universal_view_stack();
|
||||
auto loading_view = app->get_view_manager()->get_loading();
|
||||
view_stack_add_view(stack_view, loading_get_view(loading_view));
|
||||
|
||||
/**
|
||||
* Problem: Update events are not handled in Loading View, because:
|
||||
* 1) Timer task has least prio
|
||||
* 2) Storage service uses drivers that capture whole CPU time
|
||||
* to handle SD communication
|
||||
*
|
||||
* Ugly workaround, but it works for current situation:
|
||||
* raise timer task prio for DB scanning period.
|
||||
*/
|
||||
TaskHandle_t timer_task = xTaskGetHandle(configTIMER_SERVICE_TASK_NAME);
|
||||
TaskHandle_t storage_task = xTaskGetHandle("StorageSrv");
|
||||
uint32_t timer_prio = uxTaskPriorityGet(timer_task);
|
||||
uint32_t storage_prio = uxTaskPriorityGet(storage_task);
|
||||
vTaskPrioritySet(timer_task, storage_prio + 1);
|
||||
bool result = brute_force.calculate_messages();
|
||||
vTaskPrioritySet(timer_task, timer_prio);
|
||||
|
||||
view_stack_remove_view(stack_view, loading_get_view(loading_view));
|
||||
|
||||
if(!result) {
|
||||
app->switch_to_previous_scene();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user