|
@@ -11,8 +11,9 @@ extern volatile uint32_t LedTimerCnt;
|
11
|
11
|
extern volatile uint32_t AdcTimerCnt;
|
12
|
12
|
extern void PE43711_atten_ctrl(PE43711_st ATT ,uint8_t data);
|
13
|
13
|
extern void Uart1_Data_Send(uint8_t* data,uint8_t size);
|
14
|
|
-nt8_t AutoControl_ADC_Compare(double CurrentAdc,uint8_t* CompareAdc,uint8_t size);
|
15
|
|
-
|
|
14
|
+int8_t AutoControl_ADC_Compare(double CurrentAdc,uint8_t* CompareAdc,uint8_t size);
|
|
15
|
+void Bluecell_StructCpy(uint8_t* dst,uint8_t* src,uint16_t size);
|
|
16
|
+void DataStatusSet(void);
|
16
|
17
|
uint8_t Alarm_Status[MAX_ALARM_Len] = {0,};
|
17
|
18
|
//uint8_t data123[10000];
|
18
|
19
|
uint8_t ResultData[1024] = {0,};
|
|
@@ -272,29 +273,30 @@ void Boot_LED_Toggle(void){
|
272
|
273
|
|
273
|
274
|
|
274
|
275
|
uint8_t PE43711_Calc(uint8_t* Table,uint8_t high_bit,uint8_t low_bit,uint8_t offset_h,uint8_t offset_l){
|
275
|
|
- uint8_t tmp_h = high_bit,tmp_l = low_bit;
|
|
276
|
+
|
276
|
277
|
double ret = 0;
|
277
|
|
- uint8_t val = 0;
|
|
278
|
+
|
278
|
279
|
ret = PE43711_Double(high_bit,low_bit);
|
279
|
280
|
ret += PE43711_Double(offset_h,offset_l);
|
280
|
281
|
// printf("ret1 : %f \r\n",ret); // 2
|
281
|
282
|
ret = TableAtteGuarantee(Table,ret);//Table Guarantee
|
282
|
283
|
// printf("ret2 : %f \r\n",ret);
|
283
|
|
- val = PE43711_DataToHexConvert(ret);
|
|
284
|
+ PE43711_DataToHexConvert(ret);
|
|
285
|
+ return 0;
|
284
|
286
|
}
|
285
|
287
|
uint8_t PE43711_Calc_NoTable(uint8_t high_bit,uint8_t low_bit){
|
286
|
|
- uint16_t tmp_h = high_bit,tmp_l = low_bit;
|
|
288
|
+
|
287
|
289
|
double ret = 0;
|
288
|
|
- uint8_t val = 0;
|
289
|
|
- ret = PE43711_Double(high_bit,low_bit);
|
290
|
290
|
|
291
|
|
- val = PE43711_DataToHexConvert(ret);
|
|
291
|
+ ret = PE43711_Double(high_bit,low_bit);
|
292
|
292
|
|
|
293
|
+ PE43711_DataToHexConvert(ret);
|
|
294
|
+ return 0;
|
293
|
295
|
}
|
294
|
296
|
double PE43711_Double(uint8_t high_bit,uint8_t low_bit){
|
295
|
297
|
uint16_t tmp_h = 0,tmp_l = 0;
|
296
|
298
|
double ret = 0;
|
297
|
|
- uint8_t val = 0;
|
|
299
|
+
|
298
|
300
|
tmp_h = high_bit;
|
299
|
301
|
tmp_l = low_bit;
|
300
|
302
|
ret = ((tmp_h << 8) & 0xFF00);
|
|
@@ -316,7 +318,7 @@ double PE43711_Double(uint8_t high_bit,uint8_t low_bit){
|
316
|
318
|
uint8_t GuaranteeData[256];
|
317
|
319
|
double TableAtteGuarantee(uint8_t* Table,double AttenValue){
|
318
|
320
|
double ret = 0;
|
319
|
|
- double ref = 0;
|
|
321
|
+ //double ref = 0;
|
320
|
322
|
uint8_t cnt = 0;
|
321
|
323
|
for(double ref = 0; ref < AttenValue; ref += 0.5){
|
322
|
324
|
cnt++;
|
|
@@ -666,6 +668,7 @@ void Bluecell_StructCopyFunction(uint16_t* dst,uint8_t* src,uint16_t size){
|
666
|
668
|
dst[i] += src[i * 2 + 1] & 0x00FF;
|
667
|
669
|
}
|
668
|
670
|
}
|
|
671
|
+
|
669
|
672
|
void Bluecell_StructCpy(uint8_t* dst,uint8_t* src,uint16_t size){
|
670
|
673
|
for(int i = 0; i < size; i++){
|
671
|
674
|
dst[i] = src[i];
|
|
@@ -984,9 +987,9 @@ extern HAL_StatusTypeDef EEPROM_M24C08_Zerowrite(uint8_t devid,uint16_t Address)
|
984
|
987
|
bool Bluecell_Operate(uint8_t* data){
|
985
|
988
|
uint8_t datatype = data[BLUECELL_TYPE];
|
986
|
989
|
|
987
|
|
- uint16_t tmp_h = 0,tmp_l = 0;
|
988
|
|
- double ret = 0 ,tmp = 0.1;
|
989
|
|
- uint8_t val = 0;
|
|
990
|
+
|
|
991
|
+ //double ret = 0 ,tmp = 0.1;
|
|
992
|
+
|
990
|
993
|
uint8_t i = 0;
|
991
|
994
|
switch(datatype){
|
992
|
995
|
case BLUECELL_SOFTWARERESET:
|
|
@@ -1593,15 +1596,15 @@ bool MBIC_Operate(uint8_t* data){
|
1593
|
1596
|
|((data[MBIC_PROT_SUB_DATA_INDEX + 1] << 8) & 0x00FF) );
|
1594
|
1597
|
uint8_t Length = (data[MBIC_PROT_SUB_DATA_INDEX + 2]);
|
1595
|
1598
|
uint8_t cmd = 0;
|
1596
|
|
- uint8_t SubData[256] = {0,};
|
|
1599
|
+
|
1597
|
1600
|
uint16_t Temp_ADC = 0;
|
1598
|
1601
|
uint16_t i = 0;
|
1599
|
1602
|
double temp = 0;
|
1600
|
1603
|
int16_t Level = 0;
|
1601
|
1604
|
/*AID*/
|
1602
|
|
- for(int i = 0; i < Length; i++){
|
|
1605
|
+ /* for(int i = 0; i < Length; i++){
|
1603
|
1606
|
SubData[i] = (data[MBIC_PROT_SUB_DATA_INDEX + 3 + i]);
|
1604
|
|
- }
|
|
1607
|
+ }*/
|
1605
|
1608
|
// SubData 임시 데이터 변수 선언 Subdata로 데이터 전송
|
1606
|
1609
|
if(cmd == MBIC_GET){
|
1607
|
1610
|
/*ALARM FLAG*/
|
|
@@ -1660,7 +1663,7 @@ bool MBIC_Operate(uint8_t* data){
|
1660
|
1663
|
data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.CPU_Bank1_Image_BuildTime6;
|
1661
|
1664
|
|
1662
|
1665
|
for(int a = 0; a < 32; a++){
|
1663
|
|
- data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.CPU_Bank1_Image_Name[i];
|
|
1666
|
+ data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.CPU_Bank1_Image_Name[a];
|
1664
|
1667
|
}
|
1665
|
1668
|
|
1666
|
1669
|
data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.CPU_Bank2_Image_Version1;
|
|
@@ -1675,7 +1678,7 @@ bool MBIC_Operate(uint8_t* data){
|
1675
|
1678
|
data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.CPU_Bank2_Image_BuildTime6;
|
1676
|
1679
|
|
1677
|
1680
|
for(int a = 0; a < 32; a++){
|
1678
|
|
- data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.CPU_Bank2_Image_Name[i];
|
|
1681
|
+ data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.CPU_Bank2_Image_Name[a];
|
1679
|
1682
|
}
|
1680
|
1683
|
|
1681
|
1684
|
data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.S_W_Reset;
|
|
@@ -1694,7 +1697,7 @@ bool MBIC_Operate(uint8_t* data){
|
1694
|
1697
|
data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.PCB_Version[0];
|
1695
|
1698
|
data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.PCB_Version[1];
|
1696
|
1699
|
for(int a = 0; a < 20; a++){
|
1697
|
|
- data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.Serial_Number[i];
|
|
1700
|
+ data[MBIC_PAYLOADSTART + i++] = bluecell_Currdatastatus.Serial_Number[a];
|
1698
|
1701
|
}
|
1699
|
1702
|
|
1700
|
1703
|
|
|
@@ -2464,9 +2467,9 @@ uint16_t ADC1Ret[4];
|
2464
|
2467
|
uint16_t ADC3Ret[5];
|
2465
|
2468
|
|
2466
|
2469
|
void ADC_Check(void){
|
2467
|
|
- static uint8_t Cnt = 0;
|
2468
|
|
- double Volt_Calc_val = 3.3 / 4095;
|
2469
|
|
- double ret = 0;
|
|
2470
|
+ //static uint8_t Cnt = 0;
|
|
2471
|
+
|
|
2472
|
+ // double ret = 0;
|
2470
|
2473
|
uint16_t MIN_ADC[ADC3_CNT] = {0,};
|
2471
|
2474
|
uint16_t cnt[ADC3_CNT] = {0,};
|
2472
|
2475
|
// if(AdcTimerCnt > 10){
|
|
@@ -2736,7 +2739,7 @@ int32_t MinusConvert(uint8_t Temp_h, int32_t Value){
|
2736
|
2739
|
void ALC_Function(){ //DL
|
2737
|
2740
|
double Volt_Calc_val = 3.3 / 4095;
|
2738
|
2741
|
double ret = 0;
|
2739
|
|
- double CurrnALCValue = 0;
|
|
2742
|
+ // double CurrnALCValue = 0;
|
2740
|
2743
|
double CurrentATTENVALUE = 0;
|
2741
|
2744
|
int32_t CurrnALC_MAX_SettingValue = 0;
|
2742
|
2745
|
int32_t CurrnALC_MIN_SettingValue = 0;
|