Minor misc. fixes (#4729)

* [Simulator] Remove extraneous format value in microsTimer; Better way to delete SimulatorStartupDialog (in case no event loop starts).

* [Simulator] No helpers dependency for SimulatorStartupDialog.

* [simpgmspace] Rename micros timer function and make externally available.

* [Companion] Fix possible uninitialized value in TreeModel (compiler warning).

* [multi_arm] Fix minor compiler warning (MSVC: "unsafe mix of type 'uint8_t' and type 'bool' in operation").

* [lua] Fix compiler warning ("'data' may be used uninitialized in this function").

* [OpenTxSimulator] Fix analogs array range.

* [Simulator] Auto-start simulator when SimulatorMainWindow is first shown (vs. before it was shown).

* [Simulator] DebugOutput: prevent possible mutex deadlock on buffer overflow (force queued connection for Qt < 5.3).

* [Companion] Display calibration data for Horus joysticks (MOUSE1/MOUSE2)
This commit is contained in:
Max Paperno
2017-04-01 08:13:24 +02:00
committed by Bertrand Songis
parent 9c7c8244f4
commit 5dabe53af4
14 changed files with 35 additions and 27 deletions
+1 -1
View File
@@ -408,7 +408,7 @@ static int luaCrossfireTelemetryPop(lua_State * L)
}
}
uint8_t length, data;
uint8_t length = 0, data = 0;
if (luaInputTelemetryFifo->probe(length) && luaInputTelemetryFifo->size() >= uint32_t(length)) {
// length value includes the length field
luaInputTelemetryFifo->pop(length);
+1 -1
View File
@@ -74,7 +74,7 @@ static void sendByteMulti(uint8_t b) //max 11 changes 0 10 10 10 10 P 1
uint8_t len = BITLEN_MULTI; //max val: 10*20 < 256
for (uint8_t i=0; i<=9; i++) { //8Bits + 1Parity + Stop=1
bool nlev = b & 1; //lsb first
parity = parity ^ nlev;
parity = parity ^ (uint8_t)nlev;
if (lev == nlev) {
len += BITLEN_MULTI;
}
+1 -1
View File
@@ -18,7 +18,7 @@
#include "opentx.h"
#include "simulcd.h"
int16_t g_anas[NUM_STICKS+NUM_POTS+NUM_SLIDERS];
int16_t g_anas[Analogs::NUM_ANALOGS];
uint16_t anaIn(uint8_t chan)
{
+5 -5
View File
@@ -81,7 +81,7 @@ void toplcdOff()
{
}
U64 microsTimer(void)
uint64_t simuTimerMicros(void)
{
#if SIMPGMSPC_USE_QT
@@ -104,7 +104,7 @@ U64 microsTimer(void)
freqScale = 1e6 / frequency.QuadPart;
// init timer
QueryPerformanceCounter(&firstTick);
TRACE_SIMPGMSPACE("microsTimer() init: first tick = %llu @ %llu Hz: %g", firstTick.QuadPart, frequency.QuadPart);
TRACE_SIMPGMSPACE("microsTimer() init: first tick = %llu @ %llu Hz", firstTick.QuadPart, frequency.QuadPart);
}
// read the timer
QueryPerformanceCounter(&newTick);
@@ -121,18 +121,18 @@ U64 microsTimer(void)
uint16_t getTmr16KHz()
{
return microsTimer() * 2 / 125;
return simuTimerMicros() * 2 / 125;
}
uint16_t getTmr2MHz()
{
return microsTimer() * 2;
return simuTimerMicros() * 2;
}
// return 2ms resolution to match CoOS settings
U64 CoGetOSTime(void)
{
return microsTimer() / 2000;
return simuTimerMicros() / 2000;
}
void simuInit()
+5 -3
View File
@@ -356,15 +356,16 @@ extern char * main_thread_error;
#define SIMU_SLEEP(x) do { if (!main_thread_running) return; sleep(x/*ms*/); } while (0)
#define SIMU_SLEEP_NORET(x) do { sleep(x/*ms*/); } while (0)
uint64_t simuTimerMicros(void);
void simuInit();
void StartSimu(bool tests=true, const char * sdPath = 0, const char * settingsPath = 0);
void StopSimu();
void simuSetKey(uint8_t key, bool state);
void simuSetTrim(uint8_t trim, bool state);
void simuSetSwitch(uint8_t swtch, int8_t state);
void StartSimu(bool tests=true, const char * sdPath = 0, const char * settingsPath = 0);
void StopSimu();
void StartEepromThread(const char *filename="eeprom.bin");
void StopEepromThread();
#if defined(SIMU_AUDIO) && defined(CPUARM)
@@ -419,6 +420,7 @@ OS_TID CoCreateTask(FUNCPtr task, void *argv, uint32_t parameter, void * stk, ui
#define CoTickDelay(x) sleep(2*(x))
#define CoCreateFlag(...) 0
U64 CoGetOSTime(void);
#define UART_Stop(...)
#define UART3_Stop(...)
#define USART_GetITStatus(...) 0