[CV] try to fix auto

This commit is contained in:
YiChin
2019-11-18 11:36:33 +08:00
parent a4e62ac39e
commit dff4082ea9
2 changed files with 16 additions and 9 deletions
@@ -38,23 +38,27 @@ static int32_t IT_Plot(WorkMode *WorkModeData) {
break;
}
default: {
#define CURRENT_MODE WorkModeData->IV
#define CURRENT_MODE WorkModeData->IT
break;
}
}
// read ADC current
int32_t RealCurrent = 0, RealVolt = 0;
static uint8_t PreviousGain = GAIN_AUTO;
static uint8_t PreviousGain = GAIN_200R;
if(INSTRUCTION.AutoGainEnable){
if(INSTRUCTION.eliteFxn == IV_CURVE){
if (PreviousGain != INSTRUCTION.ADCGainLevel){
PreviousGain = INSTRUCTION.ADCGainLevel;
ReadCurrent(spi_ADC_rxbuf);
}
}
RealCurrent = AutoGainReadCurrent(spi_ADC_rxbuf);
if(PreviousGain != INSTRUCTION.ADCGainLevel){
PreviousGain = INSTRUCTION.ADCGainLevel;
CURRENT_MODE->_MeasureData = AutoGainReadCurrent(spi_ADC_rxbuf);
CURRENT_MODE->_MeasureData = AutoGainReadCurrent(spi_ADC_rxbuf);
}
if(PreviousGain != INSTRUCTION.ADCGainLevel){
PreviousGain = INSTRUCTION.ADCGainLevel;
CURRENT_MODE->_MeasureData = AutoGainReadCurrent(spi_ADC_rxbuf);
CURRENT_MODE->_MeasureData = AutoGainReadCurrent(spi_ADC_rxbuf);
}
}
else{
ReadCurrent(spi_ADC_rxbuf);
@@ -153,7 +153,10 @@ static void EliteDACControl(WorkMode *WorkModeData) {
if ((INSTRUCTION.eliteFxn == IV_CURVE) || (INSTRUCTION.eliteFxn == CV_CURVE)) {
// output a certain voltage and put it into NotifyVolt
VoltScan(WorkModeData);
// DACCode2Real2Notify(VoltScan(WorkModeData));
if(INSTRUCTION.eliteFxn == CV_CURVE){
DACCode2Real2Notify(VoltScan(WorkModeData));
}
}
else if (INSTRUCTION.eliteFxn == ZT_CURVE){