Elite 1.4 adjust sampling rate

This commit is contained in:
105042004
2019-08-19 15:24:58 +08:00
parent c48f570877
commit ec58058e00
2 changed files with 9 additions and 15 deletions
@@ -683,8 +683,7 @@ static uint8_t PulseWidth;
static uint8_t PulsePeriod;
static uint8_t StepTime = 0x18; // 0x30 = 2'd48 ~= 2 second, 24 = 0x18 = 1 sec
static uint8_t StepTimeCounter = 0;
static uint8_t PeriodicCounter = 0;
static uint8_t StepTimeCounter = 1;
// real instruction fxn
static void VoltScan(); // used in I-V and cyclic
@@ -818,8 +818,7 @@ static void reset(){
VoltFinal = DACposMax;
Step = 10; // 10 = 0x0A ~= 3.05 mv ~= 3 mv
StepTime = 24; // 0x30 = 2'd48 ~= 2 second, 24 = 0x18
StepTimeCounter = 0;
PeriodicCounter = 0;
StepTimeCounter = 1;
SampleRate = 1;
SampleRate_counter = 1;
@@ -858,8 +857,7 @@ static void Eliteinterrupt(){
VoltFinal = DACposMax;
Step = 10; // 10 = 0x0A ~= 3.05 mv ~= 3 mv
StepTime = 24; // 0x30 = 2'd48 ~= 2 second, 24 = 0x18
StepTimeCounter = 0;
PeriodicCounter = 0;
StepTimeCounter = 1;
SampleRate = 1;
SampleRate_counter = 1;
@@ -898,8 +896,7 @@ static void CleanBuffer(){
VoltFinal = DACposMax;
Step = 10; // 10 = 0x0A ~= 3.05 mv ~= 3 mv
StepTime = 24; // 0x30 = 2'd48 ~= 2 second, 24 = 0x18
StepTimeCounter = 0;
PeriodicCounter = 0;
StepTimeCounter = 1;
SampleRate = 1;
SampleRate_counter = 1;
@@ -958,6 +955,8 @@ static void SimpleBLEPeripheral_performPeriodicTask() {
return;
}
else {
if (SampleRate_counter == SampleRate) SampleRate_counter = 1;
else SampleRate_counter ++;
// In IV, CV, and func-gen mode, DAC will output voltage
// else DAC do nothing.
EliteDACControl();
@@ -977,7 +976,7 @@ static void EliteDACControl(){
if (INSTRUCTION.eliteFxn == ITCurve) { return; }
if (INSTRUCTION.eliteFxn == VTCurve) { return; }
if (StepTimeCounter < StepTime){
if (StepTimeCounter == StepTime){
StepTimeCounter ++;
}
else{
@@ -1001,16 +1000,12 @@ static void EliteADCControl(){
IT_Plot();
break;
}
SampleRate_counter = 1;
}
else {
SampleRate_counter++;
}
}
static void EliteNotifyControl(){
// send notify
SendNotify();
if (SampleRate_counter == SampleRate) SendNotify();
}