From 653c2059e2b0da326c9d65958ebf5fd08d418ecd Mon Sep 17 00:00:00 2001 From: YiChin Date: Mon, 1 Jun 2020 16:09:32 +0800 Subject: [PATCH] fix cc mode --- .../cc26xx/app/headstage/EliteCCMode.h | 8 ++++---- .../cc26xx/app/headstage/EliteWorkData.h | 4 ++-- .../cc26xx/app/headstage/Elite_version.h | 4 ++-- .../simple_peripheral/cc26xx/app/headstage/headstage.h | 10 ++++++---- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteCCMode.h b/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteCCMode.h index b709e5d86..862f4cdb0 100644 --- a/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteCCMode.h +++ b/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteCCMode.h @@ -231,9 +231,9 @@ static void CC_Vscan(CCMode *CC){ deltaV = -1 * (deltaI / 1000); //-5 * deltaI / 5000 //pV=> 5nV Vset = Vset + deltaV; //[5nV] - if((CC->Charge == 0) && (Vset <= Vmin)){ + if(Vset <= Vmin){ Vset = Vmin; - }else if((CC->Charge == 1) && (Vset >= Vmax)){ + }else if(Vset >= Vmax){ Vset = Vmax; } } @@ -244,9 +244,9 @@ static void CC_Vscan(CCMode *CC){ deltaV = -1 * (deltaI / 1000); //-5 * deltaI / 5000 //pV=> 5nV Vset = Vset + deltaV; //[5nV] - if((CC->Charge == 0) && (Vset <= Vmin)){ + if(Vset <= Vmin){ Vset = Vmin; - }else if((CC->Charge == 1) && (Vset >= Vmax)){ + }else if(Vset >= Vmax){ Vset = Vmax; } } diff --git a/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteWorkData.h b/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteWorkData.h index ccb8adfb2..39ac52611 100644 --- a/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteWorkData.h +++ b/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/EliteWorkData.h @@ -375,8 +375,8 @@ CCMode * InitCCMode(){ ret->Done = 0; ret->value = INSTRUCTION.ConstantCurrent; - ret->VMax = INSTRUCTION.VoltLimit + DAC_ZERO; - ret->VMin = DAC_ZERO - INSTRUCTION.VoltLimit; + ret->VMax = INSTRUCTION.MaxVolt; + ret->VMin = INSTRUCTION.MinVolt; ret->_Transform2RealnA = &_Transform2RealnA; ret->MeasureVolt = 0; ret->Vset = 0; diff --git a/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/Elite_version.h b/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/Elite_version.h index fc8a3ffcd..6c9a4d805 100644 --- a/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/Elite_version.h +++ b/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/Elite_version.h @@ -5,8 +5,8 @@ #define VERSION_DATE_YEAR 20 #define VERSION_DATE_MONTH 6 #define VERSION_DATE_DAY 1 -#define VERSION_DATE_HOUR 12 -#define VERSION_DATE_MINUTE 47 +#define VERSION_DATE_HOUR 16 +#define VERSION_DATE_MINUTE 9 // this is NOT the version hash !! // it's the last version hash diff --git a/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/headstage.h b/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/headstage.h index 79c36fc84..64c1c5076 100644 --- a/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/headstage.h +++ b/simplelink/ble_sdk_2_02_02_25/src/examples/simple_peripheral/cc26xx/app/headstage/headstage.h @@ -954,8 +954,9 @@ static void update_ZM_instruction(uint8 *ins) { INSTRUCTION.eliteFxn = CONSTANT_CURRENT; INSTRUCTION.SampleRate = 15; INSTRUCTION.Charge = ins[3]; //0:discharge 1:charge - INSTRUCTION.VoltLimit = ((uint16_t) ins[4] << 8) | ((uint16_t) ins[5]); - INSTRUCTION.ConstantCurrent = ( (uint32_t) (ins[6])<<24 | (uint32_t) (ins[7])<<16 | (uint32_t) (ins[8])<<8 | (uint32_t) (ins[9]) ); + INSTRUCTION.ConstantCurrent = ( (uint32_t) (ins[4])<<24 | (uint32_t) (ins[5])<<16 | (uint32_t) (ins[6])<<8 | (uint32_t) (ins[7]) ); + INSTRUCTION.MaxVolt = ((uint16_t) ins[8] << 8) | ((uint16_t) ins[9]); + INSTRUCTION.MinVolt = ((uint16_t) ins[10] << 8) | ((uint16_t) ins[11]); INSTRUCTION.NotifyRate = 1000; /******************************************************* @@ -1216,9 +1217,10 @@ static void update_ZM_instruction(uint8 *ins) { case VIS_CC_ZERO:{ INSTRUCTION.eliteFxn = CONSTANT_CURRENT; INSTRUCTION.SampleRate = 15; - INSTRUCTION.Charge = 0x00; - INSTRUCTION.VoltLimit = 0x61A8; + INSTRUCTION.Charge = 0x01; INSTRUCTION.ConstantCurrent = 0x00; + INSTRUCTION.MaxVolt = 0xC350; + INSTRUCTION.MinVolt = 0x0000; INSTRUCTION.NotifyRate = 1000; // uint8 *ins;