@@ -41,5 +41,3 @@ void DebugOutput::traceCallback(const QString & text)
|
|||||||
ui->Output->verticalScrollBar()->triggerAction(QAbstractSlider::SliderToMaximum);
|
ui->Output->verticalScrollBar()->triggerAction(QAbstractSlider::SliderToMaximum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -270,24 +270,45 @@ void SimulatorDialog::onTrimReleased()
|
|||||||
|
|
||||||
void SimulatorDialog::openTelemetrySimulator()
|
void SimulatorDialog::openTelemetrySimulator()
|
||||||
{
|
{
|
||||||
TelemetrySimu = new TelemetrySimulator(this, simulator);
|
// allow only one instance
|
||||||
TelemetrySimu->setAttribute(Qt::WA_DeleteOnClose, true);
|
if (TelemetrySimu == 0) {
|
||||||
TelemetrySimu->show();
|
TelemetrySimu = new TelemetrySimulator(this, simulator);
|
||||||
|
TelemetrySimu->show();
|
||||||
|
}
|
||||||
|
else if (!TelemetrySimu->isVisible()) {
|
||||||
|
TelemetrySimu->show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimulatorDialog::openTrainerSimulator()
|
void SimulatorDialog::openTrainerSimulator()
|
||||||
{
|
{
|
||||||
TrainerSimu = new TrainerSimulator(this, simulator);
|
// allow only one instance
|
||||||
TrainerSimu->setAttribute(Qt::WA_DeleteOnClose, true);
|
if (TrainerSimu == 0) {
|
||||||
TrainerSimu->show();
|
TrainerSimu = new TrainerSimulator(this, simulator);
|
||||||
|
TrainerSimu->show();
|
||||||
|
}
|
||||||
|
else if (!TrainerSimu->isVisible()) {
|
||||||
|
TrainerSimu->show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimulatorDialog::openDebugOutput()
|
void SimulatorDialog::openDebugOutput()
|
||||||
{
|
{
|
||||||
DebugOut = new DebugOutput(this);
|
// allow only one instance, but install signal handler to catch dialog destruction just in case
|
||||||
DebugOut->setAttribute(Qt::WA_DeleteOnClose, true);
|
if (DebugOut == 0) {
|
||||||
DebugOut->traceCallback(traceBuffer);
|
DebugOut = new DebugOutput(this);
|
||||||
DebugOut->show();
|
QObject::connect(DebugOut, SIGNAL(destroyed()), this, SLOT(onDebugOutputClose()));
|
||||||
|
DebugOut->traceCallback(traceBuffer);
|
||||||
|
DebugOut->show();
|
||||||
|
}
|
||||||
|
else if (!DebugOut->isVisible()) {
|
||||||
|
DebugOut->show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SimulatorDialog::onDebugOutputClose()
|
||||||
|
{
|
||||||
|
DebugOut = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimulatorDialog::keyPressEvent (QKeyEvent *event)
|
void SimulatorDialog::keyPressEvent (QKeyEvent *event)
|
||||||
|
|||||||
@@ -140,6 +140,7 @@ class SimulatorDialog : public QDialog
|
|||||||
void openTelemetrySimulator();
|
void openTelemetrySimulator();
|
||||||
void openTrainerSimulator();
|
void openTrainerSimulator();
|
||||||
void openDebugOutput();
|
void openDebugOutput();
|
||||||
|
void onDebugOutputClose();
|
||||||
|
|
||||||
#ifdef JOYSTICKS
|
#ifdef JOYSTICKS
|
||||||
void onjoystickAxisValueChanged(int axis, int value);
|
void onjoystickAxisValueChanged(int axis, int value);
|
||||||
|
|||||||
@@ -28,6 +28,12 @@ void TelemetrySimulator::onTimerEvent()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TelemetrySimulator::closeEvent(QCloseEvent *event)
|
||||||
|
{
|
||||||
|
ui->Simulate->setChecked(false);
|
||||||
|
event->accept();
|
||||||
|
}
|
||||||
|
|
||||||
void setSportPacketCrc(uint8_t * packet)
|
void setSportPacketCrc(uint8_t * packet)
|
||||||
{
|
{
|
||||||
short crc = 0;
|
short crc = 0;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#define telemetrysimu_h
|
#define telemetrysimu_h
|
||||||
|
|
||||||
|
|
||||||
|
#include <QCloseEvent>
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include "simulatorinterface.h"
|
#include "simulatorinterface.h"
|
||||||
@@ -21,6 +22,7 @@ class TelemetrySimulator : public QDialog
|
|||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual void closeEvent(QCloseEvent *event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::TelemetrySimulator * ui;
|
Ui::TelemetrySimulator * ui;
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ TrainerSimulator::TrainerSimulator(QWidget * parent, SimulatorInterface * simula
|
|||||||
|
|
||||||
timer = new QTimer(this);
|
timer = new QTimer(this);
|
||||||
connect(timer, SIGNAL(timeout()), this, SLOT(onTimerEvent()));
|
connect(timer, SIGNAL(timeout()), this, SLOT(onTimerEvent()));
|
||||||
timer->start(10);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TrainerSimulator::~TrainerSimulator()
|
TrainerSimulator::~TrainerSimulator()
|
||||||
@@ -31,6 +30,18 @@ TrainerSimulator::~TrainerSimulator()
|
|||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TrainerSimulator::showEvent(QShowEvent *event)
|
||||||
|
{
|
||||||
|
timer->start(10);
|
||||||
|
event->accept();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TrainerSimulator::closeEvent(QCloseEvent *event)
|
||||||
|
{
|
||||||
|
timer->stop();
|
||||||
|
event->accept();
|
||||||
|
}
|
||||||
|
|
||||||
void TrainerSimulator::centerSticks()
|
void TrainerSimulator::centerSticks()
|
||||||
{
|
{
|
||||||
if (leftStick->scene())
|
if (leftStick->scene())
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
#define trainersimu_h
|
#define trainersimu_h
|
||||||
|
|
||||||
|
|
||||||
|
#include <QShowEvent>
|
||||||
|
#include <QCloseEvent>
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include "modeledit/node.h"
|
#include "modeledit/node.h"
|
||||||
@@ -22,6 +24,8 @@ class TrainerSimulator : public QDialog
|
|||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual void showEvent(QShowEvent *event);
|
||||||
|
virtual void closeEvent(QCloseEvent *event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::TrainerSimulator * ui;
|
Ui::TrainerSimulator * ui;
|
||||||
|
|||||||
@@ -206,7 +206,7 @@ void per10ms()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(FRSKY) || defined(JETI)
|
#if defined(FRSKY) || defined(JETI) || defined(SIMU)
|
||||||
if (!IS_DSM2_SERIAL_PROTOCOL(s_current_protocol[0]))
|
if (!IS_DSM2_SERIAL_PROTOCOL(s_current_protocol[0]))
|
||||||
telemetryInterrupt10ms();
|
telemetryInterrupt10ms();
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user