Commit c8f0845a authored by lm's avatar lm

Fixed a bug where non-auto hold in the debug console induced 100% CPU load...

Fixed a bug where non-auto hold in the debug console induced 100% CPU load even when the widget was hidden
parent 2171748b
......@@ -255,30 +255,32 @@ void DebugConsole::setAutoHold(bool hold)
void DebugConsole::receiveTextMessage(int id, int component, int severity, QString text)
{
Q_UNUSED(severity);
QString name = UASManager::instance()->getUASForId(id)->getUASName();
QString comp;
// Get a human readable name if possible
switch (component) {
// TODO: To be completed
case MAV_COMP_ID_IMU:
comp = tr("IMU");
break;
case MAV_COMP_ID_MAPPER:
comp = tr("MAPPER");
break;
case MAV_COMP_ID_WAYPOINTPLANNER:
comp = tr("WP-PLANNER");
break;
case MAV_COMP_ID_AIRSLAM:
comp = tr("AIRSLAM");
break;
default:
comp = QString::number(component);
break;
}
if (isVisible())
{
QString name = UASManager::instance()->getUASForId(id)->getUASName();
QString comp;
// Get a human readable name if possible
switch (component) {
// TODO: To be completed
case MAV_COMP_ID_IMU:
comp = tr("IMU");
break;
case MAV_COMP_ID_MAPPER:
comp = tr("MAPPER");
break;
case MAV_COMP_ID_WAYPOINTPLANNER:
comp = tr("WP-PLANNER");
break;
case MAV_COMP_ID_SYSTEM_CONTROL:
comp = tr("SYS-CONTROL");
break;
default:
comp = QString::number(component);
break;
}
m_ui->receiveText->appendHtml(QString("<font color=\"%1\">(%2:%3) %4</font>\n").arg(UASManager::instance()->getUASForId(id)->getColor().name(), name, comp, text));
//m_ui->receiveText->appendPlainText("");
m_ui->receiveText->appendHtml(QString("<font color=\"%1\">(%2:%3) %4</font>\n").arg(UASManager::instance()->getUASForId(id)->getColor().name(), name, comp, text));
}
}
void DebugConsole::updateTrafficMeasurements()
......@@ -396,9 +398,12 @@ void DebugConsole::receiveBytes(LinkInterface* link, QByteArray bytes)
}
if (lineBuffer.length() > 0) {
m_ui->receiveText->insertPlainText(lineBuffer);
// Ensure text area scrolls correctly
m_ui->receiveText->ensureCursorVisible();
if (isVisible())
{
m_ui->receiveText->insertPlainText(lineBuffer);
// Ensure text area scrolls correctly
m_ui->receiveText->ensureCursorVisible();
}
lineBuffer.clear();
}
} else if (link == currLink && holdOn) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment