添加 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

@@ -228,3 +228,5 @@
解决检测后立即赋码会直接返回成功的bug
2023.10.26
版本号2.03JQ_UID_PWD_Bind 不注码时返回成功
2023.10.27
添加 HARD_VERSION 宏根据硬件版本不同来确定power参数

View File

@@ -14,6 +14,38 @@
#include "stm32f10x_tim.h"
#include "stm32f10x_dac.h"
#include "stm32f10x_i2c.h"
// 设置硬件版本
#define HARD_VERSION 2
#if HARD_VERSION==1
// 电压倍数旧板子21 新板子11
#define V_PARAM_1 21
// 参数2 旧板子143 新板子178
#define V_PARAM_2 143
// 电阻放大倍数 旧板子16 新板子79.7
#define RES_MULTIPLE 16
#elif HARD_VERSION==2
// 电压倍数旧板子21 新板子11
#define V_PARAM_1 11
// 参数2 旧板子143 新板子178
#define V_PARAM_2 178
// 电阻放大倍数 旧板子16 新板子79.7
#define RES_MULTIPLE 79.7
#endif
#define UNUSED(X) (void)X
#define SoftVersion 0x000D

View File

@@ -139,7 +139,8 @@ 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=rt_tick_get()/1000;
//board_st.hard_v=rt_tick_get()/1000;
board_st.hard_v=HARD_VERSION;
board_st.soft_v=(int)(str_atof(SOFT_VERSION)*100);
array_def *r=arr_creat();
arr_append(r,0);

View File

@@ -8,6 +8,8 @@ volatile uint16_t ad0_adc_sample[AD_SCAN_SAMPLE*AD_SCAN_COUNT];
#define ADC1_SAMPLE_BUF_LEN 200
#define ADC1_SAMPLE_BUF_LEN2 20
volatile uint16_t FireBus_ADC_Buf[FIREBUS_ADC_BUF_LEN];
@@ -499,7 +501,7 @@ void AD_SampleResistor(uint16_t* channels_re)
uint16_t aus_sample[32];
uint8_t uc_index = 0;
const static float resistor_cur = 2.49f;
const static float res_mutli = 79.7;
const static float res_mutli = RES_MULTIPLE;
/*
Gpio_ResistorSwitch
@param 0 全关

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);

View File

@@ -6,7 +6,7 @@
#define BUILD_DATE "2023-10-26 17:51:06"
#define BUILD_DATE "2023-10-27 18:16:13"
#define SOFT_VERSION "2.03"