From eeee6584b643fba0a5129e9be86f0e22aa7dd6d9 Mon Sep 17 00:00:00 2001 From: penglei <1624952103@qq.com> Date: Thu, 19 Dec 2024 18:25:26 +0800 Subject: [PATCH] =?utf8?q?=E6=B7=BB=E5=8A=A0=E5=8A=9F=E8=80=97=E8=AE=B0?= =?utf8?q?=E5=BD=95=EF=BC=9A=E7=94=B5=E9=87=8F=E5=8F=98=E5=8C=96=EF=BC=8C?= =?utf8?q?=E8=BF=90=E5=8A=A8=E6=B5=8B=E9=87=8F=E5=BF=83=E7=8E=87=EF=BC=8C?= =?utf8?q?=E9=A9=AC=E8=BE=BE,=E4=BD=A9=E6=88=B4=E6=A3=80=E6=B5=8B;=20?= =?utf8?q?=E4=BC=98=E5=8C=96debug=E7=95=8C=E9=9D=A2=E7=94=B5=E9=87=8F?= =?utf8?q?=E4=BF=A1=E6=81=AF=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../battery/service/battery_driver.cpp | 4 ++ .../debug_output_notification.cpp | 71 ++++++++++++++++--- .../drivers/peripheral/cywee/src/main_dml.c | 10 ++- .../peripheral/ppg/service/ppg_service.cpp | 4 ++ .../peripheral/rotary_encoder/hx3507/hx3507.c | 2 +- .../peripheral/utils/custom_save_runtime.h | 14 +++- .../vibrator/service/vibrator_service.cpp | 8 ++- 7 files changed, 95 insertions(+), 18 deletions(-) diff --git a/code/sdk/application/battery/service/battery_driver.cpp b/code/sdk/application/battery/service/battery_driver.cpp index 8b6424710..7125b6698 100644 --- a/code/sdk/application/battery/service/battery_driver.cpp +++ b/code/sdk/application/battery/service/battery_driver.cpp @@ -70,6 +70,7 @@ typedef enum { #include "debug_print.h" #include "custom_utils.h" #include +#include "custom_save_runtime.h" #define HAL_ADC_SAMPLE_NUMBER_CONFIG_0 10 /* Channel with buffer manual sample average number. */ #define HAL_ADC_SAMPLE_NUMBER_CONFIG_1 10 /* Channel without buffer manual sample average number. */ @@ -445,6 +446,7 @@ static int battery_get_percent_by_voltage(float voltage) // else if(percent > history_percent && history_percent && abs(history_percent - percent) < 10) else if(percent > history_percent && history_percent) { + uapi_save_runtime_log(RUNTIME_LOG_BATTERY_MIN_UP); // PRINT("2222 charge percent[%d], history_percent[%d] \n",percent,history_percent); history_percent++; percent = history_percent; @@ -466,6 +468,7 @@ static int battery_get_percent_by_voltage(float voltage) // else if(history_percent > percent && abs(history_percent - percent) < 10) else if(history_percent > percent) { + uapi_save_runtime_log(RUNTIME_LOG_BATTERY_MIN_DOWN); // PRINT("2222 uncharge percent[%d], history_percent[%d] \n",percent,history_percent); history_percent--; percent = history_percent; @@ -492,6 +495,7 @@ static int battery_get_percent_by_voltage(float voltage) { if(get_charge_stat() && history_percent < 100 && history_percent) //充电中则均匀增加 { + uapi_save_runtime_log(RUNTIME_LOG_BATTERY_MIN_UP); history_percent++; percent = history_percent; } diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/debug_output_notification/debug_output_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/debug_output_notification/debug_output_notification.cpp index d1ce8280b..81bee57ba 100644 --- a/code/sdk/application/wearable/service/msg_center/src/notify/debug_output_notification/debug_output_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/debug_output_notification/debug_output_notification.cpp @@ -500,32 +500,66 @@ namespace OHOS if(get_battery_percent_flag == 1) { - if(len >= 120) + if(len >= 60) + { + index = 30; + len = 60; + } + else if(len >= 30 && len < 60) + index = 30; + else + return result; + } + else if(get_battery_percent_flag == 2) + { + if(len >= 90) { index = 60; - len = 120; + len = 90; } - else if(len >= 60 && len < 120) + else if(len >= 60 && len < 90) index = 60; else return result; + }else if(get_battery_percent_flag == 3) + { + if(len >= 120) + { + index = 90; + len = 120; + } + else if(len >= 90 && len < 120) + index = 90; + else + return result; + }else if(get_battery_percent_flag == 4) + { + if(len >= 150) + { + index = 120; + len = 150; + } + else if(len >= 120 && len < 150) + index = 120; + else + return result; } - else if(get_battery_percent_flag == 2) + else if(get_battery_percent_flag == 5) { if(len >= 180) { - index = 120; + index = 150; len = 180; } - else if(len >= 120 && len < 180) - index = 120; + else if(len >= 150 && len < 180) + index = 150; else return result; } else { - if(len >= 60) - len = 60; + if(len >= 30) + len = 30; } for(int i = index; i < len; i++) { @@ -542,7 +576,7 @@ namespace OHOS } std::ostringstream oss; - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "data[%d].voltage : %f , data[%d].percent : %d",i,data[i].voltage,i,data[i].percent); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "data[%d].voltage : %f , data[%d].percent : %d",i,data[i].voltage,i,data[i].percent); if(data[i].stat) // charge_stat = static_cast(i) + ":充电中"; @@ -855,9 +889,24 @@ namespace OHOS } else if(get_battery_percent_flag == 2) { - nextorprepageLabelButton->SetText("第一页"); + nextorprepageLabelButton->SetText("第四页"); get_battery_percent_flag = 3; } + else if(get_battery_percent_flag == 3) + { + nextorprepageLabelButton->SetText("第五页"); + get_battery_percent_flag = 4; + } + else if(get_battery_percent_flag == 4) + { + nextorprepageLabelButton->SetText("第六页"); + get_battery_percent_flag = 5; + } + else if(get_battery_percent_flag == 5) + { + nextorprepageLabelButton->SetText("第一页"); + get_battery_percent_flag = 6; + } else { nextorprepageLabelButton->SetText("第二页"); diff --git a/code/sdk/drivers/peripheral/cywee/src/main_dml.c b/code/sdk/drivers/peripheral/cywee/src/main_dml.c index a6e9e03aa..693826b65 100644 --- a/code/sdk/drivers/peripheral/cywee/src/main_dml.c +++ b/code/sdk/drivers/peripheral/cywee/src/main_dml.c @@ -19,6 +19,7 @@ #include "ConfigModelC.h" #include "battery_hal.h" #include "sleep/include/SleepModelC.h" +#include "custom_save_runtime.h" #define AP_ENABLE_DML_SDO_LISTEN @@ -36,6 +37,7 @@ #define WEAR_FILE_COUNT 50 + static gsenson_t gxyz_t; static uint8_t gsenson_falg=0; @@ -885,11 +887,13 @@ void activity_mode_setstatus(int cmd) { send_ppg_cmd_msg(PPG_SERVICE_CMD_TYPE_DO_PPG_TEST); hrs_mode_state = 1; + uapi_save_runtime_log(RUNTIME_LOG_HEART_SPORT_MEASURE); } else { send_ppg_cmd_msg(PPG_SERVICE_CMD_TYPE_STOP_PPG_TEST); hrs_mode_state = 0; + uapi_save_runtime_log(RUNTIME_LOG_OXYGEN_SPORT_MEASURE_END); } } @@ -1148,13 +1152,15 @@ void CWM_AP_SensorListen(pSensorEVT_t sensorEVT) { { // CWM_OS_dbgPrintf("[cwyee] turn_off_screen \n"); mmi_screen_on_off_by_flip_wrist(false); + uapi_save_runtime_log(RUNTIME_LOG_RAISE_MIN_DOWN); } #endif }else if ((int)sensorEVT->fData[1] == 1) { #if defined(SUPPORT_POWER_MANAGER) // CWM_OS_dbgPrintf("[cwyee] turn_on_screen \n"); - mmi_screen_on_off_by_flip_wrist(true); + mmi_screen_on_off_by_flip_wrist(true); + uapi_save_runtime_log(RUNTIME_LOG_RAISE_MIN_UP); #endif } break; @@ -1191,12 +1197,14 @@ void CWM_AP_SensorListen(pSensorEVT_t sensorEVT) { { send_ppg_cmd_msg(PPG_SERVICE_CMD_TYPE_DO_PPG_TEST); hrs_mode_state = 1; + uapi_save_runtime_log(RUNTIME_LOG_HEART_SPORT_MEASURE); // hrs = 0;//运动开始,清零心率 } else { send_ppg_cmd_msg(PPG_SERVICE_CMD_TYPE_STOP_PPG_TEST); hrs_mode_state = 0; + uapi_save_runtime_log(RUNTIME_LOG_OXYGEN_SPORT_MEASURE_END); } } break; diff --git a/code/sdk/drivers/peripheral/ppg/service/ppg_service.cpp b/code/sdk/drivers/peripheral/ppg/service/ppg_service.cpp index 0e4634fa3..2c801e8f2 100644 --- a/code/sdk/drivers/peripheral/ppg/service/ppg_service.cpp +++ b/code/sdk/drivers/peripheral/ppg/service/ppg_service.cpp @@ -48,6 +48,7 @@ extern "C" { #include "cywee_hal.h" #include "cywee_service.h" #include "custom_runtime.h" +#include "custom_save_runtime.h" static bool g_ppg_service_initialled = false; @@ -265,6 +266,7 @@ static void ppg_service_check_task(void *arg) } if((wear_mode_state == 1) && (mail > 0x10) && mail != PPG_SERVICE_CMD_TYPE_STOP_WEAR_MODE_TEST) { + uapi_save_runtime_log(RUNTIME_LOG_WEAR_MIN_STOP); wear_mode_state = 0; ppg_send_cmd_to_driver("wear",0); ppg_service_running_stat = false; @@ -304,6 +306,7 @@ static void ppg_service_check_task(void *arg) enable = 1; }else if (mail == PPG_SERVICE_CMD_TYPE_DO_WEAR_MODE_TEST){ if (keep_in_wear_det_mod == 0) continue;; + uapi_save_runtime_log(RUNTIME_LOG_WEAR_MIN_START); cmd = "wear"; enable = 1; wear_mode_state = 1; @@ -360,6 +363,7 @@ static void ppg_service_check_task(void *arg) { if (keep_in_wear_det_mod == 1) { + uapi_save_runtime_log(RUNTIME_LOG_WEAR_MIN_START); ppg_send_cmd_to_driver("wear",1); wear_mode_state = 1; ppg_service_running_stat = true; diff --git a/code/sdk/drivers/peripheral/rotary_encoder/hx3507/hx3507.c b/code/sdk/drivers/peripheral/rotary_encoder/hx3507/hx3507.c index 7ca2fdfd7..40964636a 100644 --- a/code/sdk/drivers/peripheral/rotary_encoder/hx3507/hx3507.c +++ b/code/sdk/drivers/peripheral/rotary_encoder/hx3507/hx3507.c @@ -329,7 +329,7 @@ void crown_data_handler(void *p_event_data, uint16_t event_size) uint8_t imagqa = crown_read_reg(Img_Qa); uint8_t pdsat = crown_read_reg(PD_SAT); - if (imagqa<100 || imagqa > 180 || pdsat <240){ + if (imagqa<100 || imagqa > 180 || pdsat >=240){ // TYHX_LOG("crown still not pass! pic qulity =%d (should img_qa>=100 && img_qa<=180) , pd saturation=%d (should pd_sat >=240)\r\n",imagqa,pdsat); } diff --git a/code/sdk/drivers/peripheral/utils/custom_save_runtime.h b/code/sdk/drivers/peripheral/utils/custom_save_runtime.h index 0325c7942..df14b0284 100644 --- a/code/sdk/drivers/peripheral/utils/custom_save_runtime.h +++ b/code/sdk/drivers/peripheral/utils/custom_save_runtime.h @@ -1,8 +1,8 @@ /* *@Author:luozheng 1732036298@qq.com *@Date:2024-12-18 10:27:52 - *@LastEditors:luozheng 1732036298@qq.com - *@LastEditTime:2024-12-18 16:53:11 + * @LastEditors: penglei 1624952103@qq.com + * @LastEditTime: 2024-12-19 18:17:33 *@FilePath:/FD230/code/sdk/drivers/peripheral/utils/custom_save_runtime.h */ /** @@ -110,10 +110,16 @@ typedef enum { RUNTIME_LOG_HEART_PASSIVE_MEASURE, //被动测量心率结束 RUNTIME_LOG_OXYGEN_PASSIVE_MEASURE_END, + //运动测量心率开始或继续 + RUNTIME_LOG_HEART_SPORT_MEASURE, + //运动测量心率暂停或结束 + RUNTIME_LOG_OXYGEN_SPORT_MEASURE_END, /*******************************/ //佩戴 RUNTIME_LOG_WEAR_MIN = 0x0600, + RUNTIME_LOG_WEAR_MIN_START = 0x0601, + RUNTIME_LOG_WEAR_MIN_STOP = 0x0602, /*******************************/ //血氧 @@ -130,6 +136,8 @@ typedef enum { RUNTIME_LOG_LCD_OFF, // 0x0802 屏幕灭 //抬腕 RUNTIME_LOG_RAISE_MIN = 0x0900, + RUNTIME_LOG_RAISE_MIN_UP = 0x0901, + RUNTIME_LOG_RAISE_MIN_DOWN = 0x0902, //充电 RUNTIME_LOG_CHARGE_MIN = 0x0A00, @@ -138,6 +146,8 @@ typedef enum { //电池电量变化 RUNTIME_LOG_BATTERY_MIN = 0x0B00, + RUNTIME_LOG_BATTERY_MIN_UP = 0x0B01, + RUNTIME_LOG_BATTERY_MIN_DOWN = 0x0B02, //马达 RUNTIME_LOG_MOTOR_MIN = 0x0C00, diff --git a/code/sdk/drivers/peripheral/vibrator/service/vibrator_service.cpp b/code/sdk/drivers/peripheral/vibrator/service/vibrator_service.cpp index 85e911ce1..d165483be 100644 --- a/code/sdk/drivers/peripheral/vibrator/service/vibrator_service.cpp +++ b/code/sdk/drivers/peripheral/vibrator/service/vibrator_service.cpp @@ -1,8 +1,8 @@ /* * @Author: penglei 1624952103@qq.com * @Date: 2024-08-08 16:33:23 - * @LastEditors: SnickerSun snickersun@163.com - * @LastEditTime: 2024-11-20 16:45:27 + * @LastEditors: penglei 1624952103@qq.com + * @LastEditTime: 2024-12-19 18:04:22 * @FilePath: /FD230/code/sdk/drivers/peripheral/vibrator/service/vibrator_service.cpp * @Description: * @@ -60,10 +60,12 @@ static bool g_batter_service_initialled = false; #include "custom_utils.h" #include "custom_runtime.h" #include "../../../../../drivers/peripheral/config/include/ConfigModelC.h" +#include "custom_save_runtime.h" void custom_VibratorFunc_int(int vibratorType) { - + uapi_save_runtime_log(RUNTIME_LOG_MOTOR_START); + //忽略系统调用参数,只按照configmodel里保存的值来震动 uint8_t vibmod=uapi_dev_runtime_get_vibmod(); vibrator_cmd_t mail = {0}; -- 2.17.1