From dc92f48f75f067bcaf29a826f6918c232e40a08c Mon Sep 17 00:00:00 2001 From: ranchuan Date: Tue, 17 Oct 2023 18:03:00 +0800 Subject: [PATCH] =?UTF-8?q?mystring.c=20=E6=B7=BB=E5=8A=A0=E5=AD=97?= =?UTF-8?q?=E7=AC=A6=E4=B8=B2=E8=BD=AC=E6=B5=AE=E7=82=B9=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- checher_slave.uvoptx | 4 ++-- source/ReadMe.txt | 2 ++ source/elec_det/elec_det.c | 9 ++++--- source/main/compiler_info.h | 4 ++-- source/main/main.c | 4 ++-- source/prebuild.py | 2 +- source/soft/mystring.c | 48 ++++++++++++++++++++++++++++++++++++- source/soft/mystring.h | 1 + 8 files changed, 61 insertions(+), 13 deletions(-) diff --git a/checher_slave.uvoptx b/checher_slave.uvoptx index 8a9c3ec..f518321 100644 --- a/checher_slave.uvoptx +++ b/checher_slave.uvoptx @@ -299,7 +299,7 @@ 1 0 - 0 + 1 18 @@ -529,7 +529,7 @@ 1 0 - 1 + 0 18 diff --git a/source/ReadMe.txt b/source/ReadMe.txt index 3a23b50..c22658e 100644 --- a/source/ReadMe.txt +++ b/source/ReadMe.txt @@ -216,4 +216,6 @@ 解决自动更新bootloader死机的问题 软件版本2.00 解决检测任务中重试失败后不会填充返回值的bug +2023.10.17 + mystring.c 添加字符串转浮点函数 diff --git a/source/elec_det/elec_det.c b/source/elec_det/elec_det.c index ddc92fd..c0cf754 100644 --- a/source/elec_det/elec_det.c +++ b/source/elec_det/elec_det.c @@ -5,6 +5,7 @@ #include "debug.h" #include "stdlib.h" #include "dev_flash.h" +#include "compiler_info.h" #include "elec_det.h" #include "base/delay.h" @@ -138,7 +139,7 @@ array_def *elec_bootinfo(void) Ye_BoardCheck(); board_st.hard_v=sys_param()->hard_version; board_st.resistor_diff=sys_param()->resistor_diff; - board_st.hard_v=19; + board_st.soft_v=(int)(str_atof(SOFT_VERSION)*100); array_def *r=arr_creat(); arr_append(r,0); arr_appends(r,&board_st,sizeof(BoartCheck_st)); @@ -404,13 +405,11 @@ array_def *elec_check_with_scheme(array_def *uid_psw) checker_runcfg.excue_rtv=1; task_fun(); Checker_Excueindex(task_index); + checker_runcfg.rtv_index-=checker_runcfg.rtv_count; if(checker_runcfg.excue_rtv==0) break; - checker_runcfg.rtv_index-=checker_runcfg.rtv_count; - } - if(checker_runcfg.excue_rtv){ - checker_runcfg.rtv_index+=checker_runcfg.rtv_count; } + checker_runcfg.rtv_index+=checker_runcfg.rtv_count; DBG_LOG("task_index:%d,taskid:%d,ret=%d,rtv_index=%d.",task_index,taskid,checker_runcfg.excue_rtv, checker_runcfg.rtv_index); diff --git a/source/main/compiler_info.h b/source/main/compiler_info.h index 1f7d8c8..0c5c5e8 100644 --- a/source/main/compiler_info.h +++ b/source/main/compiler_info.h @@ -6,8 +6,8 @@ -#define BUILD_DATE "2023-10-16 18:50:56" -#define SOFT_VERSION "2.00" +#define BUILD_DATE "2023-10-17 09:42:57" +#define SOFT_VERSION "2.01" diff --git a/source/main/main.c b/source/main/main.c index 09a85d9..6d1b1b4 100644 --- a/source/main/main.c +++ b/source/main/main.c @@ -90,8 +90,8 @@ static int test(list_def *argv) cmd_print("param num too less."); return -1; } - int num=str_atoi(list_get_str(argv,1)); - cmd_print("test num=%d,hex=%x",num,num); + float num=str_atof(list_get_str(argv,1)); + cmd_print("test num=%f",num); return 0; } //commend_export(test,test,"cmd test") diff --git a/source/prebuild.py b/source/prebuild.py index 1023078..2c9024a 100644 --- a/source/prebuild.py +++ b/source/prebuild.py @@ -7,7 +7,7 @@ import mycopy # 定义软件版本号 -SOFT_VERION = "2.00" +SOFT_VERION = "2.01" diff --git a/source/soft/mystring.c b/source/soft/mystring.c index 108bad5..4ce0dde 100644 --- a/source/soft/mystring.c +++ b/source/soft/mystring.c @@ -132,7 +132,7 @@ static int str_ainttoi(const char *s) ret*=10; ret+=*s-'0'; } - else return ret; + else return ret*sig; s++; } return ret*sig; @@ -226,6 +226,52 @@ list_def *str_atod_list(const char *s, char c) +/* +* +* 计算整数乘方 +* +*/ +float str_exp(int a,int b) +{ + int n=1; + for(int i=0;i