添加 HARD_VERSION 宏,根据硬件版本不同来确定power参数

This commit is contained in:
ranchuan
2023-10-27 18:47:02 +08:00
parent 831a002bca
commit 6e00039d60
7 changed files with 49 additions and 17 deletions

View File

@@ -12,6 +12,7 @@ static volatile float f_cur_b;
static volatile uint8_t uc_power_cal_flag = 0;
volatile PowerInfo_st powerinfo_arrayst[POWER_SET_COUNT] ;
/*
@brief 获取内部基准1.2V电压对应的AD
*/
@@ -77,7 +78,7 @@ uint32_t Power_GetHPowerV()
Bubble_Sort_u16(adv_buf,10);
adv = (adv_buf[4]+adv_buf[5]+adv_buf[6]+adv_buf[7])>>2;
adv = Power_ADVGetCalVal_106(adv);
adv = adv*11/100000;
adv = adv*V_PARAM_1/100000;
return adv;
}
@@ -128,7 +129,7 @@ uint32_t Power_GetMPowerV()
Bubble_Sort_u16(adv_buf,10);
adv = (adv_buf[4]+adv_buf[5]+adv_buf[6]+adv_buf[7])>>2;
adv = Power_ADVGetCalVal_106(adv);
adv = adv*11/100000;
adv = adv*V_PARAM_1/100000;
return adv;
}
@@ -340,7 +341,7 @@ void PowerCalibration(PowerInfo_st* info_st)
vlp = info_st->V_LAH;
vlp /= 10;
//(VLP-1.229V)/178K + (VDAC-1.229V)/20K = 0.1229mA
v_adc_h =( 0.1229- (vlp-1.229)/178)*20+1.229;
v_adc_h =( 0.1229- (vlp-1.229)/V_PARAM_2)*20+1.229;
us_timeout = 80;
info_st->V_LAH_DAC = 0;
us_basedac_h = (uint16_t)( v_adc_h/3.3 * 4096);