Changeset 1394


Ignore:
Timestamp:
11/05/11 04:52:08 (20 months ago)
Author:
philmoz
Message:

Script console and log file enhancements from tsvstar
http://chdk.setepontos.com/index.php?topic=650.msg75262#msg75262

Location:
trunk/core
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/core/console.c

    r1003 r1394  
    147147void console_add_line(const char *str) 
    148148{ 
     149        // Set console_autoredraw to -1 to stop script print statements from being displayed on screen 
     150        // Can be used to send script output to a file (using print_screen function); but not have it displayed 
     151        // on the LCD. 
     152    if (console_autoredraw == -1) 
     153        return; 
     154 
    149155    console_ensure_inited(); 
    150156 
  • trunk/core/script.c

    r1359 r1394  
    422422void script_print_screen_statement(int val) 
    423423{ 
     424  // Negative values for 'val' parameter will append to log file, 
     425  // positive values will truncate the log file 
     426  int flag_trunc = O_TRUNC; 
     427 
    424428  print_screen_p = val; 
    425429  if (val) { 
    426430    if (print_screen_d>=0) close(print_screen_d); 
    427     if (val<0) val = -val; 
     431    if (val<0) { 
     432       flag_trunc = 0; 
     433       val = -val; 
     434    } 
    428435    while (val > 9999) val -= 10000; 
    429436    sprintf(print_screen_file, "A/CHDK/LOGS/LOG_%04d.TXT", val); 
    430     print_screen_d = open(print_screen_file, O_WRONLY|O_CREAT|O_TRUNC, 0777); 
     437    print_screen_d = open(print_screen_file, O_WRONLY|O_CREAT|flag_trunc, 0777); 
    431438  } 
    432439} 
Note: See TracChangeset for help on using the changeset viewer.