mirror of
https://github.com/opentx/opentx.git
synced 2025-07-26 09:45:21 +03:00
Simu threads now correctly stopped
This commit is contained in:
parent
946c17770a
commit
2e57549982
4 changed files with 38 additions and 10 deletions
|
@ -246,7 +246,10 @@ void generalDefault()
|
||||||
memclear(&g_eeGeneral, sizeof(g_eeGeneral));
|
memclear(&g_eeGeneral, sizeof(g_eeGeneral));
|
||||||
g_eeGeneral.version = EEPROM_VER;
|
g_eeGeneral.version = EEPROM_VER;
|
||||||
g_eeGeneral.variant = EEPROM_VARIANT;
|
g_eeGeneral.variant = EEPROM_VARIANT;
|
||||||
|
|
||||||
|
#if !defined(PCBHORUS)
|
||||||
g_eeGeneral.contrast = 25;
|
g_eeGeneral.contrast = 25;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(PCBFLAMENCO)
|
#if defined(PCBFLAMENCO)
|
||||||
g_eeGeneral.vBatWarn = 33;
|
g_eeGeneral.vBatWarn = 33;
|
||||||
|
@ -1055,7 +1058,7 @@ void doSplash()
|
||||||
|
|
||||||
#if defined(PCBSTD)
|
#if defined(PCBSTD)
|
||||||
lcdSetContrast();
|
lcdSetContrast();
|
||||||
#elif !defined(PCBTARANIS)
|
#elif !defined(PCBHORUS) && !defined(PCBTARANIS)
|
||||||
tmr10ms_t curTime = get_tmr10ms() + 10;
|
tmr10ms_t curTime = get_tmr10ms() + 10;
|
||||||
uint8_t contrast = 10;
|
uint8_t contrast = 10;
|
||||||
lcdSetRefVolt(contrast);
|
lcdSetRefVolt(contrast);
|
||||||
|
@ -1105,7 +1108,7 @@ void doSplash()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(PCBTARANIS) && !defined(PCBSTD)
|
#if !defined(PCBHORUS) && !defined(PCBTARANIS) && !defined(PCBSTD)
|
||||||
if (curTime < get_tmr10ms()) {
|
if (curTime < get_tmr10ms()) {
|
||||||
curTime += 10;
|
curTime += 10;
|
||||||
if (contrast < g_eeGeneral.contrast) {
|
if (contrast < g_eeGeneral.contrast) {
|
||||||
|
@ -1975,6 +1978,11 @@ uint8_t calcStickScroll( uint8_t index )
|
||||||
|
|
||||||
void opentxStart()
|
void opentxStart()
|
||||||
{
|
{
|
||||||
|
#if defined(SIMU)
|
||||||
|
if (main_thread_running == 2)
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
|
||||||
doSplash();
|
doSplash();
|
||||||
|
|
||||||
#if defined(DEBUG_TRACE_BUFFER)
|
#if defined(DEBUG_TRACE_BUFFER)
|
||||||
|
|
|
@ -79,11 +79,6 @@ Adc Adc0;
|
||||||
uint8_t * eeprom_buffer_data;
|
uint8_t * eeprom_buffer_data;
|
||||||
volatile int32_t eeprom_buffer_size;
|
volatile int32_t eeprom_buffer_size;
|
||||||
bool eeprom_read_operation;
|
bool eeprom_read_operation;
|
||||||
#define EESIZE_SIMU (128*4096) // TODO why here?
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(EESIZE_SIMU)
|
|
||||||
#define EESIZE_SIMU EESIZE
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(SDCARD) && !defined(SKIP_FATFS_DECLARATION)
|
#if defined(SDCARD) && !defined(SKIP_FATFS_DECLARATION)
|
||||||
|
@ -336,7 +331,10 @@ void *eeprom_write_function(void *)
|
||||||
|
|
||||||
void StartSimu(bool tests)
|
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 defined(SDCARD)
|
||||||
if (strlen(simuSdDirectory) == 0) {
|
if (strlen(simuSdDirectory) == 0) {
|
||||||
|
@ -385,7 +383,11 @@ void StartSimu(bool tests)
|
||||||
void StopSimu()
|
void StopSimu()
|
||||||
{
|
{
|
||||||
main_thread_running = 0;
|
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);
|
pthread_join(main_thread_pid, NULL);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 uint8_t portb, portc, porth, dummyport;
|
||||||
extern uint16_t dummyport16;
|
extern uint16_t dummyport16;
|
||||||
extern uint8_t main_thread_running;
|
extern uint8_t main_thread_running;
|
||||||
|
extern char * main_thread_error;
|
||||||
|
|
||||||
#define getADC()
|
#define getADC()
|
||||||
#define getADC_bandgap()
|
#define getADC_bandgap()
|
||||||
|
@ -362,6 +363,13 @@ void StopEepromThread();
|
||||||
#define StopAudioThread()
|
#define StopAudioThread()
|
||||||
#endif
|
#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;
|
extern const char * eepromFile;
|
||||||
void eepromReadBlock (uint8_t * pointer_ram, uint32_t address, uint32_t size);
|
void eepromReadBlock (uint8_t * pointer_ram, uint32_t address, uint32_t size);
|
||||||
|
|
||||||
|
|
|
@ -97,6 +97,11 @@ void mixerTask(void * pdata)
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
|
|
||||||
|
#if defined(SIMU)
|
||||||
|
if (main_thread_running == 0)
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!s_pulses_paused) {
|
if (!s_pulses_paused) {
|
||||||
uint16_t t0 = getTmr2MHz();
|
uint16_t t0 = getTmr2MHz();
|
||||||
|
|
||||||
|
@ -149,6 +154,11 @@ void menusTask(void * pdata)
|
||||||
if (runtime < MENU_TASK_PERIOD_TICKS) {
|
if (runtime < MENU_TASK_PERIOD_TICKS) {
|
||||||
CoTickDelay(MENU_TASK_PERIOD_TICKS - runtime);
|
CoTickDelay(MENU_TASK_PERIOD_TICKS - runtime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(SIMU)
|
||||||
|
if (main_thread_running == 0)
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PCBTARANIS) && defined(REV9E)
|
#if defined(PCBTARANIS) && defined(REV9E)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue