IVmode stop and call reset()

This commit is contained in:
YiChin
2019-11-01 19:30:30 +08:00
parent 92b81cb47f
commit bc28dedc64
2 changed files with 13 additions and 10 deletions
@@ -2,6 +2,8 @@
#ifndef ELITEIT
#define ELITEIT
#define absolute(a) ((a<0)? -a:a)
//static int32_t IT_Plot() {
// // read ADC current
// int32_t Real_Current = 0;
@@ -20,11 +22,10 @@
// return Real_Current;
//}
static int32_t IT_Plot(WorkMode *WorkModeData) {
static int32_t IT_Plot(WorkMode *WorkModeData) {
switch (INSTRUCTION.eliteFxn) {
case IV_CURVE:{
#define CURRENT_MODE WorkModeData->IV
break;
}
@@ -54,12 +55,13 @@ static int32_t IT_Plot(WorkMode *WorkModeData) {
CURRENT_MODE->_MeasureData = Real_Current;
// if(INSTRUCTION.eliteFxn == IV_CURVE){
// if(Real_Current > CURRENT_MODE->_LimitValue){
// PeriodicEvent = false; //Real current exceed expected limit value, force stop
// DACReset = true;
// }
// }
if(INSTRUCTION.eliteFxn == IV_CURVE){
if(absolute(Real_Current) > CURRENT_MODE->_LimitValue){
// PeriodicEvent = false; //Real current exceed expected limit value, force stop
// DACReset = true;
reset();
}
}
NotifyCurrent[0] = (uint8_t) (Real_Current >> 24);
NotifyCurrent[1] = (uint8_t) ((Real_Current & 0x00FF0000) >> 16);
NotifyCurrent[2] = (uint8_t) ((Real_Current & 0x0000FF00) >> 8);
@@ -74,8 +74,9 @@ static uint16_t OneWayVoltScan(IVMode *IV) {
// end IV task if we reach INSTRUCTION.VoltFinal
if (DACUserCode <= IV->_VStop){
PeriodicEvent = false;
DACReset = true;
// PeriodicEvent = false;
// DACReset = true;
reset();
}
}
}