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

@@ -327,7 +327,7 @@
<bEvRecOn>1</bEvRecOn> <bEvRecOn>1</bEvRecOn>
<bSchkAxf>0</bSchkAxf> <bSchkAxf>0</bSchkAxf>
<bTchkAxf>0</bTchkAxf> <bTchkAxf>0</bTchkAxf>
<nTsel>6</nTsel> <nTsel>4</nTsel>
<sDll></sDll> <sDll></sDll>
<sDllPa></sDllPa> <sDllPa></sDllPa>
<sDlgDll></sDlgDll> <sDlgDll></sDlgDll>
@@ -338,13 +338,13 @@
<tDlgDll></tDlgDll> <tDlgDll></tDlgDll>
<tDlgPa></tDlgPa> <tDlgPa></tDlgPa>
<tIfile></tIfile> <tIfile></tIfile>
<pMon>STLink\ST-LINKIII-KEIL_SWO.dll</pMon> <pMon>Segger\JL2CM3.dll</pMon>
</DebugOpt> </DebugOpt>
<TargetDriverDllRegistry> <TargetDriverDllRegistry>
<SetRegEntry> <SetRegEntry>
<Number>0</Number> <Number>0</Number>
<Key>ST-LINKIII-KEIL_SWO</Key> <Key>ST-LINKIII-KEIL_SWO</Key>
<Name>-U52FF6E065266545441081687 -O206 -SF4000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P1 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_512.FLM -FS08000000 -FL080000 -FP0($$Device:STM32F103RC$Flash\STM32F10x_512.FLM)</Name> <Name>-U52FF6E065266545441081687 -O206 -SF500 -C0 -A0 -I0 -HNlocalhost -HP7184 -P1 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_512.FLM -FS08000000 -FL080000 -FP0($$Device:STM32F103RC$Flash\STM32F10x_512.FLM)</Name>
</SetRegEntry> </SetRegEntry>
<SetRegEntry> <SetRegEntry>
<Number>0</Number> <Number>0</Number>
@@ -359,7 +359,7 @@
<SetRegEntry> <SetRegEntry>
<Number>0</Number> <Number>0</Number>
<Key>DLGUARM</Key> <Key>DLGUARM</Key>
<Name>(105=-1,-1,-1,-1,0)</Name> <Name>d</Name>
</SetRegEntry> </SetRegEntry>
<SetRegEntry> <SetRegEntry>
<Number>0</Number> <Number>0</Number>
@@ -459,12 +459,6 @@
<pszMrulep></pszMrulep> <pszMrulep></pszMrulep>
<pSingCmdsp></pSingCmdsp> <pSingCmdsp></pSingCmdsp>
<pMultCmdsp></pMultCmdsp> <pMultCmdsp></pMultCmdsp>
<SystemViewers>
<Entry>
<Name>System Viewer\DAC</Name>
<WinId>35905</WinId>
</Entry>
</SystemViewers>
<DebugDescription> <DebugDescription>
<Enable>1</Enable> <Enable>1</Enable>
<EnableFlashSeq>1</EnableFlashSeq> <EnableFlashSeq>1</EnableFlashSeq>
@@ -1965,7 +1959,7 @@
<Group> <Group>
<GroupName>coder</GroupName> <GroupName>coder</GroupName>
<tvExp>0</tvExp> <tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel> <cbSel>0</cbSel>
<RteFlg>0</RteFlg> <RteFlg>0</RteFlg>

View File

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

View File

@@ -14,6 +14,38 @@
#include "stm32f10x_tim.h" #include "stm32f10x_tim.h"
#include "stm32f10x_dac.h" #include "stm32f10x_dac.h"
#include "stm32f10x_i2c.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 UNUSED(X) (void)X
#define SoftVersion 0x000D #define SoftVersion 0x000D

View File

@@ -139,7 +139,8 @@ array_def *elec_bootinfo(void)
Ye_BoardCheck(); Ye_BoardCheck();
board_st.hard_v=sys_param()->hard_version; board_st.hard_v=sys_param()->hard_version;
board_st.resistor_diff=sys_param()->resistor_diff; 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); board_st.soft_v=(int)(str_atof(SOFT_VERSION)*100);
array_def *r=arr_creat(); array_def *r=arr_creat();
arr_append(r,0); 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_LEN 200
#define ADC1_SAMPLE_BUF_LEN2 20 #define ADC1_SAMPLE_BUF_LEN2 20
volatile uint16_t FireBus_ADC_Buf[FIREBUS_ADC_BUF_LEN]; 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]; uint16_t aus_sample[32];
uint8_t uc_index = 0; uint8_t uc_index = 0;
const static float resistor_cur = 2.49f; const static float resistor_cur = 2.49f;
const static float res_mutli = 79.7; const static float res_mutli = RES_MULTIPLE;
/* /*
Gpio_ResistorSwitch Gpio_ResistorSwitch
@param 0 全关 @param 0 全关

View File

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