Skip to content

Commit

Permalink
[capture] be a little bit more cautious when stopping/restarting the …
Browse files Browse the repository at this point in the history
…capture engine. Else we might get stuck somewhere
  • Loading branch information
mean committed Jul 5, 2019
1 parent 4e6f92a commit e75301d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
5 changes: 5 additions & 0 deletions dso_adc_fast_trigger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ static uint32_t cr1;

void DSOADC::stopDmaCapture(void)
{
// disable interrupts
enableDisableIrq(false);
enableDisableIrqSource(false,ADC_AWD);
enableDisableIrqSource(false,ADC_EOC);
// Stop dma
adc_dma_disable(ADC1);
}

Expand Down
3 changes: 2 additions & 1 deletion dso_capture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ void DSOCapturePriv::task(void *a)
#warning FIXME : Waste of time
if(captureState==captureStateIdle) //
xDelay(1);
currentTable->tasklet();
else
currentTable->tasklet();
}

}
Expand Down
22 changes: 14 additions & 8 deletions dso_mainUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ static void redraw()
DSODisplay::printTriggerValue(DSOCapture::getTriggerValue());
DSODisplay::printOffset(capture->getVoltageOffset());
}
#define STOP_CAPTURE() DSOCapture::stopCapture()
#define STOP_CAPTURE() {DSOCapture::stopCapture();xDelay(20);}

static void buttonManagement()
{
Expand Down Expand Up @@ -123,25 +123,28 @@ static void buttonManagement()
case DSODisplay::VOLTAGE_MODE:
{
int v=capture->getVoltageRange();
dirty=true;
dirty=true;
v+=inc;
if(v<0) v=0;
if(v>DSOCapture::DSO_VOLTAGE_MAX) v=DSOCapture::DSO_VOLTAGE_MAX;
capture->setVoltageRange((DSOCapture::DSO_VOLTAGE_RANGE)v);
STOP_CAPTURE();
capture->setVoltageRange((DSOCapture::DSO_VOLTAGE_RANGE)v);

}
break;
case DSODisplay::TIME_MODE:
{
int v=capture->getTimeBase();
dirty=true;
dirty=true;
v+=inc;
if(v<0) v=0;
if(v>DSOCapture::DSO_TIME_BASE_MAX) v=DSOCapture::DSO_TIME_BASE_MAX;
DSOCapture::DSO_TIME_BASE t=(DSOCapture::DSO_TIME_BASE )v;
DSOCapture::clearCapturedData();
capture->setTimeBase( t);
STOP_CAPTURE();

capture->setTimeBase( t);

}
break;
case DSODisplay::TRIGGER_MODE:
Expand All @@ -150,6 +153,7 @@ static void buttonManagement()
t+=inc;
while(t<0) t+=4;
t%=4;
STOP_CAPTURE();
capture->setTriggerMode((DSOCapture::TriggerMode)t);
capture->setTimeBase( capture->getTimeBase()); // this will refresh the internal indirection table
dirty=true;
Expand All @@ -159,19 +163,21 @@ static void buttonManagement()
{
float v=capture->getVoltageOffset();
v+=0.1*inc;
STOP_CAPTURE();
capture->setVoltageOffset(v);
dirty=true;
STOP_CAPTURE();

break;
}
case DSODisplay::TRIGGER_MODE_ALT:
{
float v=capture->getTriggerValue();

v+=0.1*(float)inc;
v+=0.1*(float)inc;
STOP_CAPTURE();
capture->setTriggerValue(v);
dirty=true;
STOP_CAPTURE();

}
break;
default:
Expand Down

0 comments on commit e75301d

Please sign in to comment.