Skip to content

Commit

Permalink
Disable cores deal when mining is active to prevent misunderstanding …
Browse files Browse the repository at this point in the history
…how it works, other changes in miner
  • Loading branch information
aivve committed Jan 4, 2022
1 parent 06d7370 commit f565e7b
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ namespace WalletGui
double Miner::get_speed()
{
if(is_mining())
return m_hash_rate;
return m_hash_rate.load();
else
return 0;
}
Expand All @@ -239,8 +239,6 @@ namespace WalletGui
void Miner::send_stop_signal()
{
m_stop_mining = true;
m_current_hash_rate = 0;
m_last_hash_rates.clear();
}

//-----------------------------------------------------------------------------------------------------
Expand All @@ -258,6 +256,10 @@ namespace WalletGui

m_threads.clear();

m_current_hash_rate = 0;
m_hash_rate = 0;
m_last_hash_rates.clear();

m_logger(Logging::INFO) << "Mining stopped, " << m_threads.size() << " threads finished" ;
Q_EMIT minerMessageSignal(QString("Mining stopped, %1 threads finished").arg(threadsCount));

Expand Down
14 changes: 14 additions & 0 deletions src/gui/MiningFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
#include <QDebug>
#include <QThread>
#include <QUrl>
#include <QtConcurrent/QtConcurrent>
#include <QtConcurrent/QtConcurrentRun>
#include <QDebug>

#include "MiningFrame.h"
#include "MainWindow.h"
Expand Down Expand Up @@ -178,6 +181,8 @@ void MiningFrame::startSolo() {
m_ui->m_startSolo->setChecked(true);
m_ui->m_startSolo->setEnabled(false);
m_ui->m_stopSolo->setEnabled(true);
m_ui->m_cpuCoresSpin->setEnabled(false);
m_ui->m_cpuDial->setEnabled(false);
m_solo_mining = true;
}

Expand All @@ -193,6 +198,8 @@ void MiningFrame::stopSolo() {
m_ui->m_hashratelcdNumber->display(0.0);
m_ui->m_startSolo->setEnabled(true);
m_ui->m_stopSolo->setEnabled(false);
m_ui->m_cpuCoresSpin->setEnabled(true);
m_ui->m_cpuDial->setEnabled(true);
m_solo_mining = false;
}
}
Expand Down Expand Up @@ -259,4 +266,11 @@ void MiningFrame::updateMinerLog(const QString& _message) {
sb->setValue(sb->maximum());
}

void MiningFrame::coreDealTurned(int _cores) {
qDebug() << "Cores " << _cores;
QTimer::singleShot(600, [this, _cores]() {
Settings::instance().setMiningThreads(_cores);
} );
}

}
1 change: 1 addition & 0 deletions src/gui/MiningFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class MiningFrame : public QFrame {
Q_SLOT void updateBalance(quint64 _balance);
Q_SLOT void updatePendingBalance(quint64 _balance);
Q_SLOT void updateMinerLog(const QString& _message);
Q_SLOT void coreDealTurned(int _cores);
};

}
17 changes: 17 additions & 0 deletions src/gui/ui/miningframe.ui
Original file line number Diff line number Diff line change
Expand Up @@ -310,13 +310,30 @@
</hint>
</hints>
</connection>
<connection>
<sender>m_cpuCoresSpin</sender>
<signal>valueChanged(int)</signal>
<receiver>MiningFrame</receiver>
<slot>coreDealTurned(int)</slot>
<hints>
<hint type="sourcelabel">
<x>501</x>
<y>86</y>
</hint>
<hint type="destinationlabel">
<x>379</x>
<y>266</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>startStopClicked(QAbstractButton*)</slot>
<slot>startStopSoloClicked(QAbstractButton*)</slot>
<slot>stakeAmountChanged(int)</slot>
<slot>stakeTermChanged(int)</slot>
<slot>stakeMixinChanged(int)</slot>
<slot>coreDealTurned(int)</slot>
</slots>
<buttongroups>
<buttongroup name="m_soloButtonGroup"/>
Expand Down

0 comments on commit f565e7b

Please sign in to comment.