update VT mode

This commit is contained in:
YiChin
2020-06-18 14:59:11 +08:00
parent b781023863
commit d26da674f5
4 changed files with 11 additions and 5 deletions
@@ -285,16 +285,19 @@ static void AutoGainChange(int32_t Real_Current){
#define ReadADCVolt(x) ((x==0)? ReadVoutVolt(spi_ADC_rxbuf) : ReadVolt(spi_ADC_rxbuf))
static int32_t InputVoltData(uint16_t VoVi_Switch){
static int32_t InputVoltData(uint16_t VoVi_Switch, VTMode *VT){
uint8_t ADCChannel;
int32_t VoltData;
if(VoVi_Switch == 0x01){
ADCChannel = ADC_CH_VOLT;
VT->_MeasureVin = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADCChannel, spi_ADC_rxbuf);
VoltData = VT->_MeasureVin;
}else if(VoVi_Switch == 0x00){
ADCChannel = ADC_CH_DAC;
VT->_MeasureVout = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADCChannel, spi_ADC_rxbuf);
VoltData = VT->_MeasureVout;
}
VoltData = DecodeADCValue(INSTRUCTION.ADCGainLevel, ADCChannel, spi_ADC_rxbuf);
return VoltData;
}
@@ -9,11 +9,12 @@ static void VT_Plot(VTMode *VT) {
ADCGainControl(INSTRUCTION.ADCGainLevel);
static uint8_t ADCSwitch = 0;
int32_t VoltData;
if(ADCSwitch == 0){ /**read V(buffer)**/
ReadADCVolt(VT->_VoVi_Switch);
VT->_MeasureVin = InputVoltData(VT->_VoVi_Switch);
InputNotify(NOTIFY_VOLT, VT->_MeasureVin);
VoltData = InputVoltData(VT->_VoVi_Switch, VT);
InputNotify(NOTIFY_VOLT, VoltData);
ADCSwitch++;
}
else if(ADCSwitch == 1){ /**read V**/
@@ -175,12 +175,14 @@ ITMode * InitITMode(){
/* VT Mode Data */
typedef struct _VTMode{
int32_t _MeasureVin;
int32_t _MeasureVout;
uint16_t _VoVi_Switch;
}VTMode;
VTMode * InitVTMode(){
VTMode *ret = malloc(sizeof(VTMode));
ret->_MeasureVin = 0;
ret->_MeasureVout = 0;
ret->_VoVi_Switch = INSTRUCTION.VoVi_Switch;
return ret;
}
@@ -6,7 +6,7 @@
#define VERSION_DATE_MONTH 6
#define VERSION_DATE_DAY 18
#define VERSION_DATE_HOUR 14
#define VERSION_DATE_MINUTE 31
#define VERSION_DATE_MINUTE 59
// this is NOT the version hash !!
// it's the last version hash