Changeset 986


Ignore:
Timestamp:
11/28/10 00:07:15 (2 years ago)
Author:
reyalp
Message:

add "always" option to "disable lcd off", prevents lcd off when not in alt mode. From atalwar in http://chdk.setepontos.com/index.php?topic=5854.0 with modifications.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/core/conf.c

    r977 r986  
    211211    CONF_INFO( 65, conf.font_cp,                CONF_DEF_VALUE, i:FONT_CP_WIN_1251, conf_change_font_cp), 
    212212    CONF_INFO( 66, conf.menu_rbf_file,          CONF_DEF_PTR,   ptr:"", conf_change_menu_rbf_file), 
    213     CONF_INFO( 67, conf.alt_prevent_shutdown,   CONF_DEF_VALUE, i:ALT_PREVENT_SHUTDOWN_ALT, NULL), 
     213    CONF_INFO( 67, conf.alt_prevent_shutdown,   CONF_DEF_VALUE, i:ALT_PREVENT_SHUTDOWN_ALT, conf_update_prevent_shutdown), 
    214214    CONF_INFO( 68, conf.show_grid_lines,        CONF_DEF_VALUE, i:0, NULL), 
    215215    CONF_INFO( 69, conf.grid_lines_file,        CONF_DEF_PTR,   ptr:"", conf_change_grid_file), 
     
    468468} 
    469469 
     470/* 
     471update the prevent display off/prevent shutdown based on current state 
     472doesn't really belong in conf but not clear where else it should go 
     473*/ 
     474void conf_update_prevent_shutdown(void) { 
     475        if(conf.alt_prevent_shutdown == ALT_PREVENT_SHUTDOWN_ALWAYS  
     476                || (conf.alt_prevent_shutdown == ALT_PREVENT_SHUTDOWN_ALT && gui_get_mode() != GUI_MODE_NONE) 
     477                || (conf.alt_prevent_shutdown == ALT_PREVENT_SHUTDOWN_ALT_SCRIPT && state_kbd_script_run)) { 
     478        disable_shutdown(); 
     479        } else { 
     480        enable_shutdown(); 
     481        } 
     482} 
     483 
    470484//------------------------------------------------------------------- 
    471485static void conf_init_defaults() { 
  • trunk/core/gui.c

    r979 r986  
    14841484//------------------------------------------------------------------- 
    14851485const char* gui_alt_power_enum(int change, int arg) { 
    1486     static const char* modes[]={ "No", "Alt", "Script" }; 
     1486    static const char* modes[]={ "Never", "Alt", "Script","Always" }; 
    14871487 
    14881488    conf.alt_prevent_shutdown+=change; 
     
    14911491    else if (conf.alt_prevent_shutdown>=(sizeof(modes)/sizeof(modes[0]))) 
    14921492        conf.alt_prevent_shutdown=0; 
     1493         
     1494        conf_update_prevent_shutdown(); 
    14931495 
    14941496    return modes[conf.alt_prevent_shutdown]; 
     
    25042506    conf_store_old_settings(); 
    25052507#endif 
    2506     if ((conf.alt_prevent_shutdown == ALT_PREVENT_SHUTDOWN_ALT && !state_kbd_script_run)  
    2507         || conf.alt_prevent_shutdown == ALT_PREVENT_SHUTDOWN_ALT_SCRIPT) { 
    2508         disable_shutdown(); 
    2509     } 
    25102508    gui_mode = GUI_MODE_ALT; 
     2509 
     2510        conf_update_prevent_shutdown(); 
     2511 
    25112512    vid_turn_off_updates(); 
    25122513 
     
    25332534        rbf_load_from_8x16(current_font); 
    25342535    rbf_set_codepage(FONT_CP_WIN); 
    2535     enable_shutdown(); 
    25362536    vid_turn_on_updates(); 
    25372537    gui_mode = GUI_MODE_NONE; 
     2538 
     2539        conf_update_prevent_shutdown(); 
    25382540} 
    25392541//-------------------------------------------------------------------  
  • trunk/core/kbd.c

    r979 r986  
    356356    state_kbd_script_run = 1; 
    357357 
    358     if (conf.alt_prevent_shutdown != ALT_PREVENT_SHUTDOWN_ALT_SCRIPT) { 
    359         enable_shutdown(); 
    360     } 
     358    conf_update_prevent_shutdown(); 
     359 
    361360} 
    362361 
     
    372371        md_close_motion_detector(); 
    373372        shot_histogram_set(0); 
    374     if ((conf.alt_prevent_shutdown != ALT_PREVENT_SHUTDOWN_NO) && (gui_get_mode()==GUI_MODE_ALT)) { 
    375         disable_shutdown(); 
    376     } 
    377373    kbd_key_release_all(); 
    378374    state_kbd_script_run = 0; 
     375 
     376    conf_update_prevent_shutdown(); 
     377 
    379378    vid_bitmap_refresh(); 
    380379} 
  • trunk/include/conf.h

    r928 r986  
    288288#define ALT_PREVENT_SHUTDOWN_ALT        1 
    289289#define ALT_PREVENT_SHUTDOWN_ALT_SCRIPT 2 
     290#define ALT_PREVENT_SHUTDOWN_ALWAYS     3 
    290291 
    291292#define SHOOTING_PROGRESS_NONE          0 
     
    312313extern int shutter_int; 
    313314extern void conf_change_dng(void); 
     315extern void conf_update_prevent_shutdown(void); 
    314316 
    315317// reyalp: putting these in conf, since the conf values are lookups for them 
Note: See TracChangeset for help on using the changeset viewer.