Merge branch 'dev' of https://github.com/flipperdevices/flipperzero-firmware into mntm-dev --nobuild

This commit is contained in:
Willy-JL
2024-04-25 22:19:03 +01:00
13 changed files with 126 additions and 97 deletions

View File

@@ -6,3 +6,4 @@ ADD_SCENE(desktop, locked, Locked)
ADD_SCENE(desktop, pin_input, PinInput)
ADD_SCENE(desktop, pin_timeout, PinTimeout)
ADD_SCENE(desktop, slideshow, Slideshow)
ADD_SCENE(desktop, secure_enclave, SecureEnclave)

View File

@@ -13,20 +13,21 @@ void desktop_scene_fault_callback(void* context) {
void desktop_scene_fault_on_enter(void* context) {
Desktop* desktop = (Desktop*)context;
Popup* popup = desktop->hw_mismatch_popup;
Popup* popup = desktop->popup;
popup_set_context(popup, desktop);
popup_set_header(
popup,
"Flipper crashed\n but has been rebooted",
60,
"Flipper crashed\n and was rebooted",
64,
14 + STATUS_BAR_Y_SHIFT,
AlignCenter,
AlignCenter);
char* message = (char*)furi_hal_rtc_get_fault_data();
popup_set_text(popup, message, 60, 37 + STATUS_BAR_Y_SHIFT, AlignCenter, AlignCenter);
popup_set_text(popup, message, 64, 37 + STATUS_BAR_Y_SHIFT, AlignCenter, AlignCenter);
popup_set_callback(popup, desktop_scene_fault_callback);
view_dispatcher_switch_to_view(desktop->view_dispatcher, DesktopViewIdHwMismatch);
view_dispatcher_switch_to_view(desktop->view_dispatcher, DesktopViewIdPopup);
}
bool desktop_scene_fault_on_event(void* context, SceneManagerEvent event) {
@@ -48,6 +49,11 @@ bool desktop_scene_fault_on_event(void* context, SceneManagerEvent event) {
}
void desktop_scene_fault_on_exit(void* context) {
UNUSED(context);
Desktop* desktop = (Desktop*)context;
furi_assert(desktop);
Popup* popup = desktop->popup;
popup_reset(popup);
furi_hal_rtc_set_fault_data(0);
}

View File

@@ -4,17 +4,15 @@
#include "desktop_scene.h"
#include "../desktop_i.h"
#define HW_MISMATCH_BACK_EVENT (0UL)
void desktop_scene_hw_mismatch_callback(void* context) {
Desktop* desktop = (Desktop*)context;
view_dispatcher_send_custom_event(desktop->view_dispatcher, HW_MISMATCH_BACK_EVENT);
view_dispatcher_send_custom_event(desktop->view_dispatcher, DesktopHwMismatchExit);
}
void desktop_scene_hw_mismatch_on_enter(void* context) {
Desktop* desktop = (Desktop*)context;
furi_assert(desktop);
Popup* popup = desktop->hw_mismatch_popup;
Popup* popup = desktop->popup;
char* text_buffer = malloc(256);
scene_manager_set_scene_state(
@@ -28,10 +26,10 @@ void desktop_scene_hw_mismatch_on_enter(void* context) {
version_get_target(NULL));
popup_set_context(popup, desktop);
popup_set_header(
popup, "!!!! HW Mismatch !!!!", 60, 14 + STATUS_BAR_Y_SHIFT, AlignCenter, AlignCenter);
popup_set_text(popup, text_buffer, 60, 37 + STATUS_BAR_Y_SHIFT, AlignCenter, AlignCenter);
popup, "!!!! HW Mismatch !!!!", 64, 12 + STATUS_BAR_Y_SHIFT, AlignCenter, AlignBottom);
popup_set_text(popup, text_buffer, 64, 33 + STATUS_BAR_Y_SHIFT, AlignCenter, AlignCenter);
popup_set_callback(popup, desktop_scene_hw_mismatch_callback);
view_dispatcher_switch_to_view(desktop->view_dispatcher, DesktopViewIdHwMismatch);
view_dispatcher_switch_to_view(desktop->view_dispatcher, DesktopViewIdPopup);
}
bool desktop_scene_hw_mismatch_on_event(void* context, SceneManagerEvent event) {
@@ -40,11 +38,10 @@ bool desktop_scene_hw_mismatch_on_event(void* context, SceneManagerEvent event)
if(event.type == SceneManagerEventTypeCustom) {
switch(event.event) {
case HW_MISMATCH_BACK_EVENT:
case DesktopHwMismatchExit:
scene_manager_previous_scene(desktop->scene_manager);
consumed = true;
break;
default:
break;
}
@@ -55,11 +52,10 @@ bool desktop_scene_hw_mismatch_on_event(void* context, SceneManagerEvent event)
void desktop_scene_hw_mismatch_on_exit(void* context) {
Desktop* desktop = (Desktop*)context;
furi_assert(desktop);
Popup* popup = desktop->hw_mismatch_popup;
popup_set_header(popup, NULL, 0, 0, AlignCenter, AlignBottom);
popup_set_text(popup, NULL, 0, 0, AlignCenter, AlignTop);
popup_set_callback(popup, NULL);
popup_set_context(popup, NULL);
Popup* popup = desktop->popup;
popup_reset(popup);
char* text_buffer =
(char*)scene_manager_get_scene_state(desktop->scene_manager, DesktopSceneHwMismatch);
free(text_buffer);

View File

@@ -0,0 +1,57 @@
#include <gui/scene_manager.h>
#include <furi_hal.h>
#include "desktop_scene.h"
#include "../desktop_i.h"
void desktop_scene_secure_enclave_callback(void* context) {
Desktop* desktop = (Desktop*)context;
view_dispatcher_send_custom_event(desktop->view_dispatcher, DesktopEnclaveExit);
}
void desktop_scene_secure_enclave_on_enter(void* context) {
Desktop* desktop = (Desktop*)context;
furi_assert(desktop);
Popup* popup = desktop->popup;
popup_set_context(popup, desktop);
popup_set_header(
popup, "No Factory Keys Found", 64, 12 + STATUS_BAR_Y_SHIFT, AlignCenter, AlignBottom);
popup_set_text(
popup,
"Secure Enclave is damaged.\n"
"Some apps will not work.",
64,
33 + STATUS_BAR_Y_SHIFT,
AlignCenter,
AlignCenter);
popup_set_callback(popup, desktop_scene_secure_enclave_callback);
view_dispatcher_switch_to_view(desktop->view_dispatcher, DesktopViewIdPopup);
}
bool desktop_scene_secure_enclave_on_event(void* context, SceneManagerEvent event) {
Desktop* desktop = (Desktop*)context;
bool consumed = false;
if(event.type == SceneManagerEventTypeCustom) {
switch(event.event) {
case DesktopEnclaveExit:
scene_manager_previous_scene(desktop->scene_manager);
consumed = true;
break;
default:
break;
}
}
return consumed;
}
void desktop_scene_secure_enclave_on_exit(void* context) {
Desktop* desktop = (Desktop*)context;
furi_assert(desktop);
Popup* popup = desktop->popup;
popup_reset(popup);
}