From 7336ee4e441801a0b789df534683c3ef5b0277a8 Mon Sep 17 00:00:00 2001 From: wujunchao Date: Wed, 9 Apr 2025 18:10:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=EF=BC=9A=E7=94=B5=E6=B5=81?= =?UTF-8?q?=E6=A0=A1=E5=87=86=20=E5=88=9D=E5=A7=8B=E5=8C=96&=E4=BD=BF?= =?UTF-8?q?=E8=83=BD=20=E9=80=BB=E8=BE=91=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- users/Src/provalctrl.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/users/Src/provalctrl.c b/users/Src/provalctrl.c index 14085ae..b4fb51f 100644 --- a/users/Src/provalctrl.c +++ b/users/Src/provalctrl.c @@ -123,6 +123,12 @@ void analog_ctrl(void) ee_writefloats(AO_1_SAVE_ADDR, AO_1_table); ee_writefloats(AO_2_SAVE_ADDR, AO_2_table); + AO_init_flag[AO_0] = 0; + AO_init_flag[AO_1] = 0; + AO_init_flag[AO_2] = 0; + + current_output_calibrate_init(); + ao_ee_save_flag = 0; } @@ -227,6 +233,7 @@ void analog_ctrl(void) } +int8_t AO_init_flag[3] = {0}; void current_output_calibrate_init(void) { ao_cal_interval = ( (float)(AO_CAL_END - AO_CAL_START) ) / ( (float)SECTION_NUM ); @@ -242,15 +249,15 @@ void current_output_calibrate_init(void) if( abs_bias( AO_0_table[0] - AO_table[0] ) > 1) { - AO_0_table[0] = -1; + AO_init_flag[AO_0] = -1; } if( abs_bias( AO_1_table[0] - AO_table[0] ) > 1) { - AO_1_table[0] = -1; + AO_init_flag[AO_1] = -1; } if( abs_bias( AO_2_table[0] - AO_table[0] ) > 1) { - AO_2_table[0] = -1; + AO_init_flag[AO_2] = -1; } } @@ -264,7 +271,7 @@ float current_output_calibrate(uint8_t tag, float target) { case AO_0: { - if(AO_0_table[0] == -1) + if(AO_init_flag[AO_0] == -1) { result = target; return result; @@ -287,7 +294,7 @@ float current_output_calibrate(uint8_t tag, float target) case AO_1: { - if(AO_1_table[0] == -1) + if(AO_init_flag[AO_1] == -1) { result = target; return result; @@ -310,7 +317,7 @@ float current_output_calibrate(uint8_t tag, float target) case AO_2: { - if(AO_2_table[0] == -1) + if(AO_init_flag[AO_2] == -1) { result = target; return result;