Skip to content
Permalink
Browse files

use GenericCanSetupPage for peak and candleAPI

  • Loading branch information...
HubertD committed May 17, 2016
1 parent 37e0a52 commit 227fb22946549fadaf8cb2291e95295a68fb9c11
@@ -33,9 +33,9 @@ MeasurementInterface::MeasurementInterface()
_isCanFD(false),
_isSimpleTiming(true),
_bitrate(500000),
_samplePoint(0),
_samplePoint(875),
_fdBitrate(4000000),
_fdSamplePoint(0),
_fdSamplePoint(875),
_tq(125),
_propSeg(6),
_phaseSeg1(7),
@@ -1,6 +1,6 @@
#include "CanTiming.h"

CanTiming::CanTiming(unsigned id, unsigned bitrate, uint32_t bitrate_fd, float samplePoint)
CanTiming::CanTiming(unsigned id, unsigned bitrate, uint32_t bitrate_fd, unsigned samplePoint)
: _id(id),
_bitrate(bitrate),
_bitrate_fd(bitrate_fd),
@@ -28,22 +28,22 @@ bool CanTiming::isCanFD()
return _bitrate_fd != 0;
}

float CanTiming::getSamplePoint()
unsigned CanTiming::getSamplePoint()
{
return _samplePoint;
}

QString CanTiming::getSamplePointStr(float samplePoint)
QString CanTiming::getSamplePointStr(unsigned samplePoint)
{
return QString::number(100*samplePoint, 'f', 1).append("%");
return QString::number(samplePoint/10.0, 'f', 1).append("%");
}

QString CanTiming::getTitle()
{
QString format = isCanFD() ? "%1/%3(FD) kBit/s, sample point %2%" : "%1 kBit/s, sample point %2";
QString format = isCanFD() ? "%1/%3(FD) kBit/s, sample point %2" : "%1 kBit/s, sample point %2";
return format.arg(
QString::number(getBitrate()/1000, 'f', 2),
QString::number(getSamplePoint()*100, 'f', 1),
getSamplePointStr(getSamplePoint()),
QString::number(getBitrateFD()/1000, 'f', 2)
);
}
@@ -13,13 +13,13 @@ class CanTiming
* \param bitrate_fd bitrate for the FD part, or zero this is not a CanFD timing
* \param samplePoint sample point, e.g. 0.875
*/
CanTiming(unsigned id, unsigned bitrate, uint32_t bitrate_fd, float samplePoint);
CanTiming(unsigned id, unsigned bitrate, uint32_t bitrate_fd, unsigned samplePoint);
unsigned getId();
unsigned getBitrate();
unsigned getBitrateFD();
bool isCanFD();
float getSamplePoint();
static QString getSamplePointStr(float samplePoint);
unsigned getSamplePoint();
static QString getSamplePointStr(unsigned samplePoint);

/*!
* \brief getTitle get a brief one-line description of this timing
@@ -31,7 +31,7 @@ class CanTiming
unsigned _id;
unsigned _bitrate;
unsigned _bitrate_fd;
float _samplePoint;
unsigned _samplePoint;
};

#endif // CANTIMING_H
@@ -67,7 +67,19 @@ uint32_t CandleApiInterface::getCapabilities()

QList<CanTiming> CandleApiInterface::getAvailableBitrates()
{
return CanInterface::getAvailableBitrates();
QList<CanTiming> retval;

QList<unsigned> bitrates = QList<unsigned>() << 10000 << 20000 << 50000 << 100000 << 125000 << 250000 << 500000 << 800000 << 1000000;
QList<unsigned> spoints = QList<unsigned>() << 500 << 625 << 750 << 875;

int i = 0;
foreach (unsigned br, bitrates) {
foreach (unsigned sp, spoints) {
retval << CanTiming(i++, br, 0, sp);
}
}

return retval;
}

//! sync device time with host time

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 227fb22

Please sign in to comment.
You can’t perform that action at this time.