1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-24 16:55:20 +03:00

Simu threads now correctly stopped

This commit is contained in:
Bertrand Songis 2016-03-11 18:16:53 +01:00
parent 946c17770a
commit 2e57549982
4 changed files with 38 additions and 10 deletions

View file

@ -246,7 +246,10 @@ void generalDefault()
memclear(&g_eeGeneral, sizeof(g_eeGeneral));
g_eeGeneral.version = EEPROM_VER;
g_eeGeneral.variant = EEPROM_VARIANT;
#if !defined(PCBHORUS)
g_eeGeneral.contrast = 25;
#endif
#if defined(PCBFLAMENCO)
g_eeGeneral.vBatWarn = 33;
@ -1055,7 +1058,7 @@ void doSplash()
#if defined(PCBSTD)
lcdSetContrast();
#elif !defined(PCBTARANIS)
#elif !defined(PCBHORUS) && !defined(PCBTARANIS)
tmr10ms_t curTime = get_tmr10ms() + 10;
uint8_t contrast = 10;
lcdSetRefVolt(contrast);
@ -1105,7 +1108,7 @@ void doSplash()
}
#endif
#if !defined(PCBTARANIS) && !defined(PCBSTD)
#if !defined(PCBHORUS) && !defined(PCBTARANIS) && !defined(PCBSTD)
if (curTime < get_tmr10ms()) {
curTime += 10;
if (contrast < g_eeGeneral.contrast) {
@ -1975,6 +1978,11 @@ uint8_t calcStickScroll( uint8_t index )
void opentxStart()
{
#if defined(SIMU)
if (main_thread_running == 2)
return;
#endif
doSplash();
#if defined(DEBUG_TRACE_BUFFER)

View file

@ -79,11 +79,6 @@ Adc Adc0;
uint8_t * eeprom_buffer_data;
volatile int32_t eeprom_buffer_size;
bool eeprom_read_operation;
#define EESIZE_SIMU (128*4096) // TODO why here?
#endif
#if !defined(EESIZE_SIMU)
#define EESIZE_SIMU EESIZE
#endif
#if defined(SDCARD) && !defined(SKIP_FATFS_DECLARATION)
@ -336,7 +331,10 @@ void *eeprom_write_function(void *)
void StartSimu(bool tests)
{
main_thread_running = (tests ? 1 : 2);
s_current_protocol[0] = 255;
menuLevel = 0;
main_thread_running = (tests ? 1 : 2); // TODO rename to simu_run_mode with #define
#if defined(SDCARD)
if (strlen(simuSdDirectory) == 0) {
@ -385,7 +383,11 @@ void StartSimu(bool tests)
void StopSimu()
{
main_thread_running = 0;
#if !defined(CPUARM)
#if defined(CPUARM)
pthread_join(mixerTaskId, NULL);
pthread_join(menusTaskId, NULL);
#else
pthread_join(main_thread_pid, NULL);
#endif
}

View file

@ -336,6 +336,7 @@ extern volatile unsigned char pina, pinb, pinc, pind, pine, pinf, ping, pinh, pi
extern uint8_t portb, portc, porth, dummyport;
extern uint16_t dummyport16;
extern uint8_t main_thread_running;
extern char * main_thread_error;
#define getADC()
#define getADC_bandgap()
@ -362,6 +363,13 @@ void StopEepromThread();
#define StopAudioThread()
#endif
#if !defined(EEPROM_RLC)
#define EESIZE_SIMU (128*4096)
#else
#define EESIZE_SIMU EESIZE
#endif
extern uint8_t eeprom[EESIZE_SIMU];
extern const char * eepromFile;
void eepromReadBlock (uint8_t * pointer_ram, uint32_t address, uint32_t size);

View file

@ -97,6 +97,11 @@ void mixerTask(void * pdata)
while(1) {
#if defined(SIMU)
if (main_thread_running == 0)
return;
#endif
if (!s_pulses_paused) {
uint16_t t0 = getTmr2MHz();
@ -149,6 +154,11 @@ void menusTask(void * pdata)
if (runtime < MENU_TASK_PERIOD_TICKS) {
CoTickDelay(MENU_TASK_PERIOD_TICKS - runtime);
}
#if defined(SIMU)
if (main_thread_running == 0)
return;
#endif
}
#if defined(PCBTARANIS) && defined(REV9E)