Fixed waterfall bugs on click

This commit is contained in:
Jordan Sherer 2020-04-27 20:36:55 -04:00
parent 9f23e21d43
commit e41f02f76a
2 changed files with 21 additions and 28 deletions

View File

@ -172,7 +172,7 @@ void CPlotter::draw(float swide[], bool bScroll, bool bRed)
if(bScroll and swide[0]<1.e29) { if(bScroll and swide[0]<1.e29) {
flat4_(swide,&iz,&m_Flatten); flat4_(swide,&iz,&m_Flatten);
//if(!m_bReplot) flat4_(&dec_data.savg[j0],&jz,&m_Flatten); // if(!m_bReplot) flat4_(&dec_data.savg[j0],&jz,&m_Flatten);
} }
ymin=1.e30; ymin=1.e30;

View File

@ -293,29 +293,18 @@ void WideGraph::dataSink2(float s[], float df3, int ihsym, int ndiskdata) //dat
swide[j]=nbpp*ss; swide[j]=nbpp*ss;
} }
// Time according to this computer // draw the tr cycle horizontal lines if needed
qint64 ms = DriftingDateTime::currentMSecsSinceEpoch() % 86400000; qint64 ms = DriftingDateTime::currentMSecsSinceEpoch() % 86400000;
int ntr = (ms/1000) % m_TRperiod; int ntr = (ms/1000) % m_TRperiod;
if((ndiskdata && ihsym <= m_waterfallAvg) || (!ndiskdata && ntr<m_ntr0)) { if((ndiskdata && ihsym <= m_waterfallAvg) || (!ndiskdata && ntr<m_ntr0)) {
float flagValue=1.0e30; float flagValue=1.0e30;
if(m_bHaveTransmitted) flagValue=2.0e30; if(m_bHaveTransmitted) flagValue=2.0e30;
for(int i=0; i<MAX_SCREENSIZE; i++) {
swide[i] = flagValue;
}
for(int i=0; i<NSMAX; i++) { for(int i=0; i<NSMAX; i++) {
splot[i] = flagValue; splot[i] = flagValue;
} }
m_bHaveTransmitted=false; m_bHaveTransmitted=false;
} }
m_ntr0=ntr; m_ntr0=ntr;
// draw this one here too...
// ui->widePlot->draw(swide,true,false);
// copy swide around
// {
// memcpy(swide2, swide, sizeof(swide[0])*MAX_SCREENSIZE);
// }
} }
void WideGraph::draw(){ void WideGraph::draw(){
@ -348,8 +337,6 @@ void WideGraph::draw(){
} }
void WideGraph::drawSwide(){ void WideGraph::drawSwide(){
static bool lastSwideGreen = false;
if(m_paused){ if(m_paused){
return; return;
} }
@ -357,22 +344,29 @@ void WideGraph::drawSwide(){
QMutexLocker lock(&m_drawLock); QMutexLocker lock(&m_drawLock);
float swideLocal[MAX_SCREENSIZE]; float swideLocal[MAX_SCREENSIZE];
memcpy(swideLocal, swide, sizeof(swide[0])*MAX_SCREENSIZE);
bool thisSwideGreen = swideLocal[0] >1.e29; // draw the tr cycle horizontal lines if needed
for(int i = 0; i < MAX_SCREENSIZE; i++){ static int lastSecondInPeriod = 0;
if(swideLocal[i] == 0.0){ qint64 now (DriftingDateTime::currentMSecsSinceEpoch ());
swideLocal[i] += m_dist(m_gen); unsigned secondInToday ((now % 86400000LL) / 1000);
} int secondInPeriod = secondInToday % m_TRperiod;
#if 0 if(secondInPeriod < lastSecondInPeriod) {
else if (lastSwideGreen && thisSwideGreen){ float flagValue=1.0e30;
swideLocal[i] = m_dist(m_gen); for(int i = 0; i < MAX_SCREENSIZE; i++) {
} swideLocal[i] = flagValue;
#endif }
ui->widePlot->draw(swideLocal,true,false);
} }
lastSecondInPeriod=secondInPeriod;
// then, draw the data
memcpy(swideLocal, swide, sizeof(swide[0])*MAX_SCREENSIZE);
// for(int i = 0; i < MAX_SCREENSIZE; i++){
// if(swideLocal[i] <= 1.0){
// swideLocal[i] += m_dist(m_gen);
// }
// }
ui->widePlot->draw(swideLocal,true,false); ui->widePlot->draw(swideLocal,true,false);
lastSwideGreen = thisSwideGreen;
} }
void WideGraph::on_bppSpinBox_valueChanged(int n) //bpp void WideGraph::on_bppSpinBox_valueChanged(int n) //bpp
@ -427,7 +421,6 @@ void WideGraph::keyPressEvent(QKeyEvent *e) //F1
void WideGraph::setRxFreq(int n) //setRxFreq void WideGraph::setRxFreq(int n) //setRxFreq
{ {
ui->widePlot->setRxFreq(n); ui->widePlot->setRxFreq(n);
ui->widePlot->draw(swide,false,false);
ui->offsetSpinBox->setValue(n); ui->offsetSpinBox->setValue(n);
} }