Skip to content

Commit

Permalink
Merge branch 'master' of github.com:crapp/labpowerqt
Browse files Browse the repository at this point in the history
  • Loading branch information
crapp committed May 31, 2016
2 parents 477c2b2 + db94be8 commit bcd1bd4
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/labpowermodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ void LabPowerModel::setOCP(bool status) { this->status->setOcp(status); }
bool LabPowerModel::getOCP() { return this->status->getOcp(); }
void LabPowerModel::setOTP(bool status) { this->status->setOtp(status); }
bool LabPowerModel::getOTP() { return this->status->getOtp(); }
long LabPowerModel::getDuration() { return this->status->getDuration(); }
long long LabPowerModel::getDuration() { return this->status->getDuration(); }
std::vector<std::shared_ptr<PowerSupplyStatus>> LabPowerModel::getBuffer()
{
return this->statusBuffer;
Expand Down
2 changes: 1 addition & 1 deletion src/labpowermodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class LabPowerModel : public QObject
void setOTP(bool status);
bool getOTP();

long getDuration();
long long getDuration();

std::vector<std::shared_ptr<PowerSupplyStatus>> getBuffer();
int getBufferSize();
Expand Down
4 changes: 3 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ int main(int argc, char *argv[])
QCoreApplication::setApplicationName("labpowerqt");

ealogger::Logger &log = LogInstance::get_instance();

#ifdef WIN32
QSettings::setDefaultFormat(QSettings::Format::IniFormat);
#endif
QSettings settings;
settings.beginGroup(setcon::LOG_GROUP);
if (settings.value(setcon::LOG_ENABLED,
Expand Down
16 changes: 9 additions & 7 deletions src/plottingarea.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ void PlottingArea::addData(const int &channel, const double &data,
* We actually can calculate the index of our graph using a simple formula
* (a - 1) * 5 + b
*/
//LogInstance::get_instance().eal_debug("Plotting area received data: type: " + std::to_string(static_cast<int>(type)) + " data: " + std::to_string(data));
if (this->cbGeneralPlot->isChecked()) {
int index = (channel - 1) * 5 + static_cast<int>(type);
auto msecs = std::chrono::duration_cast<std::chrono::milliseconds>(
Expand Down Expand Up @@ -750,8 +751,9 @@ void PlottingArea::setupGraphPlot(const QSettings &settings)
static_cast<void (QCPAxis::*)(const QCPRange &, const QCPRange &)>(
&QCPAxis::rangeChanged),
this, &PlottingArea::xAxisRangeChanged);
QObject::connect(this->plot, &QCustomPlot::beforeReplot, this,
&PlottingArea::beforeReplotHandle);

//QObject::connect(this->plot, &QCustomPlot::beforeReplot, this,
// &PlottingArea::beforeReplotHandle);

QObject::connect(this->plot, &QCustomPlot::mouseMove, this,
&PlottingArea::mouseMoveHandler);
Expand All @@ -772,7 +774,7 @@ void PlottingArea::yAxisRange(const QCPRange &currentXRange,
this->wattageAxis->setRange(
QCPRange(yaxb.wattageLower - 0.5, yaxb.wattageUpper + 0.5));

// replotting here causes some weird effects.
// replotting here causes some weird effects
// this->plot->replot();
}

Expand Down Expand Up @@ -840,9 +842,9 @@ void PlottingArea::xAxisRangeChanged(const QCPRange &newRange,
settings.beginGroup(setcon::DEVICE_GROUP);
settings.beginGroup(settings.value(setcon::DEVICE_ACTIVE).toString());

long newRangeUpperMS = static_cast<long>(newRange.upper * 1000);
long long newRangeUpperMS = static_cast<long long>(newRange.upper * 1000);
std::chrono::milliseconds newRangeUpperMSDuration(newRangeUpperMS);
long newRangeLowerMS = static_cast<long>(newRange.lower * 1000);
long long newRangeLowerMS = static_cast<long long>(newRange.lower * 1000);
std::chrono::milliseconds newRangeLowerMSDuration(newRangeLowerMS);

// generate a timepoint from newRange upper and lower
Expand All @@ -865,9 +867,9 @@ void PlottingArea::xAxisRangeChanged(const QCPRange &newRange,
std::chrono::duration<double> deltaSecsUpperLower =
tpNewUpperSecs - tpNewLowerSecs;

long oldRangeUpperMS = static_cast<long>(oldRange.upper * 1000);
long long oldRangeUpperMS = static_cast<long long>(oldRange.upper * 1000);
std::chrono::milliseconds oldRangeUpperMSDuration(oldRangeUpperMS);
long oldRangeLowerMS = static_cast<long>(oldRange.lower * 1000);
long long oldRangeLowerMS = static_cast<long long>(oldRange.lower * 1000);
std::chrono::milliseconds oldRangeLowerMSDuration(oldRangeLowerMS);

// generate a timepoint from newRange upper and lower
Expand Down
2 changes: 1 addition & 1 deletion src/powersupplyscpi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ void PowerSupplySCPI::readWriteData(std::shared_ptr<SerialCommand> com)

std::chrono::high_resolution_clock::time_point tEnd =
std::chrono::high_resolution_clock::now();
long duration =
long long duration =
std::chrono::duration_cast<std::chrono::milliseconds>(tEnd - tStart)
.count();

Expand Down
6 changes: 3 additions & 3 deletions src/powersupplystatus.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ struct PowerSupplyStatus {
QMutexLocker lock(&this->otpLock);
return this->otp;
}
void setDuration(long duration) { this->duration = duration; }
long getDuration() { return this->duration; }
void setDuration(long long duration) { this->duration = duration; }
long long getDuration() { return this->duration; }
void setTime(std::chrono::system_clock::time_point t)

{
Expand Down Expand Up @@ -197,7 +197,7 @@ struct PowerSupplyStatus {
bool ocp;
bool otp;

long duration;
long long duration;

std::chrono::system_clock::time_point time;

Expand Down

0 comments on commit bcd1bd4

Please sign in to comment.