1616
1717#include "settings_factory_reset.h"
1818#include "settings_menu.h"
19+ #include "settings_option_menu.h"
1920#include "settings_system.h"
2021#include "settings_window.h"
2122
7576 DebuggingItemCoreDumpNow = 0 ,
7677 DebuggingItemCoreDumpShortcut ,
7778 DebuggingItemALSThreshold ,
79+ #if PLATFORM_ASTERIX
80+ DebuggingItemMotionSensitivity ,
81+ #endif
7882 DebuggingItem_Count ,
7983};
8084
@@ -464,13 +468,61 @@ static void prv_als_threshold_menu_push(SettingsSystemData *data) {
464468 app_window_stack_push (& number_window -> window , animated );
465469}
466470
471+ // Motion Sensitivity Settings (Asterix/Obelix only)
472+ /////////////////////////////
473+ #if PLATFORM_ASTERIX
474+ static const uint8_t s_motion_sensitivity_values [] = { 10 , 25 , 40 , 55 , 70 , 85 , 100 };
475+
476+ static const char * s_motion_sensitivity_labels [] = {
477+ i18n_noop ("Very Low" ),
478+ i18n_noop ("Low" ),
479+ i18n_noop ("Medium-Low" ),
480+ i18n_noop ("Medium" ),
481+ i18n_noop ("Medium-High" ),
482+ i18n_noop ("High" ),
483+ i18n_noop ("Very High" )
484+ };
485+
486+ static int prv_motion_sensitivity_get_selection_index () {
487+ const uint8_t sensitivity = shell_prefs_get_motion_sensitivity ();
488+
489+ // Find closest match
490+ for (int i = 0 ; i < (int )ARRAY_LENGTH (s_motion_sensitivity_values ); i ++ ) {
491+ if (sensitivity <= s_motion_sensitivity_values [i ]) {
492+ return i ;
493+ }
494+ }
495+ return ARRAY_LENGTH (s_motion_sensitivity_values ) - 1 ;
496+ }
497+
498+ static void prv_motion_sensitivity_menu_select (OptionMenu * option_menu , int selection , void * context ) {
499+ shell_prefs_set_motion_sensitivity (s_motion_sensitivity_values [selection ]);
500+ app_window_stack_remove (& option_menu -> window , true /* animated */ );
501+ }
502+
503+ static void prv_motion_sensitivity_menu_push (SettingsSystemData * data ) {
504+ int index = prv_motion_sensitivity_get_selection_index ();
505+ const OptionMenuCallbacks callbacks = {
506+ .select = prv_motion_sensitivity_menu_select ,
507+ };
508+ const char * title = i18n_noop ("Motion Sensitivity" );
509+ settings_option_menu_push (
510+ title , OptionMenuContentType_SingleLine , index , & callbacks ,
511+ ARRAY_LENGTH (s_motion_sensitivity_labels ),
512+ true /* icons_enabled */ , s_motion_sensitivity_labels , data );
513+ }
514+ #endif
515+
467516// Debug options window
468517///////////////////////
469518
470519static const char * s_debugging_titles [DebuggingItem_Count ] = {
471520 [DebuggingItemCoreDumpNow ] = i18n_noop ("Bug report now" ),
472521 [DebuggingItemCoreDumpShortcut ] = i18n_noop ("Bug shortcut" ),
473522 [DebuggingItemALSThreshold ] = i18n_noop ("ALS Threshold" ),
523+ #if PLATFORM_ASTERIX
524+ [DebuggingItemMotionSensitivity ] = i18n_noop ("Motion Sensitivity" ),
525+ #endif
474526};
475527
476528static void prv_debugging_draw_row_callback (GContext * ctx , const Layer * cell_layer ,
@@ -497,6 +549,11 @@ static void prv_debugging_draw_row_callback(GContext* ctx, const Layer *cell_lay
497549 "%" PRIu32 , current_threshold );
498550 subtitle_text = data -> als_threshold_buffer ;
499551 }
552+ #if PLATFORM_ASTERIX
553+ else if (cell_index -> row == DebuggingItemMotionSensitivity ) {
554+ subtitle_text = i18n_get (s_motion_sensitivity_labels [prv_motion_sensitivity_get_selection_index ()], data );
555+ }
556+ #endif
500557 menu_cell_basic_draw (ctx , cell_layer , title , subtitle_text , NULL );
501558}
502559
@@ -528,6 +585,11 @@ static void prv_debugging_select_callback(MenuLayer *menu_layer,
528585 case DebuggingItemALSThreshold :
529586 prv_als_threshold_menu_push (data );
530587 break ;
588+ #if PLATFORM_ASTERIX
589+ case DebuggingItemMotionSensitivity :
590+ prv_motion_sensitivity_menu_push (data );
591+ break ;
592+ #endif
531593 default :
532594 WTF ;
533595 }
0 commit comments