Next branch fixes #3141 Fx key to reload scripts

This commit is contained in:
David S. Beach
2015-12-27 11:53:29 -05:00
parent b778c5e469
commit 3e409a0371
11 changed files with 40 additions and 0 deletions
@@ -60,6 +60,8 @@ class Er9xSimulator : public SimulatorInterface {
virtual void setTrainerInput(unsigned int inputNumber, int16_t value) {};
virtual void setLuaStateReloadPermanentScripts() {};
protected:
Er9xInterface * er9xInterface;
@@ -60,6 +60,8 @@ class Ersky9xSimulator : public SimulatorInterface {
virtual void setTrainerInput(unsigned int inputNumber, int16_t value) {};
virtual void setLuaStateReloadPermanentScripts() {};
protected:
Ersky9xInterface * ersky9xInterface;
@@ -644,6 +644,13 @@ void OpenTxSimulator::setTrainerInput(unsigned int inputNumber, ::int16_t value)
#include "simulatorimport.h"
}
void OpenTxSimulator::setLuaStateReloadPermanentScripts()
{
#if defined(LUA)
luaState = INTERPRETER_RELOAD_PERMANENT_SCRIPTS;
#endif
}
void OpenTxSimulator::installTraceHook(void (*callback)(const char *))
{
traceCallback = callback;
@@ -137,6 +137,8 @@ class DLLEXPORT OpenTxSimulator : public SimulatorInterface {
virtual void setTrainerInput(unsigned int inputNumber, int16_t value);
virtual void installTraceHook(void (*callback)(const char *));
virtual void setLuaStateReloadPermanentScripts();
};
}
@@ -1461,6 +1461,13 @@ QPushButton:checked {
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="luaReload">
<property name="text">
<string>PF7 - Reload Lua Scripts</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="4" column="0">
@@ -1754,6 +1754,13 @@ QPushButton:checked {
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="luaReload">
<property name="text">
<string>PF7 - Reload Lua Scripts</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
@@ -73,6 +73,7 @@ SimulatorDialog::SimulatorDialog(QWidget * parent, SimulatorInterface *simulator
new QShortcut(QKeySequence(Qt::Key_F4), this, SLOT(openTelemetrySimulator()));
new QShortcut(QKeySequence(Qt::Key_F5), this, SLOT(openTrainerSimulator()));
new QShortcut(QKeySequence(Qt::Key_F6), this, SLOT(openDebugOutput()));
new QShortcut(QKeySequence(Qt::Key_F7), this, SLOT(luaReload()));
traceCallbackInstance = this;
}
@@ -166,11 +167,18 @@ void SimulatorDialog::openDebugOutput()
}
}
void SimulatorDialog::luaReload()
{
// force a reload of the lua environment (as if a standalone script were run)
simulator->setLuaStateReloadPermanentScripts();
}
void SimulatorDialog::onDebugOutputClose()
{
DebugOut = 0;
}
void SimulatorDialog::keyPressEvent (QKeyEvent *event)
{
switch (event->key()) {
@@ -155,6 +155,7 @@ class SimulatorDialog : public QDialog
void openTrainerSimulator();
void openDebugOutput();
void onDebugOutputClose();
void luaReload();
#ifdef JOYSTICKS
void onjoystickAxisValueChanged(int axis, int value);
@@ -73,6 +73,7 @@ SimulatorDialogHorus::SimulatorDialogHorus(QWidget * parent, SimulatorInterface
connect(ui->teleSim, SIGNAL(released()), this, SLOT(openTelemetrySimulator()));
connect(ui->trainerSim, SIGNAL(released()), this, SLOT(openTrainerSimulator()));
connect(ui->debugConsole, SIGNAL(released()), this, SLOT(openDebugOutput()));
connect(ui->luaReload, SIGNAL(released()), this, SLOT(luaReload()));
}
SimulatorDialogHorus::~SimulatorDialogHorus()
@@ -80,6 +80,7 @@ SimulatorDialogTaranis::SimulatorDialogTaranis(QWidget * parent, SimulatorInterf
connect(ui->teleSim, SIGNAL(released()), this, SLOT(openTelemetrySimulator()));
connect(ui->trainerSim, SIGNAL(released()), this, SLOT(openTrainerSimulator()));
connect(ui->debugConsole, SIGNAL(released()), this, SLOT(openDebugOutput()));
connect(ui->luaReload, SIGNAL(released()), this, SLOT(luaReload()));
}
SimulatorDialogTaranis::~SimulatorDialogTaranis()
@@ -106,6 +106,8 @@ class SimulatorInterface
virtual void setTrainerInput(unsigned int inputNumber, int16_t value) = 0;
virtual void installTraceHook(void (*callback)(const char *)) = 0;
virtual void setLuaStateReloadPermanentScripts() = 0;
};
class SimulatorFactory {