mirror of
https://github.com/opentx/opentx.git
synced 2025-07-16 21:05:26 +03:00
Sky9x simulator should now be OK
This commit is contained in:
parent
88ca7fcc68
commit
b6e8b73589
7 changed files with 53 additions and 38 deletions
|
@ -19,6 +19,7 @@
|
|||
*/
|
||||
|
||||
#include "opentx.h"
|
||||
#include "stamp.h"
|
||||
#include <stdarg.h>
|
||||
|
||||
#if defined(SIMU)
|
||||
|
@ -77,7 +78,6 @@ const struct TraceElement * getTraceElement(uint16_t idx)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#include "stamp-opentx.h"
|
||||
|
||||
void dumpTraceBuffer()
|
||||
{
|
||||
|
@ -90,11 +90,13 @@ void dumpTraceBuffer()
|
|||
TRACE_INFO_WP("%4d-%02d-%02d,%02d:%02d:%02d.%02d0", tp.tm_year+1900, tp.tm_mon+1, tp.tm_mday, tp.tm_hour, tp.tm_min, tp.tm_sec, traceBuffer[n].time_ms);
|
||||
TRACE(" %03d 0x%08x", traceBuffer[n].event, traceBuffer[n].data);
|
||||
if (traceBuffer[n].time == 0 && traceBuffer[n].time_ms == 0) break;
|
||||
#if !defined(SIMU)
|
||||
if ((n % 5) == 0) {
|
||||
while (!serial2TxFifo.empty()) {
|
||||
CoTickDelay(1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
TRACE("End of Trace Buffer dump");
|
||||
}
|
||||
|
|
|
@ -82,7 +82,8 @@ void menuTelemetryMavlinkSetup(uint8_t event);
|
|||
|
||||
void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFunctionsContext * functionsContext);
|
||||
|
||||
enum EnumTabDiag {
|
||||
enum EnumTabDiag
|
||||
{
|
||||
e_Setup,
|
||||
CASE_SDCARD(e_Sd)
|
||||
CASE_CPUARM(e_GeneralCustomFunctions)
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "../../opentx.h"
|
||||
#include "opentx.h"
|
||||
#include <stdio.h>
|
||||
|
||||
void drawColumnHeader(const char * const * headers, uint8_t index)
|
||||
|
|
|
@ -1983,7 +1983,13 @@ void opentxStart()
|
|||
return;
|
||||
#endif
|
||||
|
||||
bool display_alerts = (g_eeGeneral.chkSum == evalChkSum());
|
||||
|
||||
#if defined(GUI)
|
||||
if (display_alerts) {
|
||||
doSplash();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(DEBUG_TRACE_BUFFER)
|
||||
trace_event(trace_start, 0x12345678);
|
||||
|
@ -1996,12 +2002,11 @@ void opentxStart()
|
|||
#endif
|
||||
|
||||
#if defined(GUI)
|
||||
if (display_alerts) {
|
||||
checkAlarm();
|
||||
checkAll();
|
||||
#endif
|
||||
|
||||
#if defined(GUI)
|
||||
if (g_eeGeneral.chkSum != evalChkSum()) {
|
||||
}
|
||||
else {
|
||||
chainMenu(menuFirstCalib);
|
||||
}
|
||||
#endif
|
||||
|
@ -2550,6 +2555,13 @@ void opentxInit(OPENTX_INIT_ARGS)
|
|||
|
||||
TRACE("opentxInit()");
|
||||
|
||||
#if defined(GUI)
|
||||
menuHandlers[0] = menuMainView;
|
||||
#if MENUS_LOCK != 2/*no menus*/
|
||||
menuHandlers[1] = menuModelSelect;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(RTCLOCK) && !defined(COPROCESSOR)
|
||||
rtcInit(); // RTC must be initialized before rambackupRestore() is called
|
||||
#endif
|
||||
|
@ -2654,13 +2666,6 @@ void opentxInit(OPENTX_INIT_ARGS)
|
|||
startPulses();
|
||||
|
||||
wdt_enable(WDTO_500MS);
|
||||
|
||||
#if defined(GUI)
|
||||
menuHandlers[0] = menuMainView;
|
||||
#if MENUS_LOCK != 2/*no menus*/
|
||||
menuHandlers[1] = menuModelSelect;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(SIMU)
|
||||
|
|
|
@ -946,9 +946,12 @@ extern uint16_t lastMixerDuration;
|
|||
#define RESET_THR_TRACE() s_timeCum16ThrP = s_timeCumThr = 0
|
||||
#endif
|
||||
|
||||
#if defined(CPUSTM32)
|
||||
#if defined(SIMU)
|
||||
uint16_t getTmr2MHz();
|
||||
uint16_t getTmr16KHz();
|
||||
#elif defined(CPUSTM32)
|
||||
static inline uint16_t getTmr2MHz() { return TIMER_2MHz_TIMER->CNT; }
|
||||
#elif defined(CPUARM)
|
||||
#elif defined(PCBSKY9X)
|
||||
static inline uint16_t getTmr2MHz() { return TC1->TC_CHANNEL[0].TC_CV; }
|
||||
#else
|
||||
uint16_t getTmr16KHz();
|
||||
|
|
|
@ -23,9 +23,7 @@
|
|||
#include <fcntl.h>
|
||||
#include <stdarg.h>
|
||||
#include <sys/stat.h>
|
||||
#if defined(RTCLOCK)
|
||||
#include <time.h>
|
||||
#endif
|
||||
#include <sys/time.h>
|
||||
|
||||
#if defined WIN32 || !defined __GNUC__
|
||||
#include <direct.h>
|
||||
|
@ -96,6 +94,20 @@ void toplcdOff()
|
|||
{
|
||||
}
|
||||
|
||||
uint16_t getTmr16KHz()
|
||||
{
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
return tv.tv_usec * 2 / 125;
|
||||
}
|
||||
|
||||
uint16_t getTmr2MHz()
|
||||
{
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
return tv.tv_usec * 2;
|
||||
}
|
||||
|
||||
void simuInit()
|
||||
{
|
||||
for (int i = 0; i <= 17; i++) {
|
||||
|
@ -273,11 +285,6 @@ void simuSetSwitch(uint8_t swtch, int8_t state)
|
|||
}
|
||||
}
|
||||
|
||||
uint16_t getTmr16KHz()
|
||||
{
|
||||
return get_tmr10ms() * 160;
|
||||
}
|
||||
|
||||
#if !defined(PCBTARANIS) && !defined(PCBHORUS)
|
||||
bool eeprom_thread_running = true;
|
||||
void * eeprom_write_function(void *)
|
||||
|
@ -324,11 +331,6 @@ void *eeprom_write_function(void *)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined WIN32 || !defined __GNUC__
|
||||
#define chdir _chdir
|
||||
#define getcwd _getcwd
|
||||
#endif
|
||||
|
||||
void StartSimu(bool tests)
|
||||
{
|
||||
s_current_protocol[0] = 255;
|
||||
|
@ -1243,7 +1245,7 @@ uint32_t pwrPressed() { return false; }
|
|||
uint32_t pwrCheck() { return true; }
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS) || defined(PCBFLAMENCO) || defined(PCBHORUS)
|
||||
#if defined(CPUSTM32)
|
||||
void pwrInit() { }
|
||||
void pwrOff() { }
|
||||
int usbPlugged() { return false; }
|
||||
|
|
|
@ -28,6 +28,8 @@ extern int g_snapshot_idx;
|
|||
#define sleep(x) Sleep(x)
|
||||
#define strcasecmp _stricmp
|
||||
#define strncasecmp _tcsnicmp
|
||||
#define chdir _chdir
|
||||
#define getcwd _getcwd
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#define sleep(x) usleep(1000*x)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue