Changeset 2071


Ignore:
Timestamp:
08/09/12 10:49:33 (10 months ago)
Author:
tsv
Message:

tsvstar-ui: added ubasic command "config_save", "turn_config_value" to extend usage of cfg-menu.
ubasic_test.exe also workable now

Location:
branches/tsvstar-uitest
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/tsvstar-uitest/core/conf.c

    r2067 r2071  
    805805 
    806806//------------------------------------------------------------------- 
    807 int conf_setValue(unsigned short id, tConfigVal configVal) { 
     807int conf_setValue(unsigned short id, tConfigVal configVal, int conf_save_flag ) { 
    808808    unsigned short i; 
    809809    int ret = CONF_EMPTY, len, len2; 
     
    862862        } 
    863863    } 
    864     if( ret!=CONF_EMPTY ) { 
     864    if( ret!=CONF_EMPTY && conf_save_flag ) { 
    865865        conf_save(); 
    866866    } 
    867867    return ret; 
    868868} 
     869 
     870int conf_toggleValue(unsigned short id, int direction, int conf_save_flag ) 
     871{ 
     872        int i; 
     873        int* valueptr; 
     874 
     875    for( i=0; i<CONF_NUM; ++i ) { 
     876        if( conf_info[i].id==id ) { 
     877 
     878                        // ONLY INTEGER COULD HAVE QUICKDISABLED ABILITY 
     879 
     880            if ( conf_info[i].type != CONF_VALUE && 
     881                 conf_info[i].type != CONF_VALUE_PTR ) 
     882                                break; 
     883 
     884                        if ( conf_info[i].size!= sizeof(int) ) 
     885                                break; 
     886 
     887                        value_turn_state( (int*)conf_info[i].var, direction ); 
     888 
     889                        if ( conf_save_flag ) 
     890                                conf_save(); 
     891 
     892                        return CONF_VALUE; 
     893                } 
     894        } 
     895 
     896        return CONF_EMPTY; 
     897} 
     898 
    869899 
    870900//------------------------------------------------------------------- 
  • branches/tsvstar-uitest/core/luascript.c

    r2065 r2071  
    19911991            } 
    19921992        } 
    1993         lua_pushboolean(L, conf_setValue(id, configVal)); 
     1993        lua_pushboolean(L, conf_setValue(id, configVal, 1)); 
    19941994        if( configVal.pInt ) { 
    19951995            free(configVal.pInt); 
  • branches/tsvstar-uitest/include/conf.h

    r2067 r2071  
    423423extern void conf_update_prevent_shutdown(void); 
    424424extern int conf_getValue(unsigned short id, tConfigVal* configVal); 
    425 extern int conf_setValue(unsigned short id, tConfigVal configVal); 
     425extern int conf_setValue(unsigned short id, tConfigVal configVal, int save_conf ); 
     426extern int conf_toggleValue(unsigned short id, int direction, int save_conf ); 
    426427 
    427428 
  • branches/tsvstar-uitest/lib/ubasic/camera_functions.c

    r1975 r2071  
    610610    return 0; 
    611611} 
     612 
     613int shooting_get_real_focus_mode() { printf("%s\n",__FUNCTION__); return 0;} 
     614int shooting_get_display_mode() { printf("%s\n",__FUNCTION__); return 0;} 
     615int shooting_get_flash_mode() { printf("%s\n",__FUNCTION__); return 0;} 
     616int shooting_in_progress() { printf("%s\n",__FUNCTION__); return 0;} 
     617int shooting_is_flash() { printf("%s\n",__FUNCTION__); return 0;} 
     618int shooting_get_is_mode() { printf("%s\n",__FUNCTION__); return 0;} 
     619int shooting_get_ev_correction1() { printf("%s\n",__FUNCTION__); return 0;} 
     620int shooting_get_resolution() { printf("%s\n",__FUNCTION__); return 0;} 
     621int lens_get_zoom_point() { printf("%s\n",__FUNCTION__); return 0;} 
     622int get_focal_length() { printf("%s\n",__FUNCTION__); return 0;} 
     623int swap_partitions(int n) { printf("%s:%d\n",__FUNCTION__,n); return 0;} 
     624int conf_toggleValue(int id,int dir) { printf("toggle_value(%d,%d)\n",id,dir); return 0;} 
     625void JogDial_CCW() {} 
     626void JogDial_CW() {} 
     627 
    612628#endif 
  • branches/tsvstar-uitest/lib/ubasic/tokenizer.c

    r1975 r2071  
    228228  {"is_capture_mode_valid",  TOKENIZER_IS_CAPTURE_MODE_VALID},  
    229229  {"reboot",                 TOKENIZER_REBOOT}, 
     230  {"turn_config_value",           TOKENIZER_TURN_CONFIG_VALUE}, 
     231  {"config_save",                        TOKENIZER_CONFIG_SAVE}, 
    230232   
    231233  {"end",                     TOKENIZER_END}, 
  • branches/tsvstar-uitest/lib/ubasic/tokenizer.h

    r1975 r2071  
    204204  TOKENIZER_SET_CONFIG_VALUE, 
    205205  TOKENIZER_SET_YIELD, 
    206   TOKENIZER_SWAP_PARTITIONS 
     206  TOKENIZER_SWAP_PARTITIONS, 
     207  TOKENIZER_TURN_CONFIG_VALUE, 
     208  TOKENIZER_CONFIG_SAVE 
    207209} ubasic_token; 
    208210 
  • branches/tsvstar-uitest/lib/ubasic/ubasic.c

    r1975 r2071  
    4747#include <io.h> 
    4848#include <stdlib.h> /* rand,srand */ 
     49#include <stdio.h> /* sprintf */ 
    4950#include "camera_functions.h" 
    5051#else 
     
    114115 
    115116static int ubasic_md_ret_var_num; 
     117 
     118static int config_save_flag;  // state of "config_save" 
    116119 
    117120static int expr(void); 
     
    177180  yield_max_lines = YIELD_MAX_LINES_DEFAULT; 
    178181  yield_max_ms = YIELD_MAX_MS_DEFAULT; 
     182  config_save_flag=1; 
    179183} 
    180184/*---------------------------------------------------------------------------*/ 
     
    530534      int tmode = expr(); 
    531535      static struct tm *ttm; 
     536#ifdef UBASIC_TEST 
     537#else 
    532538      ttm = get_localtime(); 
     539#endif 
    533540      if (tmode==0) r = ttm->tm_sec; 
    534541      else if (tmode==1) r = ttm->tm_min; 
     
    16261633 
    16271634static void set_ev_statement() 
    1628         { 
    1629             int to; 
    1630             accept(TOKENIZER_SET_EV); 
    1631             to = expr(); 
    1632                 shooting_set_prop(PROPCASE_EV_CORRECTION_1, to); 
    1633                 shooting_set_prop(PROPCASE_EV_CORRECTION_2, to); 
    1634             accept_cr(); 
    1635         } 
     1635{ 
     1636        int to; 
     1637        accept(TOKENIZER_SET_EV); 
     1638        to = expr(); 
     1639        shooting_set_prop(PROPCASE_EV_CORRECTION_1, to); 
     1640        shooting_set_prop(PROPCASE_EV_CORRECTION_2, to); 
     1641        accept_cr(); 
     1642} 
    16361643 
    16371644static void set_movie_status_statement() 
     
    17561763        configVal.numb = value; 
    17571764        configVal.isNumb = 1; 
    1758         conf_setValue(id, configVal); 
    1759     } 
     1765        conf_setValue(id, configVal, config_save_flag ); 
     1766    } 
     1767    accept_cr(); 
     1768} 
     1769 
     1770static void turn_config_value_statement() 
     1771{ 
     1772    int id, dir; 
     1773     
     1774    accept(TOKENIZER_TURN_CONFIG_VALUE); 
     1775    id = expr(); 
     1776    dir = expr(); 
     1777    conf_toggleValue( id, dir, config_save_flag ); 
     1778    accept_cr(); 
     1779} 
     1780 
     1781static void config_save_statement() 
     1782{ 
     1783    accept(TOKENIZER_CONFIG_SAVE); 
     1784    config_save_flag = expr(); 
    17601785    accept_cr(); 
    17611786} 
     
    18331858    accept(TOKENIZER_VARIABLE); 
    18341859         
     1860#ifdef UBASIC_TEST 
     1861    printf("%s\n",__FUNCTION__); 
     1862#else 
    18351863    if (module_mdetect_load()) 
    18361864        ubasic_set_variable(var, libmotiondetect->md_get_cell_diff(col,row)); 
    18371865    else 
     1866#endif 
    18381867        ubasic_set_variable(var, 0); 
    18391868    accept_cr(); 
     
    19441973//              script_console_add_line(buf); 
    19451974 
     1975#ifdef UBASIC_TEST 
     1976    printf("%s\n",__FUNCTION__); 
     1977#else 
    19461978    if (module_mdetect_load()) 
    19471979        libmotiondetect->md_init_motion_detector( 
     
    19531985                        parameters, pixels_step, msecs_before_trigger 
    19541986        ); 
     1987#endif 
    19551988    flag_yield=1; 
    19561989} 
     
    23082341  case TOKENIZER_SET_CONFIG_VALUE: 
    23092342    set_config_value_statement(); 
     2343    break; 
     2344  case TOKENIZER_TURN_CONFIG_VALUE: 
     2345    turn_config_value_statement(); 
     2346    break; 
     2347  case TOKENIZER_CONFIG_SAVE: 
     2348    config_save_statement(); 
    23102349    break; 
    23112350  case TOKENIZER_SET_YIELD: 
Note: See TracChangeset for help on using the changeset viewer.