From: penglei <1624952103@qq.com> Date: Thu, 11 Apr 2024 03:48:52 +0000 (+0800) Subject: 优化运动模式切换函数,添加静态模式切换函数 X-Git-Tag: release_V1.2.70_20241020_135402~1210^2~9 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=7f1dd04246e4a5605b0bc74a367038434d143c6a;p=mirrors%2FFD230.git 优化运动模式切换函数,添加静态模式切换函数 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TraingCardPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TraingCardPresenter.cpp index 5d12e9852..ed43d76cb 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TraingCardPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TraingCardPresenter.cpp @@ -106,8 +106,6 @@ namespace OHOS { // 根据不同的运动项目进行不同的运动 WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TraingCardPresenter::OpenSensor!!"); - // 进行运动项目的判断的时候需要先退出当前项目 - do_cywee_service_check_msg(CYWEE_SERVICE_CMD_EXIT); switch (type) { case ExerciseClass::NORMAL: diff --git a/code/sdk/drivers/peripheral/cywee/Inc/cywee_hal.h b/code/sdk/drivers/peripheral/cywee/Inc/cywee_hal.h index 9059742d9..9100c06be 100644 --- a/code/sdk/drivers/peripheral/cywee/Inc/cywee_hal.h +++ b/code/sdk/drivers/peripheral/cywee/Inc/cywee_hal.h @@ -43,6 +43,13 @@ extern void CWM_OS_restoreData(uint8_t* data, uint32_t len); #define SPORT_ACTIVE_MODE_FREE_TRAINING 5001 // 自由運動 FreeTraining 5001 #define SPORT_ACTIVE_MODE_AR_ALERT 1001 // 長時間動作偵測 AR alert 1001 +#define INACTIVITY_MODE_NOTHING 0 // 无作用 +#define INACTIVITY_MODE_SEDENTARY 1 // 久坐和有效站立 +#define INACTIVITY_MODE_SLEEPING 2 // 睡眠 +#define INACTIVITY_MODE_SEDENTARY_AND_NAP 3 // 久坐、有效站立和小睡 +#define INACTIVITY_MODE_NAP 4 // 小睡 + + #pragma pack(1) /** @@ -491,11 +498,12 @@ void activity_exit(void); -int cywee_main_dml(int cmd); +int cywee_main_dml(void); void cywee_int_handler(void); void watch_hand_updown(int fdata); - +void cyw_inactivity_mode_change(int mode); +void cyw_activity_mode_change(int mode); #ifdef __cplusplus #if __cplusplus diff --git a/code/sdk/drivers/peripheral/cywee/Inc/cywee_service.h b/code/sdk/drivers/peripheral/cywee/Inc/cywee_service.h index f1218419c..d747bc760 100644 --- a/code/sdk/drivers/peripheral/cywee/Inc/cywee_service.h +++ b/code/sdk/drivers/peripheral/cywee/Inc/cywee_service.h @@ -2,7 +2,7 @@ * @Author: penglei 1624952103@qq.com * @Date: 2024-03-26 20:29:58 * @LastEditors: penglei 1624952103@qq.com - * @LastEditTime: 2024-04-09 09:18:51 + * @LastEditTime: 2024-04-11 11:15:48 * @FilePath: /FD230/code/sdk/drivers/peripheral/cywee/Inc/cywee_service.h * @Description: * @@ -43,18 +43,9 @@ extern "C" { #define CYWEE_SERVICE_CMD_STOP_CHECK 0x13 #define CYWEE_SERVICE_CMD_TEST 0x14 -#define CYWEE_SERVICE_CMD_NORMAL_MODE 0x15 -#define CYWEE_SERVICE_CMD_TREADMILL_MODE 0x16 -#define CYWEE_SERVICE_CMD_OUTDOOR_RUNNING_MODE 0x17 -#define CYWEE_SERVICE_CMD_INDOOR_RUNNING_MODE 0x18 -#define CYWEE_SERVICE_CMD_FITNESS_PEDOMETER_MODE 0x19 -#define CYWEE_SERVICE_CMD_FREE_TRAINING_MODE 0x20 -#define CYWEE_SERVICE_CMD_AR_ALERT_MODE 0x21 +#define CYWEE_SERVICE_CMD_PAUSE 0x15 +#define CYWEE_SERVICE_CMD_RESUME 0x16 -#define CYWEE_SERVICE_CMD_PAUSE 0x22 -#define CYWEE_SERVICE_CMD_RESUME 0x23 - -#define CYWEE_SERVICE_CMD_EXIT 0x24 errcode_t uapi_cywee_service_init(void); void uapi_cywee_service_deinit(void); diff --git a/code/sdk/drivers/peripheral/cywee/service/cywee_at_cmd.c b/code/sdk/drivers/peripheral/cywee/service/cywee_at_cmd.c index 2f8e57671..11a2fa9db 100644 --- a/code/sdk/drivers/peripheral/cywee/service/cywee_at_cmd.c +++ b/code/sdk/drivers/peripheral/cywee/service/cywee_at_cmd.c @@ -5,6 +5,7 @@ #include "cywee_at_cmd.h" #include "common_def.h" #include "debug_print.h" +#include "cywee_hal.h" #define ARRAY_COUNT(array) (sizeof(array) / sizeof(array[0])) #define CYWEE_MAX_ARGC 8 #define CYWEE_MAX_ARGV_LEN 64 @@ -67,31 +68,28 @@ static uint32_t cywee_do_test(uint8_t *para, uint32_t paraLen, char *strCommonCm do_cywee_service_check_msg(CYWEE_SERVICE_CMD_TEST); } else if (strcmp(mode, "normal") == 0) { PRINT("cywee normal mode\n"); - do_cywee_service_check_msg(CYWEE_SERVICE_CMD_NORMAL_MODE); + do_cywee_service_check_msg(SPORT_ACTIVE_MODE_NORMAL); } else if (strcmp(mode, "treadmill") == 0) { PRINT("cywee treadmill mode\n"); - do_cywee_service_check_msg(CYWEE_SERVICE_CMD_TREADMILL_MODE); + do_cywee_service_check_msg(SPORT_ACTIVE_MODE_TREADMILL); } else if (strcmp(mode, "outdoor") == 0) { PRINT("cywee outdoor running mode\n"); - do_cywee_service_check_msg(CYWEE_SERVICE_CMD_OUTDOOR_RUNNING_MODE); + do_cywee_service_check_msg(SPORT_ACTIVE_MODE_OUTDOOR_RUNNING); } else if (strcmp(mode, "indoor") == 0) { PRINT("cywee indoor running mode\n"); - do_cywee_service_check_msg(CYWEE_SERVICE_CMD_INDOOR_RUNNING_MODE); + do_cywee_service_check_msg(SPORT_ACTIVE_MODE_INDOOR_RUNNING); } else if (strcmp(mode, "pedometer") == 0) { PRINT("cywee fitness pedometer mode\n"); - do_cywee_service_check_msg(CYWEE_SERVICE_CMD_FITNESS_PEDOMETER_MODE); + do_cywee_service_check_msg(SPORT_ACTIVE_MODE_FITNESS_PEDOMETERR); } else if (strcmp(mode, "free") == 0) { PRINT("cywee free training mode\n"); - do_cywee_service_check_msg(CYWEE_SERVICE_CMD_FREE_TRAINING_MODE); + do_cywee_service_check_msg(SPORT_ACTIVE_MODE_FREE_TRAINING); } else if (strcmp(mode, "pause") == 0) { PRINT("cywee pause\n"); do_cywee_service_check_msg(CYWEE_SERVICE_CMD_PAUSE); } else if (strcmp(mode, "resume") == 0) { PRINT("cywee resume\n"); do_cywee_service_check_msg(CYWEE_SERVICE_CMD_RESUME); - } else if (strcmp(mode, "exit") == 0) { - PRINT("cywee exit\n"); - do_cywee_service_check_msg(CYWEE_SERVICE_CMD_EXIT); } return ERRCODE_SUCC; } @@ -102,7 +100,6 @@ static const at_cmd_table_t g_cywee_cmd[] = { { (char *)"AT^CYWEETEST", cywee_do_test, (char *)"free" }, { (char *)"AT^CYWEETEST", cywee_do_test, (char *)"pause" }, { (char *)"AT^CYWEETEST", cywee_do_test, (char *)"resume" }, - { (char *)"AT^CYWEETEST", cywee_do_test, (char *)"exit" }, }; at_cmd_table_t *get_cywee_cmd_table(uint32_t *cmd_count) diff --git a/code/sdk/drivers/peripheral/cywee/service/cywee_service.c b/code/sdk/drivers/peripheral/cywee/service/cywee_service.c index 03bce95fe..487314469 100644 --- a/code/sdk/drivers/peripheral/cywee/service/cywee_service.c +++ b/code/sdk/drivers/peripheral/cywee/service/cywee_service.c @@ -207,54 +207,42 @@ static void cywee_service_check_task(void const *arg) test_api(); }else if (mail.cmd == CYWEE_SERVICE_CMD_START_CHECK){ cywee_service_running_stat = true; - //cywee_main_dml(SPORT_ACTIVE_MODE_NORMAL); + cywee_main_dml(); cywee_service_timer_start_check(CYWEE_CHECK_MS); }else if (mail.cmd == CYWEE_SERVICE_CMD_STOP_CHECK){ cywee_service_running_stat = false; if (g_cywee_service_timer != NULL) osTimerStop(g_cywee_service_timer); } - else if (mail.cmd == CYWEE_SERVICE_CMD_NORMAL_MODE){ - cywee_service_running_stat = true; - cywee_main_dml(SPORT_ACTIVE_MODE_NORMAL); - cywee_service_timer_start_check(CYWEE_CHECK_MS); - }else if(mail.cmd == CYWEE_SERVICE_CMD_TREADMILL_MODE){ - cywee_service_running_stat = true; - cywee_main_dml(SPORT_ACTIVE_MODE_TREADMILL); - cywee_service_timer_start_check(CYWEE_CHECK_MS); - }else if(mail.cmd == CYWEE_SERVICE_CMD_OUTDOOR_RUNNING_MODE){ - cywee_service_running_stat = true; - cywee_main_dml(SPORT_ACTIVE_MODE_OUTDOOR_RUNNING); - cywee_service_timer_start_check(CYWEE_CHECK_MS); - }else if(mail.cmd == CYWEE_SERVICE_CMD_INDOOR_RUNNING_MODE){ - cywee_service_running_stat = true; - cywee_main_dml(SPORT_ACTIVE_MODE_INDOOR_RUNNING); - cywee_service_timer_start_check(CYWEE_CHECK_MS); - }else if(mail.cmd == CYWEE_SERVICE_CMD_FITNESS_PEDOMETER_MODE){ - cywee_service_running_stat = true; - cywee_main_dml(SPORT_ACTIVE_MODE_FITNESS_PEDOMETERR); - cywee_service_timer_start_check(CYWEE_CHECK_MS); - }else if(mail.cmd == CYWEE_SERVICE_CMD_FREE_TRAINING_MODE){ - cywee_service_running_stat = true; - cywee_main_dml(SPORT_ACTIVE_MODE_FREE_TRAINING); - cywee_service_timer_start_check(CYWEE_CHECK_MS); - }else if(mail.cmd == CYWEE_SERVICE_CMD_AR_ALERT_MODE){ - cywee_service_running_stat = true; - cywee_main_dml(SPORT_ACTIVE_MODE_AR_ALERT); - cywee_service_timer_start_check(CYWEE_CHECK_MS); + else if (mail.cmd == SPORT_ACTIVE_MODE_NORMAL){ + cyw_activity_mode_change(SPORT_ACTIVE_MODE_NORMAL); + }else if(mail.cmd == SPORT_ACTIVE_MODE_TREADMILL){ + cyw_activity_mode_change(SPORT_ACTIVE_MODE_TREADMILL); + }else if(mail.cmd == SPORT_ACTIVE_MODE_OUTDOOR_RUNNING){ + cyw_activity_mode_change(SPORT_ACTIVE_MODE_OUTDOOR_RUNNING); + }else if(mail.cmd == SPORT_ACTIVE_MODE_INDOOR_RUNNING){ + cyw_activity_mode_change(SPORT_ACTIVE_MODE_INDOOR_RUNNING); + }else if(mail.cmd == SPORT_ACTIVE_MODE_FITNESS_PEDOMETERR){ + cyw_activity_mode_change(SPORT_ACTIVE_MODE_FITNESS_PEDOMETERR); + }else if(mail.cmd == SPORT_ACTIVE_MODE_FREE_TRAINING){ + cyw_activity_mode_change(SPORT_ACTIVE_MODE_FREE_TRAINING); + }else if(mail.cmd == SPORT_ACTIVE_MODE_AR_ALERT){ + cyw_activity_mode_change(SPORT_ACTIVE_MODE_AR_ALERT); }else if(mail.cmd == CYWEE_SERVICE_CMD_PAUSE){ activity_setstatus(1); }else if(mail.cmd == CYWEE_SERVICE_CMD_RESUME){ activity_setstatus(0); - }else if(mail.cmd == CYWEE_SERVICE_CMD_EXIT){ - cywee_service_running_stat = false; - if (g_cywee_service_timer != NULL) osTimerStop(g_cywee_service_timer); - activity_exit(); + }else if(mail.cmd == INACTIVITY_MODE_NOTHING){ + cyw_inactivity_mode_change(INACTIVITY_MODE_NOTHING); + }else if(mail.cmd == INACTIVITY_MODE_SEDENTARY){ + cyw_inactivity_mode_change(INACTIVITY_MODE_SEDENTARY); + }else if(mail.cmd == INACTIVITY_MODE_SLEEPING){ + cyw_inactivity_mode_change(INACTIVITY_MODE_SLEEPING); + }else if(mail.cmd == INACTIVITY_MODE_SEDENTARY_AND_NAP){ + cyw_inactivity_mode_change(INACTIVITY_MODE_SEDENTARY_AND_NAP); + }else if(mail.cmd == INACTIVITY_MODE_NAP){ + cyw_inactivity_mode_change(INACTIVITY_MODE_NAP); } - - #define CYWEE_SERVICE_CMD_PAUSE 0x22 -#define CYWEE_SERVICE_CMD_RESUME 0x23 - } } #define CYWEE_APP_BOARD_MSG_COUNT 50 @@ -289,7 +277,7 @@ errcode_t uapi_cywee_service_init(void) g_cywee_service_timer = osTimerNew((osTimerFunc_t)cywee_service_check_timer_callback, osTimerPeriodic, NULL, NULL); cywee_register_msg_callback(cywee_msg_callback); - do_cywee_service_check_msg(CYWEE_SERVICE_CMD_NORMAL_MODE); + do_cywee_service_check_msg(CYWEE_SERVICE_CMD_START_CHECK); return ERRCODE_SUCC; } diff --git a/code/sdk/drivers/peripheral/cywee/src/main_dml.c b/code/sdk/drivers/peripheral/cywee/src/main_dml.c index 6e3d96ade..3ea540dc9 100644 --- a/code/sdk/drivers/peripheral/cywee/src/main_dml.c +++ b/code/sdk/drivers/peripheral/cywee/src/main_dml.c @@ -43,30 +43,23 @@ static osTimerId_t g_cywee_oncharging_timer; CustomSensorData csd; -void free_training_task(void) -{ - ppg_send_cmd_to_driver("hrs",1); -} - -errcode_t free_training_init(void) -{ - app_task_definition_t taskcfg={0}; - taskcfg.create_queue_handle = NULL; - taskcfg.attr.name="free_training_service"; - taskcfg.attr.priority = TASK_PRIORITY_CMD; - taskcfg.attr.stack_size = 1024*8; - taskcfg.func = free_training_task; - taskcfg.use_mem = USE_EXTEND_MEM; - - errcode_t ret=uapi_create_osThread_custom(&taskcfg); - if(ret != ERRCODE_SUCC) - { - PRINT("create free_training_task failed %d!\r\n",ret); - return ERRCODE_FAIL; - } - - return ERRCODE_SUCC; -} +// void time_sync(void) +// { +// char databuf[64] = {0}; +// int year,month,day,hour,min,sec; +// uapi_get_yyyymmddhhmmss_Date(databuf); +// PRINT("databuf : %s \r\n",databuf); +// sscanf(databuf, "%4d%2d%2d%2d%2d%2d", &year, &month, &day, &hour, &min, &sec); +// memset(&scl, 0, sizeof(scl)); +// scl.iData[0] = 1; +// scl.iData[1] = year; +// scl.iData[2] = month; +// scl.iData[3] = day; +// scl.iData[4] = hour; +// scl.iData[5] = min; +// scl.iData[6] = sec; +// CWM_SettingControl(SCL_DATE_TIME, &scl); +// } void cywee_hrs_check_timer_callback(void) @@ -96,6 +89,50 @@ void cywee_oncharging_check_timer_callback(void) } +void free_training_task(void) +{ + ppg_send_cmd_to_driver("hrs",1); +} + +void free_training_deinit(void) +{ + if(free_training_installized == 0) + return; + + free_training_installized = 0; + osTimerStop(g_cywee_oncharging_timer); + osTimerStop(g_cywee_hrs_timer); + osTimerDelete(g_cywee_oncharging_timer); + osTimerDelete(g_cywee_hrs_timer); + ppg_send_cmd_to_driver("hrs",0); +} + +errcode_t free_training_init(void) +{ + if(free_training_installized == 1) + return ERRCODE_FAIL; + + app_task_definition_t taskcfg={0}; + taskcfg.create_queue_handle = NULL; + taskcfg.attr.name="free_training_service"; + taskcfg.attr.priority = TASK_PRIORITY_CMD; + taskcfg.attr.stack_size = 1024*8; + taskcfg.func = free_training_task; + taskcfg.use_mem = USE_EXTEND_MEM; + + errcode_t ret=uapi_create_osThread_custom(&taskcfg); + if(ret != ERRCODE_SUCC) + { + PRINT("create free_training_task failed %d!\r\n",ret); + return ERRCODE_FAIL; + } + free_training_installized = 1; + g_cywee_hrs_timer = osTimerNew((osTimerFunc_t)cywee_hrs_check_timer_callback, osTimerPeriodic, NULL, NULL); + g_cywee_oncharging_timer = osTimerNew((osTimerFunc_t)cywee_oncharging_check_timer_callback, osTimerPeriodic, NULL, NULL); + + return ERRCODE_SUCC; +} + void watch_hand_updown(int fdata) { #if defined(SUPPORT_POWER_MANAGER) @@ -128,28 +165,57 @@ void activity_setstatus(int cmd) CWM_SettingControl(SCL_ACTIVITY_PAUSE, &scl); } -void activity_exit(void) -{ - memset(&scl, 0, sizeof(scl)); - scl.iData[0] = 1; - CWM_SettingControl(SCL_REQ_ACTIVITY_EXIT, &scl); - if(cywee_installized == 1) - cywee_installized = 0; - if(free_training_installized == 1) +void cyw_inactivity_mode_change(int mode) +{ + switch (mode) { - free_training_installized = 0; - //osTimerStop(g_cywee_wearstatus_timer); - osTimerStop(g_cywee_oncharging_timer); - osTimerStop(g_cywee_hrs_timer); - osTimerDelete(g_cywee_oncharging_timer); - osTimerDelete(g_cywee_hrs_timer); - ppg_send_cmd_to_driver("hrs",0); + case INACTIVITY_MODE_NOTHING: + memset(&scl, 0, sizeof(scl)); + scl.iData[0] = 1; + scl.iData[1] = 0; + CWM_SettingControl(SCL_SET_INACTIVITY_MODE, &scl); + break; + + case INACTIVITY_MODE_SEDENTARY: + memset(&scl, 0, sizeof(scl)); + scl.iData[0] = 1; + scl.iData[1] = 1; + CWM_SettingControl(SCL_SET_INACTIVITY_MODE, &scl); + break; + + case INACTIVITY_MODE_SLEEPING: + memset(&scl, 0, sizeof(scl)); + scl.iData[0] = 1; + scl.iData[1] = 2; + CWM_SettingControl(SCL_SET_INACTIVITY_MODE, &scl); + break; + + case INACTIVITY_MODE_SEDENTARY_AND_NAP: + memset(&scl, 0, sizeof(scl)); + scl.iData[0] = 1; + scl.iData[1] = 3; + CWM_SettingControl(SCL_SET_INACTIVITY_MODE, &scl); + break; + + case INACTIVITY_MODE_NAP: + memset(&scl, 0, sizeof(scl)); + scl.iData[0] = 1; + scl.iData[1] = 4; + CWM_SettingControl(SCL_SET_INACTIVITY_MODE, &scl); + break; + + default: + break; } } -void cyw_mode_init(int mode) +void cyw_activity_mode_change(int mode) { + memset(&scl, 0, sizeof(scl)); + scl.iData[0] = 1; + CWM_SettingControl(SCL_REQ_ACTIVITY_EXIT, &scl); + switch (mode) { //一般模式(生活模式) @@ -198,8 +264,8 @@ void cyw_mode_init(int mode) //自由运动 case SPORT_ACTIVE_MODE_FREE_TRAINING: - free_training_installized = 1; free_training_init(); + free_training_deinit(); memset(&scl, 0, sizeof(scl)); scl.iData[0] = 1; scl.iData[1] = SPORT_ACTIVE_MODE_FREE_TRAINING; @@ -210,20 +276,6 @@ void cyw_mode_init(int mode) // case SPORT_ACTIVE_MODE_AR_ALERT: // break; - case 2: - memset(&scl, 0, sizeof(scl)); - scl.iData[0] = 1; - scl.iData[1] = 2; - CWM_SettingControl(SCL_SET_INACTIVITY_MODE, &scl); - break; - - case 1: - memset(&scl, 0, sizeof(scl)); - scl.iData[0] = 1; - scl.iData[1] = 1; - CWM_SettingControl(SCL_SET_INACTIVITY_MODE, &scl); - break; - default: break; } @@ -530,308 +582,166 @@ void CWM_AP_dmlSensorDataOutput_listen(const dml_sensorData_t * pSdo) { #endif -int cywee_main_dml(int cmd) { +int cywee_main_dml(void) +{ if (cywee_installized==0) { - int i; - memset(&scl, 0, sizeof(scl)); - scl.iData[0] = 1; - CWM_SettingControl(SCL_GET_LIB_INFO, &scl); - CWM_OS_dbgPrintf("version:%d.%d.%d.%d product:%d model:%d\n", scl.iData[1], scl.iData[2], scl.iData[3], scl.iData[4], scl.iData[5], scl.iData[6]); - CWM_OS_dbgPrintf("[DBG] ach: %d\n", scl.iData[7]); - #if USE_P813 - os_api api = { - .GetTimeNs = CWM_OS_GetTimeNs, - .dbgOutput = CWM_OS_dbgOutput, - .i2cRead = CWM_OS_i2cRead, - .i2cWrite = CWM_OS_i2cWrite, - .uSleep = CWM_OS_uSleep, - .free = CWM_OS_free, - .malloc = CWM_OS_malloc, - .spiRead = NULL, - .spiWrite = NULL, - }; - CWM_LibPreInit(&api); - - #else - OsAPI apiOS = { - .GetTimeNs = CWM_OS_GetTimeNs, - .dbgOutput = CWM_OS_dbgOutput, - .i2cRead = CWM_OS_i2cRead, - .i2cWrite = CWM_OS_i2cWrite, - .uSleep = CWM_OS_uSleep, - .free = CWM_OS_free, - .malloc = CWM_OS_malloc, - .i2cTransfer = CWM_OS_i2cTransfer, - .restoreData = CWM_OS_restoreData, - .saveData = CWM_OS_saveData, - .spiRead = NULL, - .spiWrite = NULL, - .securityCodeWrite = NULL, - .setGpio = NULL, - .enableGpioIRQ = NULL, - .disableGpioIRQ = NULL, - }; - CWM_LibPreInit(&apiOS); - #endif - //CWM_OS_dbgPrintf("[DBG] %s %d\n", __func__,__LINE__); - - //set mcu_chip information, must call this before CWM_LibPostInit() - - memset(&scl, 0, sizeof(scl)); - scl.iData[0] = 1; - scl.iData[1] = 2; // 0: mcu_auto_detect 2: skip_mcu_auto_detect - CWM_SettingControl(SCL_CHIP_VENDOR_CONFIG, &scl); - //CWM_OS_dbgPrintf("[DBG] %s %d\n", __func__,__LINE__); - - CWM_LibPostInit(CWM_AP_SensorListen); - //CWM_OS_dbgPrintf("[DBG] %s %d\n", __func__,__LINE__); - - //get chip information - - char chipInfo[64]; - - memset(&scl, 0, sizeof(scl)); - scl.iData[0] = 1; - scl.iData[1] = 1; - scl.iData[2] = (int)chipInfo; - scl.iData[3] = sizeof(chipInfo); - scl.iData[4] = 0; - scl.iData[5] = 0; - scl.iData[6] = 0; - CWM_SettingControl(SCL_GET_CHIP_INFO, &scl); - CWM_OS_dbgPrintf("have_security = %d.%d ret_buff_size = %d chipInfo = %s\n", scl.iData[5], scl.iData[6], scl.iData[4], chipInfo); - CWM_OS_dbgPrintf("chip_settings = %d, %d, %d\n", scl.iData[9], scl.iData[10], scl.iData[11]); - //CWM_OS_dbgPrintf("[DBG] %s %d\n", __func__,__LINE__); - - CWM_Dml_LibInit(); - //CWM_OS_dbgPrintf("[DBG] %s %d\n", __func__,__LINE__); - - #ifdef AP_ENABLE_DML_SDO_LISTEN - // This API allows customers to develop custom features. - // Specific settingControl commands needs to be called for this API to work. - // No need to enable or implement this function for general usage. - CWM_Dml_sensorDataOutput_register(CWM_AP_dmlSensorDataOutput_listen); - #endif - //CWM_OS_dbgPrintf("[DBG] %s %d\n", __func__,__LINE__); - - memset(&scl, 0, sizeof(scl)); - scl.iData[0] = 1; - CWM_SettingControl(SCL_DML_GET_LIB_INFO, &scl); - CWM_OS_dbgPrintf("dml version:%d.%d.%d.%d product:%d model:%d\n", scl.iData[1], scl.iData[2], scl.iData[3], scl.iData[4], scl.iData[5], scl.iData[6]); - - //CWM_OS_dbgPrintf("[DBG] %s %d\n", __func__,__LINE__); - - memset(&scl, 0, sizeof(scl)); - scl.iData[0] = 1; - scl.iData[1] = 18; //00000000000000000000000000010010 高位在前 - // CWM_SettingControl(SCL_DML_DEBUG, &scl); - - //设置acc gyro 相关参数 - memset(&scl, 0, sizeof(scl)); - scl.iData[0] = 1; - scl.iData[3] = 2; - scl.iData[4] = 2; //1 anytime 2 fifo - scl.iData[6] = 5; //先設定5 - scl.iData[7] = 5; - scl.iData[8] = 52; // for st sensor(52Hz) - CWM_SettingControl(SCL_DML_DRV_AG_CONFIG, &scl); - //CWM_OS_dbgPrintf("[DBG] %s %d\n", __func__,__LINE__); - - //设定搜寻哪种型号的传感器,以及要搜寻的属性 - memset(&scl, 0, sizeof(scl)); - scl.iData[0] = 1; - scl.iData[1] = 2; - scl.iData[6] = 3002502; - scl.iData[7] = (0|1|8|256|1024); - CWM_SettingControl(SCL_DML_DRV_HW_CONFIG, &scl); - //CWM_OS_dbgPrintf("[DBG] %s %d\n", __func__,__LINE__); - - //搜寻是否接入传感器 - memset(&scl, 0, sizeof(scl)); - scl.iData[0] = 1; - scl.iData[1] = 1; - CWM_SettingControl(SCL_DML_DRV_INIT, &scl); - CWM_OS_dbgPrintf("DML device=%d\n", scl.iData[2]); - - //获取初始化 driver清单 - memset(&scl, 0, sizeof(scl)); - scl.iData[0] = 1; - CWM_SettingControl(SCL_DML_GET_INITED_LIST, &scl); - //CWM_OS_dbgPrintf("[DBG] %s %d\n", __func__,__LINE__); - - for (i = 0; i < scl.iData[2]; i ++) { - - CWM_OS_dbgPrintf("DML device[%d]: hw_id=%d hw_attr=%d\n", i, scl.iData[6 + i * 2], scl.iData[7 + i * 2]); - } - - //设置抬腕功能 - memset(&scl, 0, sizeof(scl)); - scl.iData[0] = 1; - // scl.iData[1] = 5; - // scl.iData[2] = 5; - // scl.iData[3] = 5; - // scl.iData[4] = 5; - CWM_SettingControl(SCL_HAND_UPDOWN_CONFIG, &scl); - - //呼叫任一個CWM_Sensor_Enable 前呼叫此指令 设置手动或自动模式 - memset(&scl, 0, sizeof(scl)); - scl.iData[0] = 1; - scl.iData[1] = 1; - // int[2] = 3,代表開啟acc和gyro感測器 1代表开启acc - scl.iData[2] = 1; - CWM_SettingControl(SCL_DML_DRV_ENABLE, &scl); - //CWM_OS_dbgPrintf("[DBG] %s %d\n", __func__,__LINE__); - - memset(&scl, 0, sizeof(scl)); - scl.iData[0] = 1; - scl.iData[3] = 3; - scl.iData[4] = 5; - // CWM_SettingControl(SCL_LOG, &scl); - - - CWM_Sensor_Enable(IDX_REQUEST_SENSOR); - // //CWM_OS_dbgPrintf("[DBG] %s %d\n", __func__,__LINE__); - CWM_Sensor_Enable(IDX_ALGO_INACTIVITY_OUTPUT); - - CWM_Sensor_Enable(IDX_ALGO_ACTIVITY_OUTPUT); - - CWM_Sensor_Enable(IDX_ACCEL); - //CWM_OS_dbgPrintf("[DBG] %s %d\n", __func__,__LINE__); - // CWM_Sensor_Enable(IDX_GYRO); - CWM_Sensor_Enable(IDX_ALGO_NO_MOTION); - //CWM_OS_dbgPrintf("[DBG] %s %d\n", __func__,__LINE__); - // CWM_Sensor_Enable(IDX_ALGO_ANY_MOTIOIN); - CWM_Sensor_Enable(IDX_ALGO_ABSOLUTE_STATIC); - //CWM_OS_dbgPrintf("[DBG] %s %d\n", __func__,__LINE__); - CWM_Sensor_Enable(IDX_ALGO_WATCH_HANDUP); - + CWM_OS_dbgPrintf("cywee_installized skip install\n"); + return 0; } cywee_installized = 1; - if(cywee_installized == 1) - CWM_OS_dbgPrintf("cywee_installized skip install\n"); -/* -int[0] = 1 -int[1] = floor_Height (cm)(設定樓層高度)(default: 380cm = 3.8m) - (0: default, 150 - 1000) -int[2] = Anti-misoperation (一般模式時的防誤計步等級) (default: 4) - (0: default, 1: 最容易誤計步, 2, 3, 4:預設等級, 5, 6, 7: 最不容易誤計步) -int[3] = 戶外跑步和一般模式時距離、配速和步距的調整 (default: 4) - (0: default, 1: 距離最短, 2, 3, 4:預設, 5, 6, 7:距離最長) -int[4] = enable_extra_packet (default: 不發送) - (0: default, 1: 發送, 2: 不發送) -int[5] = Treadmill__steps (跑步機校正參數)(steps) (default: 不校正) - (0: 不校正) -int[6] = Treadmill__average_step_frequency (跑步機校正參數) (steps/minute) (default: 不校正) - (0: 不校正) -int[7] = Treadmill__uncalibration_distance (跑步機校正參數)(meters) (default: 不校正) - (0: 不校正) -int[8] = Treadmill__ground_truth_distance (跑步機校正參數: 真實的跑步距離)(meters) (default: 不校正) - (0: 不校正) -int[9] = floor_sensitivity (樓層計算嚴謹度)(default: 3) - (0: default, 1:寬容, 2, 3, 4, 5, 7: 嚴格) -int[10] = 防高頻誤觸 (default: 開啟) - (0: default, 1: 開啟, 2: 關閉) -int[11] = 高步頻走路步距修正 (default: 開啟) - (0: default, 1: 開啟, 2: 關閉) -int[12] = 活動程度區間的中度活動步頻 (default: 60) - (0: default, 60 - 270) -int[13] = 活動程度區間的高度活動步頻 (default: 120) - (0: default, 60 - 270) -*/ - //配置跑步机模式相关参数(进入跑步机模式自动生效) + int i; + memset(&scl, 0, sizeof(scl)); + scl.iData[0] = 1; + CWM_SettingControl(SCL_GET_LIB_INFO, &scl); + CWM_OS_dbgPrintf("version:%d.%d.%d.%d product:%d model:%d\n", scl.iData[1], scl.iData[2], scl.iData[3], scl.iData[4], scl.iData[5], scl.iData[6]); + CWM_OS_dbgPrintf("[DBG] ach: %d\n", scl.iData[7]); +#if USE_P813 + os_api api = { + .GetTimeNs = CWM_OS_GetTimeNs, + .dbgOutput = CWM_OS_dbgOutput, + .i2cRead = CWM_OS_i2cRead, + .i2cWrite = CWM_OS_i2cWrite, + .uSleep = CWM_OS_uSleep, + .free = CWM_OS_free, + .malloc = CWM_OS_malloc, + .spiRead = NULL, + .spiWrite = NULL, + }; + CWM_LibPreInit(&api); + +#else + OsAPI apiOS = { + .GetTimeNs = CWM_OS_GetTimeNs, + .dbgOutput = CWM_OS_dbgOutput, + .i2cRead = CWM_OS_i2cRead, + .i2cWrite = CWM_OS_i2cWrite, + .uSleep = CWM_OS_uSleep, + .free = CWM_OS_free, + .malloc = CWM_OS_malloc, + .i2cTransfer = CWM_OS_i2cTransfer, + .restoreData = CWM_OS_restoreData, + .saveData = CWM_OS_saveData, + .spiRead = NULL, + .spiWrite = NULL, + .securityCodeWrite = NULL, + .setGpio = NULL, + .enableGpioIRQ = NULL, + .disableGpioIRQ = NULL, + }; + CWM_LibPreInit(&apiOS); +#endif + //CWM_OS_dbgPrintf("[DBG] %s %d\n", __func__,__LINE__); + + //set mcu_chip information, must call this before CWM_LibPostInit() + memset(&scl, 0, sizeof(scl)); scl.iData[0] = 1; - scl.iData[2] = 4; - scl.iData[3] = 4; + scl.iData[1] = 2; // 0: mcu_auto_detect 2: skip_mcu_auto_detect + CWM_SettingControl(SCL_CHIP_VENDOR_CONFIG, &scl); + //CWM_OS_dbgPrintf("[DBG] %s %d\n", __func__,__LINE__); + + CWM_LibPostInit(CWM_AP_SensorListen); + //CWM_OS_dbgPrintf("[DBG] %s %d\n", __func__,__LINE__); + + //get chip information + char chipInfo[64]; + + memset(&scl, 0, sizeof(scl)); + scl.iData[0] = 1; + scl.iData[1] = 1; + scl.iData[2] = (int)chipInfo; + scl.iData[3] = sizeof(chipInfo); + scl.iData[4] = 0; scl.iData[5] = 0; scl.iData[6] = 0; - scl.iData[7] = 0; - scl.iData[8] = 0; + CWM_SettingControl(SCL_GET_CHIP_INFO, &scl); + CWM_OS_dbgPrintf("have_security = %d.%d ret_buff_size = %d chipInfo = %s\n", scl.iData[5], scl.iData[6], scl.iData[4], chipInfo); + CWM_OS_dbgPrintf("chip_settings = %d, %d, %d\n", scl.iData[9], scl.iData[10], scl.iData[11]); + //CWM_OS_dbgPrintf("[DBG] %s %d\n", __func__,__LINE__); - scl.iData[10] = 1; - scl.iData[11] = 1; - scl.iData[12] = 60; - scl.iData[13] = 120; - CWM_SettingControl(SCL_PEDO_CONFIG, &scl); + CWM_Dml_LibInit(); + //CWM_OS_dbgPrintf("[DBG] %s %d\n", __func__,__LINE__); -/* -int[0] = 1 -int[1] = 卡路里計算是否包含基礎卡路里 (default: 不包含基礎卡路里) - (0: default, 1:包含基礎卡路里, 2:不包含基礎卡路里) -int[2] = 一般模式1001是否使用心率來計算卡路里 (default: 不使用心率) - (0: default, 1: 使用心率, 2:不使用心率) -int[3] = 靜態運動時是否持續計算卡路里 (default: 停止計算) - (0: default, 1: 持續計算, 2: 停止計算) -int[4] = 運動模式(包含一般模式1001)時,脫錶後是否持續計算卡路里 (default: 持續計算) - (0: default, 1: 持續計算, 2: 停止計算) -int[5] = ar_model (default: on) - (0: default, 1: on, 2: off) -int[6] = ar_pedo_mode (default: 平衡) - (0: 平衡, 1: 計步優先, 2: 防誤觸優先) -int[7] = 靜止時是否持續計算卡路里 (default: 持續計算) - (0: default, 1: 持續計算, 2: 停止計算) -int[8] = motionSensScale活動量的靈敏度 (default: 4) - (0: default, 1: 最靈敏, 2, 3, 4, 5, 6, 7: 最不靈敏) -int[9] = 軸向判斷 (default: 有軸向判斷) - (0: default, 1: 無軸向判斷, 2: 有軸向判斷) -int[10] = 感測器雜訊度等級 (default: 低雜訊) - (0: 低雜訊, 1: 高雜訊A, 2 - 4, 5: 高雜訊E) -*/ + #ifdef AP_ENABLE_DML_SDO_LISTEN + // This API allows customers to develop custom features. + // Specific settingControl commands needs to be called for this API to work. + // No need to enable or implement this function for general usage. + CWM_Dml_sensorDataOutput_register(CWM_AP_dmlSensorDataOutput_listen); + #endif + //CWM_OS_dbgPrintf("[DBG] %s %d\n", __func__,__LINE__); + + memset(&scl, 0, sizeof(scl)); + scl.iData[0] = 1; + CWM_SettingControl(SCL_DML_GET_LIB_INFO, &scl); + CWM_OS_dbgPrintf("dml version:%d.%d.%d.%d product:%d model:%d\n", scl.iData[1], scl.iData[2], scl.iData[3], scl.iData[4], scl.iData[5], scl.iData[6]); + + //CWM_OS_dbgPrintf("[DBG] %s %d\n", __func__,__LINE__); + + memset(&scl, 0, sizeof(scl)); + scl.iData[0] = 1; + scl.iData[1] = 18; //00000000000000000000000000010010 高位在前 + // CWM_SettingControl(SCL_DML_DEBUG, &scl); + + //设置acc gyro 相关参数 + memset(&scl, 0, sizeof(scl)); + scl.iData[0] = 1; + scl.iData[3] = 2; + scl.iData[4] = 2; //1 anytime 2 fifo + scl.iData[6] = 5; //先設定5 + scl.iData[7] = 5; + scl.iData[8] = 52; // for st sensor(52Hz) + CWM_SettingControl(SCL_DML_DRV_AG_CONFIG, &scl); + //CWM_OS_dbgPrintf("[DBG] %s %d\n", __func__,__LINE__); + + //设定搜寻哪种型号的传感器,以及要搜寻的属性 + memset(&scl, 0, sizeof(scl)); + scl.iData[0] = 1; + scl.iData[1] = 2; + scl.iData[6] = 3002502; + scl.iData[7] = (0|1|8|256|1024); + CWM_SettingControl(SCL_DML_DRV_HW_CONFIG, &scl); + //CWM_OS_dbgPrintf("[DBG] %s %d\n", __func__,__LINE__); + + //搜寻是否接入传感器 + memset(&scl, 0, sizeof(scl)); + scl.iData[0] = 1; + scl.iData[1] = 1; + CWM_SettingControl(SCL_DML_DRV_INIT, &scl); + CWM_OS_dbgPrintf("DML device=%d\n", scl.iData[2]); + + //获取初始化 driver清单 + memset(&scl, 0, sizeof(scl)); + scl.iData[0] = 1; + CWM_SettingControl(SCL_DML_GET_INITED_LIST, &scl); + //CWM_OS_dbgPrintf("[DBG] %s %d\n", __func__,__LINE__); + + for (i = 0; i < scl.iData[2]; i ++) { + + CWM_OS_dbgPrintf("DML device[%d]: hw_id=%d hw_attr=%d\n", i, scl.iData[6 + i * 2], scl.iData[7 + i * 2]); + } + + //配置跑步机模式相关参数(进入跑步机模式自动生效) memset(&scl, 0, sizeof(scl)); scl.iData[0] = 1; CWM_SettingControl(SCL_PEDO_CONFIG, &scl); -/* -SCL_SLEEP_CONFIG -int[0] = 1 -int[1] = reserved -int[2] = 是否使用心率來判斷睡眠狀態 (default: 不使用心率) -(0: default, 1: 使用心率, 2: 不使用心率) -int[3] = 入睡難易度 (default: 4) -(0: default, 1:不容易入睡, 2, 3, 4:標準, 5, 6, 7:容易入睡) -int[4] = 出睡難易度 (default: 4) -(0: default, 1:不容易出睡, 2, 3, 4:標準, 5, 6, 7:容易出睡) -int[5] = reserved -int[6] = 清醒難易度 (default: 4) -(0: default, 1:不容易清醒, 2, 3, 4:標準, 5, 6, 7:容易清醒) -int[7] = 硬體訊號等級 (default: 1) - (0: default, 1: 低雜訊, 2, 3, 4, 5, 6, 7: 高雜訊) -int[8] = reserved -int[9] = 睡眠間距 (default: 60) - (0: default, 1 - 180) -int[10] = 無心率時是否輸出REM (default: 會輸出REM) - (0: default, 1: 禁止輸出REM, 2: 會輸出REM) -int[11] = 長時間小睡 (default: turn_off) - (0: default, 1: turn_on, 2: turn_off) -int[12] = 靜態活動角度靈敏度 (default: 13) - (0: default, 1: 較難入睡 - 30: 容易入睡) -*/ + memset(&scl, 0, sizeof(scl)); + scl.iData[0] = 1; + CWM_SettingControl(SCL_ACTIVITY_CONFIG, &scl); - // memset(&scl, 0, sizeof(scl)); - // scl.iData[0] = 1; - // scl.iData[3] = 7; - // scl.iData[4] = 7; - // scl.iData[6] = 7; - // scl.iData[7] = 7; - // scl.iData[9] = 1; - // CWM_SettingControl(SCL_SLEEP_CONFIG, &scl); + memset(&scl, 0, sizeof(scl)); + scl.iData[0] = 1; + CWM_SettingControl(SCL_SLEEP_CONFIG, &scl); -/* -SCL_REQ_SLEEPING_DATA -int[0] = 1 -int[1] = terminate_sleep -(0: 立刻輸出狀態,但不中止此段睡眠偵測, -1: 立刻輸出狀態,並中止此段睡眠偵測) -*/ - // memset(&scl, 0, sizeof(scl)); - // scl.iData[0] = 1; - // scl.iData[1] = 1; - // CWM_SettingControl(SCL_REQ_SLEEPING_DATA, &scl); + + memset(&scl, 0, sizeof(scl)); + scl.iData[0] = 1; + CWM_SettingControl(SCL_REQ_SLEEPING_DATA, &scl); /* SCL_INACTIVITY_CONFIG @@ -844,64 +754,64 @@ int[1] = 感測器雜訊度等級 (default: 低雜訊) scl.iData[1] = 1; CWM_SettingControl(SCL_INACTIVITY_CONFIG, &scl); - /* - SCL_DATE_TIME - int[0] = 1 - int[1] = year (1900 - 2100) - int[2] = month (1 - 12) - int[3] = day (1 - 31) - int[4] = hour (0 - 23) - int[5] = minute (0 - 59) - int[6] = second (0 - 59) - */ - - // char databuf[64] = {0}; - // int year,month,day,hour,min,sec; - // uapi_get_yyyymmddhhmmss_Date(databuf); - // PRINT("databuf : %s \r\n",databuf); - // sscanf(databuf, "%4d%2d%2d%2d%2d%2d", &year, &month, &day, &hour, &min, &sec); - // memset(&scl, 0, sizeof(scl)); - // scl.iData[0] = 1; - // scl.iData[1] = year; - // scl.iData[2] = month; - // scl.iData[3] = day; - // scl.iData[4] = hour; - // scl.iData[5] = min; - // scl.iData[6] = sec; - // CWM_SettingControl(SCL_DATE_TIME, &scl); - -/* -SCL_SEDENTARY -int[0] = 1 -int[1] = reserved -int[2] = is_reminder_on (提醒功能)(default: turn_off) - (0: default, 1: turn on, 2: turn off) -int[3] = reminder_time (minutes)(提醒時間)(default: 5) - (0:default, 1 - 10) -int[4] = release_level (解除久坐狀態的等級)(default: 3) - (0:default, 1:容易解除, 2, 3, 4, 5:不容易解除) -int[5] = release_mode (解除久坐的算法模式)(default: 行走模式) - (0: default, 1: 行走模式, 2: 活動量模式) + //设置久坐参数 + memset(&scl, 0, sizeof(scl)); + scl.iData[0] = 1; + CWM_SettingControl(SCL_SEDENTARY, &scl); -*/ + + //设置抬腕功能 memset(&scl, 0, sizeof(scl)); scl.iData[0] = 1; + // scl.iData[1] = 5; + // scl.iData[2] = 5; + // scl.iData[3] = 5; + // scl.iData[4] = 5; + CWM_SettingControl(SCL_HAND_UPDOWN_CONFIG, &scl); + + //呼叫任一個CWM_Sensor_Enable 前呼叫此指令 设置手动或自动模式 + memset(&scl, 0, sizeof(scl)); + scl.iData[0] = 1; + scl.iData[1] = 1; + // int[2] = 3,代表開啟acc和gyro感測器 1代表开启acc scl.iData[2] = 1; - scl.iData[3] = 1; - scl.iData[4] = 3; - scl.iData[5] = 1; - CWM_SettingControl(SCL_SEDENTARY, &scl); + CWM_SettingControl(SCL_DML_DRV_ENABLE, &scl); + //CWM_OS_dbgPrintf("[DBG] %s %d\n", __func__,__LINE__); + memset(&scl, 0, sizeof(scl)); + scl.iData[0] = 1; + scl.iData[3] = 3; + scl.iData[4] = 5; + // CWM_SettingControl(SCL_LOG, &scl); + + CWM_Sensor_Enable(IDX_REQUEST_SENSOR); + // //CWM_OS_dbgPrintf("[DBG] %s %d\n", __func__,__LINE__); + CWM_Sensor_Enable(IDX_ALGO_INACTIVITY_OUTPUT); + + CWM_Sensor_Enable(IDX_ALGO_ACTIVITY_OUTPUT); - g_cywee_hrs_timer = osTimerNew((osTimerFunc_t)cywee_hrs_check_timer_callback, osTimerPeriodic, NULL, NULL); - //g_cywee_wearstatus_timer = osTimerNew((osTimerFunc_t)cywee_wearstatus_check_timer_callback, osTimerPeriodic, NULL, NULL); - g_cywee_oncharging_timer = osTimerNew((osTimerFunc_t)cywee_oncharging_check_timer_callback, osTimerPeriodic, NULL, NULL); + CWM_Sensor_Enable(IDX_ACCEL); + //CWM_OS_dbgPrintf("[DBG] %s %d\n", __func__,__LINE__); + // CWM_Sensor_Enable(IDX_GYRO); + CWM_Sensor_Enable(IDX_ALGO_NO_MOTION); + //CWM_OS_dbgPrintf("[DBG] %s %d\n", __func__,__LINE__); + // CWM_Sensor_Enable(IDX_ALGO_ANY_MOTIOIN); + CWM_Sensor_Enable(IDX_ALGO_ABSOLUTE_STATIC); + //CWM_OS_dbgPrintf("[DBG] %s %d\n", __func__,__LINE__); + CWM_Sensor_Enable(IDX_ALGO_WATCH_HANDUP); + memset(&scl, 0, sizeof(scl)); + scl.iData[0] = 1; + scl.iData[1] = SPORT_ACTIVE_MODE_NORMAL; + CWM_SettingControl(SCL_SET_ACTIVITY_MODE, &scl); + // CWM_SettingControl(SCL_SET_INACTIVITY_MODE, &scl); + //CWM_OS_dbgPrintf("[DBG] %s %d\n", __func__,__LINE__); - cyw_mode_init(cmd); + // cyw_activity_mode_change(cmd); + // cyw_inactivity_mode_change(); // memset(&scl, 0, sizeof(scl)); // scl.iData[0] = 1; // scl.iData[1] = SPORT_ACTIVE_MODE_NORMAL; //ACTIVITY_MODE_NORMAL 1001 @@ -909,6 +819,8 @@ int[5] = release_mode (解除久坐的算法模式)(default: 行走模式) // CWM_SettingControl(SCL_SET_INACTIVITY_MODE, &scl); //CWM_OS_dbgPrintf("[DBG] %s %d\n", __func__,__LINE__); + + return 0; }