fix(simulator): fixed LCD flush sync with QT simulator (#2030)
This commit is contained in:
@@ -133,6 +133,8 @@ void SimulatedUIWidget::onLcdChange(bool backlightEnable)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
m_lcd->onLcdChanged(backlightEnable);
|
m_lcd->onLcdChanged(backlightEnable);
|
||||||
|
m_simulator->lcdFlushed();
|
||||||
|
|
||||||
setLightOn(backlightEnable);
|
setLightOn(backlightEnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -145,6 +145,7 @@ class SimulatorInterface : public QObject
|
|||||||
virtual void setInputValue(int type, uint8_t index, int16_t value) = 0;
|
virtual void setInputValue(int type, uint8_t index, int16_t value) = 0;
|
||||||
virtual void rotaryEncoderEvent(int steps) = 0;
|
virtual void rotaryEncoderEvent(int steps) = 0;
|
||||||
virtual void touchEvent(int type, int x, int y) = 0;
|
virtual void touchEvent(int type, int x, int y) = 0;
|
||||||
|
virtual void lcdFlushed() = 0;
|
||||||
virtual void setTrainerTimeout(uint16_t ms) = 0;
|
virtual void setTrainerTimeout(uint16_t ms) = 0;
|
||||||
virtual void sendTelemetry(const QByteArray data) = 0;
|
virtual void sendTelemetry(const QByteArray data) = 0;
|
||||||
virtual void setLuaStateReloadPermanentScripts() = 0;
|
virtual void setLuaStateReloadPermanentScripts() = 0;
|
||||||
|
|||||||
@@ -96,7 +96,6 @@ FXIMPLEMENT(OpenTxSim, FXMainWindow, OpenTxSimMap, ARRAYNUMBER(OpenTxSimMap))
|
|||||||
OpenTxSim::OpenTxSim(FXApp* a):
|
OpenTxSim::OpenTxSim(FXApp* a):
|
||||||
FXMainWindow(a, "OpenTX Simu", nullptr, nullptr, DECOR_ALL, 20, 90, 0, 0)
|
FXMainWindow(a, "OpenTX Simu", nullptr, nullptr, DECOR_ALL, 20, 90, 0, 0)
|
||||||
{
|
{
|
||||||
lcdInit();
|
|
||||||
bmp = new FXPPMImage(getApp(), nullptr, IMAGE_OWNED|IMAGE_KEEP|IMAGE_SHMI|IMAGE_SHMP, W2, H2);
|
bmp = new FXPPMImage(getApp(), nullptr, IMAGE_OWNED|IMAGE_KEEP|IMAGE_SHMI|IMAGE_SHMP, W2, H2);
|
||||||
|
|
||||||
#if defined(SIMU_AUDIO)
|
#if defined(SIMU_AUDIO)
|
||||||
|
|||||||
@@ -132,8 +132,7 @@ void OpenTxSimulator::init()
|
|||||||
|
|
||||||
void OpenTxSimulator::start(const char * filename, bool tests)
|
void OpenTxSimulator::start(const char * filename, bool tests)
|
||||||
{
|
{
|
||||||
if (isRunning())
|
if (isRunning()) return;
|
||||||
return;
|
|
||||||
ETXS_DBG << "file:" << filename << "tests:" << tests;
|
ETXS_DBG << "file:" << filename << "tests:" << tests;
|
||||||
|
|
||||||
QMutexLocker lckr(&m_mtxSimuMain);
|
QMutexLocker lckr(&m_mtxSimuMain);
|
||||||
@@ -375,6 +374,11 @@ void OpenTxSimulator::touchEvent(int type, int x, int y)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OpenTxSimulator::lcdFlushed()
|
||||||
|
{
|
||||||
|
::lcdFlushed();
|
||||||
|
}
|
||||||
|
|
||||||
void OpenTxSimulator::setTrainerTimeout(uint16_t ms)
|
void OpenTxSimulator::setTrainerTimeout(uint16_t ms)
|
||||||
{
|
{
|
||||||
ppmInputValidityTimer = ms;
|
ppmInputValidityTimer = ms;
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ class DLLEXPORT OpenTxSimulator : public SimulatorInterface
|
|||||||
virtual void setInputValue(int type, uint8_t index, int16_t value);
|
virtual void setInputValue(int type, uint8_t index, int16_t value);
|
||||||
virtual void rotaryEncoderEvent(int steps);
|
virtual void rotaryEncoderEvent(int steps);
|
||||||
virtual void touchEvent(int type, int x, int y);
|
virtual void touchEvent(int type, int x, int y);
|
||||||
|
virtual void lcdFlushed();
|
||||||
virtual void setTrainerTimeout(uint16_t ms);
|
virtual void setTrainerTimeout(uint16_t ms);
|
||||||
virtual void sendTelemetry(const QByteArray data);
|
virtual void sendTelemetry(const QByteArray data);
|
||||||
virtual void setLuaStateReloadPermanentScripts();
|
virtual void setLuaStateReloadPermanentScripts();
|
||||||
|
|||||||
@@ -207,6 +207,9 @@ void simuStart(bool tests, const char * sdPath, const char * settingsPath)
|
|||||||
try {
|
try {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Init LCD call backs
|
||||||
|
lcdInit();
|
||||||
|
|
||||||
#if !defined(SIMU_BOOTLOADER)
|
#if !defined(SIMU_BOOTLOADER)
|
||||||
simuMain();
|
simuMain();
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -947,6 +947,7 @@ void lcdSetRefVolt(unsigned char val);
|
|||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
void lcdSetContrast(bool useDefault = false);
|
void lcdSetContrast(bool useDefault = false);
|
||||||
#endif
|
#endif
|
||||||
|
void lcdFlushed();
|
||||||
|
|
||||||
// Top LCD driver
|
// Top LCD driver
|
||||||
#if defined(TOPLCD_GPIO)
|
#if defined(TOPLCD_GPIO)
|
||||||
|
|||||||
Reference in New Issue
Block a user