[CC] battery test perfect, should add +- current in UI

This commit is contained in:
YiChin
2019-10-17 11:11:25 +08:00
parent 89368d5352
commit a14b2480db
2 changed files with 8 additions and 7 deletions
@@ -107,17 +107,17 @@ static int32_t CCModeVoltOut(CURRENT_USER_CODE *CurrentUserCode){
MeasureCurrent = MeasureCurrent * 1000;
CCModeDACControl(IUCCurrent - MeasureCurrent);
}
// NotifyCurrent[0] = (uint8_t) (IUCCurrent >> 24);
// NotifyCurrent[1] = (uint8_t) ((IUCCurrent & 0x00FF0000) >> 16);
// NotifyCurrent[2] = (uint8_t) ((IUCCurrent & 0x0000FF00) >> 8);
// NotifyCurrent[3] = (uint8_t) (IUCCurrent & 0x000000FF);
NotifyCurrent[0] = (uint8_t) (IUCCurrent >> 24);
NotifyCurrent[1] = (uint8_t) ((IUCCurrent & 0x00FF0000) >> 16);
NotifyCurrent[2] = (uint8_t) ((IUCCurrent & 0x0000FF00) >> 8);
NotifyCurrent[3] = (uint8_t) (IUCCurrent & 0x000000FF);
//
// NotifyVolt[0] = (uint8_t) (MeasureCurrent >> 24);
// NotifyVolt[1] = (uint8_t) ((MeasureCurrent & 0x00FF0000) >> 16);
// NotifyVolt[2] = (uint8_t) ((MeasureCurrent & 0x0000FF00) >> 8);
// NotifyVolt[3] = (uint8_t) (MeasureCurrent & 0x000000FF);
// DACCode2Real2Notify(Usercode_Correction_to_DAC(INSTRUCTION.VoltConstant));
DACCode2Real2Notify(Usercode_Correction_to_DAC(INSTRUCTION.VoltConstant));
CCModeDACEnable = 0;
return MeasureCurrent;
}
@@ -131,7 +131,8 @@ static void CCModeDACControl(int32_t IUC_Measure_Difference){
INSTRUCTION.VoltConstant = INSTRUCTION.VoltConstant + IUC_Measure_Difference/1e5;
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoltConstant));
}
else if(IUC_Measure_Difference > 1000 || IUC_Measure_Difference < -1000){
// else if(IUC_Measure_Difference > 1000 || IUC_Measure_Difference < -1000){
else{
INSTRUCTION.VoltConstant = INSTRUCTION.VoltConstant + IUC_Measure_Difference/1e6;
DAC_outputV(Usercode_Correction_to_DAC(INSTRUCTION.VoltConstant));
}
@@ -883,7 +883,7 @@ static void update_ZM_instruction(uint8 *ins) {
case CONSTANT_CURRENT:{
INSTRUCTION.eliteFxn = CONSTANT_CURRENT;
INSTRUCTION.SampleRate = 10000;
INSTRUCTION.SampleRate = 2;
INSTRUCTION.CurrentLV = ins[3];
INSTRUCTION.ConstantCurrent = ( (uint32_t) (ins[4])<<24 | (uint32_t) (ins[5])<<16 | (uint32_t) (ins[6])<<8 | (uint32_t) (ins[7]) );
// GetInstructionParameter(ins+2);