更新:电流校准 初始化&使能 逻辑调整

This commit is contained in:
吴俊潮 2025-04-09 18:10:57 +08:00
parent a242044b5f
commit 7336ee4e44
1 changed files with 13 additions and 6 deletions

View File

@ -123,6 +123,12 @@ void analog_ctrl(void)
ee_writefloats(AO_1_SAVE_ADDR, AO_1_table); ee_writefloats(AO_1_SAVE_ADDR, AO_1_table);
ee_writefloats(AO_2_SAVE_ADDR, AO_2_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; 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) void current_output_calibrate_init(void)
{ {
ao_cal_interval = ( (float)(AO_CAL_END - AO_CAL_START) ) / ( (float)SECTION_NUM ); 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) 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) 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) 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: case AO_0:
{ {
if(AO_0_table[0] == -1) if(AO_init_flag[AO_0] == -1)
{ {
result = target; result = target;
return result; return result;
@ -287,7 +294,7 @@ float current_output_calibrate(uint8_t tag, float target)
case AO_1: case AO_1:
{ {
if(AO_1_table[0] == -1) if(AO_init_flag[AO_1] == -1)
{ {
result = target; result = target;
return result; return result;
@ -310,7 +317,7 @@ float current_output_calibrate(uint8_t tag, float target)
case AO_2: case AO_2:
{ {
if(AO_2_table[0] == -1) if(AO_init_flag[AO_2] == -1)
{ {
result = target; result = target;
return result; return result;