Ignore:
Timestamp:
08/01/08 19:52:37 (5 years ago)
Author:
phyrephox
Message:

+ new OSD Element - Temperature

+ video quality control added. when enabled (in video overrides), by the use of the up/down button you can increase or decrease movie quality OR bitrate (depends on what you enabled in the video override menu) - WHILE you are recording!

  • changed Fast video control so that it isnt enabled at default, only works on a few cameras (pause and unpause movie by pressing left/right while recording) - needs further development
  • when using fast video control switch and the pause function now the remaining time calculation is reset, so it reflects the change in bitrate faster
  • changed a few default conf values (symbols now enabled at default, because symbol file now is served together with binary)

+ introduced new versioning system: 0.10 now, X.10 will be major release (and probably without bugs, with proper documentation, scripts, optimized etc), 0.X0 will be something like "new features, a bit ironing out etc", 0.1X will be just bugfixes and really small changes
+ added vers.req to svn, will be included in zipfile when autobuilded, will definitly be useful...
+ wrote two sample readmes, one for dryos, one for vxworks, they are included in the batch-zip-complete archives, in respect to OS version. these are just drafts, need input from you. yeah you heard me, from YOU!
+ added version.txt that will also be included in said archive, reflecting latest changes. it is not cleaned up as of now, probably never will be, but gives a rough overview over latest development
+ added ubasic statement case/select switch by CHDKLover from here: http://chdk.setepontos.com/index.php/topic,1995.0.html as of now i chose the "safe" method, the multi statement, due to people not reacting. hopefully they test it in this build so we can decide on one option!

  • renamed get_movie_state to get_movie_status in ubasic

+ added command get_temperature (example: "get_temperature 0", 0 returns optical, 1 returns CCD and 2 returns battery temp)
+ added a few grids from the wiki
+ changed makefile bigtime: now with new command batch-zip-complete you now have an environment to compile a complete CHDK archive for each cam including binaries, readmes (according to OS), scripts, version history and so on. it is planned that the archive will be crammed with useful information (readmes, howtos - into the books folder), grids, scripts (working ones, universal ones, and also code fragments that will serve as examples), curves, symbols, fonts (copyright!?) and so on. as of now i just added a few of these, and some dummy texts so that zip file will accept the folders. again i need YOU to help on developing a good structure and good scripts, readmes and so on. with this build, people no longer need to sift through the wiki or the forum to find all the good stuff. at least i do hope so.

  • changed random command, now you can supply two values min & max.

example: "playsound random 3 6" will play the sounds 3,4,5,6 in random order (if repeated in a while loop)

+ added ewavrs sx100 patch from here: http://tools.assembla.com/chdk/changeset/460 (adjustable alt button)
+ added new command playsound. can and should be used from ubasic, via "playsound 0", where 0 is the startup sound. there are sounds ranging from 0 to 7, 7 being a nasty long beep. the first few sounds can only be played if they are NOT muted by the camera, the other beeps will be played though (cam must be unmuted though, didnt test it with the nasty error beep though i gotta admit). this feature will lead to many more features, for example anti theft protection together with DGs Disco lights ;)

0 = startup sound, 1 = shutter sound, 2 = button press sound, 3 = selftimer, 4 = short beep, 5 = af confirmation, 6 = error beep, 7 = long beeeeeeeeeeeeeeeeeeep (nasty!)

  • adjusted makefile.inc so that all cameras are in it now (defaulted to my s3is by the way, not that it should matter)

+ added whoever's fix for ixus950's touchwheel behaviour from here: http://chdk.setepontos.com/index.php/topic,2024.0.html

  • lng files (german & english), also copied to new folder CHDK\LANG (for gmake batch-zip-complete)

thanks to Ewavr, Hacki, reyalp, ljl, jucifer and all the guys hanging out in the irc chan ;)

ps: i hope i didnt forget anything or anyone.

p.p.s: introducing with this build we might actually have an autobuild server... wait and see in the forums...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/juciphox/lib/ubasic/ubasic.c

    r453 r461  
    7575static int if_stack_ptr; 
    7676 
     77struct select_state { 
     78  int select_value; 
     79  short case_run; 
     80}; 
     81#define MAX_SELECT_STACK_DEPTH 4 
     82static struct select_state select_stack[MAX_SELECT_STACK_DEPTH]; 
     83static int select_stack_ptr; 
     84 
     85 
     86 
    7787#define MAX_WHILE_STACK_DEPTH 4 
    7888static short while_stack[MAX_WHILE_STACK_DEPTH]; 
     
    244254  case TOKENIZER_RANDOM: 
    245255    accept(TOKENIZER_RANDOM); 
     256    int min = expr(); 
     257    int max = expr(); 
    246258    srand((int)shooting_get_bv96()+(unsigned short)stat_get_vbatt()+get_tick_count()); 
    247259    ubasic_camera_sleep(rand()%10); 
    248     r = rand(); 
    249    break; 
    250   case TOKENIZER_GET_MOVIESTATE: 
    251     accept(TOKENIZER_GET_MOVIESTATE); 
     260    r = min + rand()%(max-min+1); 
     261  break; 
     262  case TOKENIZER_GET_MOVIE_STATUS: 
     263    accept(TOKENIZER_GET_MOVIE_STATUS); 
    252264    r = movie_status; 
    253265   break; 
     
    260272    r = shooting_get_prop(PROPCASE_FOCUS_MODE); 
    261273   break; 
    262   case TOKENIZER_GET_DISPLAY_MODE: 
     274        case TOKENIZER_GET_DISPLAY_MODE: 
    263275    accept(TOKENIZER_GET_DISPLAY_MODE); 
    264276    r = shooting_get_prop(PROPCASE_DISPLAY_MODE); 
     
    409421    else r = -1; 
    410422    break; 
     423  case TOKENIZER_GET_TEMPERATURE: 
     424    accept(TOKENIZER_GET_TEMPERATURE); 
     425    int temp = expr(); 
     426    switch (temp) 
     427    { 
     428        case 0: 
     429                r = get_optical_temp();  
     430                break; 
     431        case 1: 
     432                r = get_ccd_temp();  
     433                break; 
     434        case 2: 
     435                r = get_battery_temp(); 
     436                break; 
     437  } 
     438    break; 
    411439 case TOKENIZER_GET_RAW: 
    412440    accept(TOKENIZER_GET_RAW); 
     
    765793} 
    766794/*---------------------------------------------------------------------------*/ 
     795 
     796/*---------------------------------------------------------------------------*/ 
     797/* SELECT-STATEMENT                                                          */ 
     798 
     799static void 
     800dec_select_stack(void) 
     801{ 
     802  if(select_stack_ptr > 0) { 
     803      select_stack_ptr--; 
     804  } else { 
     805    DEBUG_PRINTF("select_statement: SELECT-Stack fail\n"); 
     806    ended = 1; 
     807    ubasic_error = UBASIC_E_UNKNOWN_ERROR;  //besser neuer Fehler UBASIC_E_SELECT_STACK_EXHAUSTED, 
     808  } 
     809} 
     810/*---------------------------------------------------------------------------*/ 
     811static void 
     812end_select(void) 
     813{ 
     814  if(select_stack_ptr > 0) { 
     815    accept(TOKENIZER_END_SELECT); 
     816    accept(TOKENIZER_CR); 
     817    dec_select_stack(); 
     818  } else { 
     819    DEBUG_PRINTF("ubasic.c: end_select(): end_select without select-statement\n"); 
     820    ended = 1; 
     821    ubasic_error = UBASIC_E_PARSE; 
     822  } 
     823} 
     824/*---------------------------------------------------------------------------*/ 
     825static void 
     826case_statement(void) 
     827{ 
     828  int select_value, case_value_1, case_value_2, case_value_eq; 
     829  short case_run, case_goto = 0, case_gosub = 0; 
     830   
     831  accept(TOKENIZER_CASE); 
     832  if(select_stack_ptr > 0) { 
     833    select_value = select_stack[select_stack_ptr - 1].select_value; 
     834    case_run = select_stack[select_stack_ptr - 1].case_run; 
     835   
     836    if (!case_run) { 
     837      case_value_1 = expr(); 
     838      case_value_eq = (select_value == case_value_1); 
     839      if (case_value_eq) { DEBUG_PRINTF("case_statement: case_value_eq %d, case_value %d\n", case_value_eq, case_value_1); }   
     840 
     841      if(tokenizer_token() == TOKENIZER_TO) { 
     842        accept(TOKENIZER_TO); 
     843        case_value_2 = expr(); 
     844        if (case_value_1 < case_value_2) { 
     845          case_value_eq = ((select_value >= case_value_1) && (select_value <= case_value_2)); 
     846          DEBUG_PRINTF("case_statement: case_value %d to %d\n", case_value_1, case_value_2); 
     847        } else { 
     848          case_value_eq = ((select_value >= case_value_2) && (select_value <= case_value_1)); 
     849          DEBUG_PRINTF("case_statement: case_value %d to %d\n", case_value_2, case_value_1); 
     850        } 
     851      } else if (tokenizer_token() == TOKENIZER_COMMA) { 
     852        do { 
     853          accept(TOKENIZER_COMMA); 
     854          if (case_value_eq) { 
     855            case_value_2 = expr(); 
     856          } else { 
     857            case_value_1 = expr(); 
     858            case_value_eq = (select_value == case_value_1); 
     859          } 
     860        } while (tokenizer_token() == TOKENIZER_COMMA); 
     861        DEBUG_PRINTF("case_statement: case_value_eq %d, case_value_comma %d\n", case_value_eq, case_value_1); 
     862      } 
     863       
     864      accept(TOKENIZER_SEMICOLON); 
     865      if (case_value_eq) { 
     866        case_goto = (tokenizer_token() == TOKENIZER_GOTO); 
     867        case_gosub = (tokenizer_token() == TOKENIZER_GOSUB); 
     868        statement(); 
     869        DEBUG_PRINTF("case_statement: case execute\n"); 
     870        case_run = 1; 
     871        select_stack[select_stack_ptr - 1].case_run = case_run; 
     872      } else { 
     873        DEBUG_PRINTF("case_statement: case jump; case_run: %d\n", case_run); 
     874        accept_cr(); 
     875      } 
     876    } else {accept_cr();} 
     877    if (case_goto) { dec_select_stack(); } else { 
     878      if (!case_gosub) { 
     879        if ((tokenizer_token() != TOKENIZER_CASE) && (tokenizer_token() != TOKENIZER_CASE_ELSE) &&  
     880           (tokenizer_token() != TOKENIZER_END_SELECT)) { 
     881           DEBUG_PRINTF("ubasic.c: select_statement(): don't found case, case_else or end_select\n"); 
     882           ended = 1; 
     883           ubasic_error = UBASIC_E_PARSE; 
     884        } else {  
     885          if (tokenizer_token() == TOKENIZER_END_SELECT) { end_select(); } 
     886        } 
     887      }   
     888    } 
     889  } else { 
     890    DEBUG_PRINTF("case_statement: SELECT-Stack fail\n"); 
     891    ended = 1; 
     892    ubasic_error = UBASIC_E_UNKNOWN_ERROR;  //besser neuer Fehler UBASIC_E_SELECT_STACK_EXHAUSTED, 
     893  } 
     894} 
     895/*---------------------------------------------------------------------------*/ 
     896static void 
     897case_else_statement(void) 
     898{ 
     899  short case_goto = 0, case_gosub = 0; 
     900   
     901  accept(TOKENIZER_CASE_ELSE); 
     902  if(select_stack_ptr > 0) { 
     903    if (!select_stack[select_stack_ptr - 1].case_run) { 
     904      case_goto = (tokenizer_token() == TOKENIZER_GOTO);  
     905      case_gosub = (tokenizer_token() == TOKENIZER_GOSUB);  
     906      statement(); 
     907      DEBUG_PRINTF("case_else_statement: case_else execute\n"); 
     908    } else { 
     909      DEBUG_PRINTF("case_else_statement: case_else jump; case_run: %d\n", select_stack[select_stack_ptr - 1].case_run); 
     910      accept_cr(); 
     911    } 
     912    if (case_goto) { dec_select_stack(); } else {  
     913      if (!case_gosub) { 
     914        if (tokenizer_token() != TOKENIZER_END_SELECT) { 
     915          DEBUG_PRINTF("ubasic.c: select_statement(): don't found end_select\n"); 
     916          ended = 1; 
     917          ubasic_error = UBASIC_E_PARSE; 
     918        } else { end_select(); } 
     919      } 
     920    } 
     921  } else { 
     922    DEBUG_PRINTF("case_else_statement: SELECT-Stack fault\n"); 
     923    ended = 1; 
     924    ubasic_error = UBASIC_E_UNKNOWN_ERROR;  //besser neuer Fehler UBASIC_E_SELECT_STACK_EXHAUSTED, 
     925  } 
     926} 
     927/*---------------------------------------------------------------------------*/ 
     928static void 
     929select_statement(void) 
     930{ 
     931  
     932  int select_value; 
     933   
     934  accept(TOKENIZER_SELECT); 
     935  select_value = expr();   
     936  accept(TOKENIZER_CR); 
     937   
     938  if(select_stack_ptr < MAX_SELECT_STACK_DEPTH) { 
     939    select_stack[select_stack_ptr].select_value = select_value; 
     940    select_stack[select_stack_ptr].case_run = 0; 
     941    DEBUG_PRINTF("select_statement: new select, value %d\n",select_stack[select_stack_ptr].select_value); 
     942    select_stack_ptr++; 
     943    if (tokenizer_token() != TOKENIZER_CASE) { 
     944      DEBUG_PRINTF("ubasic.c: select_statement(): don't found case-statement\n"); 
     945      ended = 1; 
     946      ubasic_error = UBASIC_E_PARSE; 
     947    } 
     948    //NEU f?r diekten "case"-befehl 
     949    else { case_statement(); } 
     950    //--------------------------- 
     951  } else { 
     952    DEBUG_PRINTF("select_statement: SELECT-stack depth exceeded\n"); 
     953    ended = 1; 
     954    ubasic_error = UBASIC_E_UNKNOWN_ERROR;  //besser neuer Fehler UBASIC_E_SELECT_STACK_EXHAUSTED, 
     955  } 
     956} 
     957/* SELECT-STATEMENT END                                                      */ 
     958 
    767959/*---------------------------------------------------------------------------*/ 
    768960static void 
     
    12831475} 
    12841476 
     1477static void play_sound_statement() 
     1478{ 
     1479    int to; 
     1480    accept(TOKENIZER_PLAY_SOUND); 
     1481    to = expr(); 
     1482    play_sound(to); 
     1483    accept_cr(); 
     1484} 
    12851485static void set_shutter_speed_statement() 
    12861486{ 
     
    18872087    set_tv96_statement(); 
    18882088    break;   
     2089  case TOKENIZER_PLAY_SOUND: 
     2090    play_sound_statement(); 
     2091    break;   
    18892092  case TOKENIZER_SET_SHUTTER_SPEED: 
    18902093    set_shutter_speed_statement(); 
     
    19932196    endif_statement(); 
    19942197    break; 
     2198  case TOKENIZER_SELECT: 
     2199    select_statement(); 
     2200    break; 
     2201  case TOKENIZER_CASE: 
     2202    case_statement(); 
     2203    break; 
     2204  case TOKENIZER_CASE_ELSE: 
     2205    case_else_statement(); 
     2206    break; 
    19952207  case TOKENIZER_GOTO: 
    19962208    goto_statement(); 
Note: See TracChangeset for help on using the changeset viewer.