void Timer0B_Handler(void){ TIMER0_ICR_R = TIMER_ICR_TBTOCINT; // acknowledge timer0B timeout //GPIO_PORTG_DATA_R |= 0x40; // turn on LED ADCValue0 = ADC_In0(); ADCStatus0 = 1; ADCValue1 = ADC_In1(); ADCStatus1 = 1; updateXAxis(); updateYAxis(); //GPIO_PORTG_DATA_R &= ~0x40; // turn off LED }
void Viewport::reset() { // reset values that would become inappropr. selection = 0; hover = -1; // reset limiters to most-lazy values setLimiters(0); // update y-axis (used by updateModelView()) updateYAxis(); // update coordinate system updateModelview(true); }
void Viewport::updateModelview(bool newBinning) { SharedDataLock ctxlock(ctx->mutex); QPointF zero; if (newBinning) { zero = modelview.map(QPointF(0.f, 0.f)); } boundaries.htp = yaxisWidth + 14; displayHeight = height - 2*boundaries.vp - boundaries.vtp; // if gradient, we discard one unit space intentionally for centering size_t d = (*ctx)->dimensionality - ((*ctx)->type == representation::GRAD ? 0 : 1); qreal w = (width - 2*boundaries.hp - boundaries.htp)/(qreal)(d); // width of one unit qreal h = displayHeight/(qreal)((*ctx)->nbins); // height of one unit int t = ((*ctx)->type == representation::GRAD ? w/2 : 0); // moving half a unit for centering modelview.reset(); modelview.translate(boundaries.hp + boundaries.htp + t, boundaries.vp); modelview.scale(w, -1*h); // -1 low values at bottom modelview.translate(0, -((*ctx)->nbins)); // shift for low values at bottom // set inverse modelviewI = modelview.inverted(); // restore previous position in plot (zoom>1 avoids initial bork transform) if (newBinning && zoom > 1) { QPointF zerolocal = modelviewI.map(zero); modelview.translate(zerolocal.x(),zerolocal.y()); modelview.scale(zoom, zoom); // reset inverse modelviewI = modelview.inverted(); // reset y-axis updateYAxis(true); } }
void Viewport::drawBackground(QPainter *painter, const QRectF &rect) { // update geometry int nwidth = painter->device()->width(); int nheight = painter->device()->height(); if (nwidth != width || nheight != height) { width = nwidth; height = nheight; zoom = 1.f; updateYAxis(); // update transformation (needed already for legend, axes drawing) updateModelview(); // defer buffer update (do not hinder resizing with slow update) buffers[0].dirty = buffers[1].dirty = true; resizeTimer.start(150); } // draw drawScene(painter); }
/* connection */ void mainWindow::updateData() { // Getting the current date if needed for the log file QString date = QDateTime::currentDateTime().toString("_MM_dd_yyyy"); // Opening a log file if required if(ui->logToFile->isChecked()) { // Adding the date to the name if needed if(ui->appendDate->isChecked()) log = new QFile(ui->fileName->text()+date+".txt"); else log = new QFile(ui->fileName->text()+".txt"); // Always open as Append log->open(QIODevice::Append); } QDateTime d = QDateTime::currentDateTime(); // Updating the different datas updateYAxis(protocole->lastValue[5]); updateXAxis(protocole->lastValue[4],/*d.toMSecsSinceEpoch());//*/getDate(protocole->lastString)); updateTimeGraph(protocole->lastValue[6],3); for(int i=4;i<7;i++) updateTimeGraph(protocole->lastValue[i-3],i); updateTimeGraph(protocole->lastValue[7],7); updateConsole(protocole->lastString); // Logging to the file if(ui->logToFile->isChecked()) log->write(protocole->lastString.toLatin1()+"\n"); // Closing the file if it had been opened if(ui->logToFile->isChecked()) log->close(); }