Bsongis/gui refactoring for x7 d (#3701)
* [X7D] New board added * Cosmetics
This commit is contained in:
@@ -51,10 +51,10 @@ endif()
|
||||
if((NOT WIN32) AND FOX_FOUND)
|
||||
if(SIMU_DISKIO)
|
||||
add_definitions(-DSIMU_DISKIO)
|
||||
set(SIMU_SRC ${SIMU_SRC} ../../thirdparty/FatFs/ff.c ../../thirdparty/FatFs/option/ccsbcs.c)
|
||||
set(SIMU_SRC ${SIMU_SRC} ${FATFS_DIR}/FatFs/ff.c ${FATFS_DIR}/option/ccsbcs.c)
|
||||
endif()
|
||||
|
||||
add_executable(simu WIN32 ${SIMU_SRC} ../../simu.cpp)
|
||||
add_executable(simu WIN32 ${SIMU_SRC} ${RADIO_SRC_DIRECTORY}/simu.cpp)
|
||||
add_dependencies(simu ${FIRMWARE_DEPENDENCIES})
|
||||
target_include_directories(simu PUBLIC ${FOX_INCLUDE_DIR} )
|
||||
target_link_libraries(simu ${FOX_LIBRARY} pthread ${SDL_LIBRARY})
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include "opentx.h"
|
||||
#include "simulcd.h"
|
||||
|
||||
int16_t g_anas[NUM_STICKS+NUM_POTS];
|
||||
int16_t g_anas[NUM_STICKS+NUM_POTS+NUM_SLIDERS];
|
||||
|
||||
uint16_t anaIn(uint8_t chan)
|
||||
{
|
||||
@@ -200,7 +200,7 @@ void OpenTxSimulator::sendTelemetry(uint8_t * data, unsigned int len)
|
||||
uint8_t OpenTxSimulator::getSensorInstance(uint16_t id, uint8_t defaultValue)
|
||||
{
|
||||
#if defined(TELEMETRY_FRSKY_SPORT)
|
||||
for (int i = 0; i<MAX_SENSORS; i++) {
|
||||
for (int i = 0; i<MAX_TELEMETRY_SENSORS; i++) {
|
||||
if (isTelemetryFieldAvailable(i)) {
|
||||
TelemetrySensor * sensor = &g_model.telemetrySensors[i];
|
||||
if (sensor->id == id) {
|
||||
@@ -215,7 +215,7 @@ uint8_t OpenTxSimulator::getSensorInstance(uint16_t id, uint8_t defaultValue)
|
||||
uint16_t OpenTxSimulator::getSensorRatio(uint16_t id)
|
||||
{
|
||||
#if defined(TELEMETRY_FRSKY_SPORT)
|
||||
for (int i = 0; i<MAX_SENSORS; i++) {
|
||||
for (int i = 0; i<MAX_TELEMETRY_SENSORS; i++) {
|
||||
if (isTelemetryFieldAvailable(i)) {
|
||||
TelemetrySensor * sensor = &g_model.telemetrySensors[i];
|
||||
if (sensor->id == id) {
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "opentx.h"
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
@@ -52,7 +53,7 @@ pthread_t main_thread_pid;
|
||||
uint8_t main_thread_running = 0;
|
||||
char * main_thread_error = NULL;
|
||||
|
||||
#if defined(CPUSTM32)
|
||||
#if defined(STM32)
|
||||
uint32_t Peri1_frequency, Peri2_frequency;
|
||||
GPIO_TypeDef gpioa, gpiob, gpioc, gpiod, gpioe, gpiof, gpiog, gpioh, gpioi, gpioj;
|
||||
TIM_TypeDef tim1, tim2, tim3, tim4, tim5, tim6, tim7, tim8, tim9, tim10;
|
||||
@@ -120,7 +121,7 @@ uint16_t getTmr2MHz()
|
||||
|
||||
void simuInit()
|
||||
{
|
||||
#if defined(CPUSTM32)
|
||||
#if defined(STM32)
|
||||
RCC->CSR = 0;
|
||||
#endif
|
||||
|
||||
@@ -169,7 +170,8 @@ void simuInit()
|
||||
|
||||
void simuSetKey(uint8_t key, bool state)
|
||||
{
|
||||
// TRACE("simuSetKey(%d, %d)", key, state);
|
||||
// if (state) TRACE("simuSetKey(%d, %d)", key, state);
|
||||
|
||||
switch (key) {
|
||||
#if !defined(PCBHORUS)
|
||||
KEY_CASE(KEY_MENU, KEYS_GPIO_REG_MENU, KEYS_GPIO_PIN_MENU)
|
||||
@@ -230,6 +232,7 @@ void simuSetTrim(uint8_t trim, bool state)
|
||||
void simuSetSwitch(uint8_t swtch, int8_t state)
|
||||
{
|
||||
// TRACE("simuSetSwitch(%d, %d)", swtch, state);
|
||||
|
||||
switch (swtch) {
|
||||
#if defined(PCBFLAMENCO)
|
||||
// SWITCH_3_CASE(0, SWITCHES_GPIO_REG_A_L, SWITCHES_GPIO_REG_A_H, SWITCHES_GPIO_PIN_A_L, SWITCHES_GPIO_PIN_A_H)
|
||||
@@ -243,11 +246,15 @@ void simuSetSwitch(uint8_t swtch, int8_t state)
|
||||
SWITCH_3_CASE(1, SWITCHES_GPIO_REG_B_L, SWITCHES_GPIO_REG_B_H, SWITCHES_GPIO_PIN_B_L, SWITCHES_GPIO_PIN_B_H)
|
||||
SWITCH_3_CASE(2, SWITCHES_GPIO_REG_C_L, SWITCHES_GPIO_REG_C_H, SWITCHES_GPIO_PIN_C_L, SWITCHES_GPIO_PIN_C_H)
|
||||
SWITCH_3_CASE(3, SWITCHES_GPIO_REG_D_L, SWITCHES_GPIO_REG_D_H, SWITCHES_GPIO_PIN_D_L, SWITCHES_GPIO_PIN_D_H)
|
||||
#if !defined(PCBX7D)
|
||||
SWITCH_3_CASE(4, SWITCHES_GPIO_REG_E_L, SWITCHES_GPIO_REG_E_H, SWITCHES_GPIO_PIN_E_L, SWITCHES_GPIO_PIN_E_H)
|
||||
#endif
|
||||
SWITCH_CASE(5, SWITCHES_GPIO_REG_F, SWITCHES_GPIO_PIN_F)
|
||||
#if !defined(PCBX7D)
|
||||
SWITCH_3_CASE(6, SWITCHES_GPIO_REG_G_L, SWITCHES_GPIO_REG_G_H, SWITCHES_GPIO_PIN_G_L, SWITCHES_GPIO_PIN_G_H)
|
||||
#endif
|
||||
SWITCH_CASE(7, SWITCHES_GPIO_REG_H, SWITCHES_GPIO_PIN_H)
|
||||
#if defined(PCBX9E)
|
||||
#if defined(PCBX9E)
|
||||
SWITCH_3_CASE(8, SWITCHES_GPIO_REG_I_L, SWITCHES_GPIO_REG_I_H, SWITCHES_GPIO_PIN_I_L, SWITCHES_GPIO_PIN_I_H)
|
||||
SWITCH_3_CASE(9, SWITCHES_GPIO_REG_J_L, SWITCHES_GPIO_REG_J_H, SWITCHES_GPIO_PIN_J_L, SWITCHES_GPIO_PIN_J_H)
|
||||
SWITCH_3_CASE(10, SWITCHES_GPIO_REG_K_L, SWITCHES_GPIO_REG_K_H, SWITCHES_GPIO_PIN_K_L, SWITCHES_GPIO_PIN_K_H)
|
||||
@@ -258,7 +265,7 @@ void simuSetSwitch(uint8_t swtch, int8_t state)
|
||||
SWITCH_3_CASE(15, SWITCHES_GPIO_REG_P_L, SWITCHES_GPIO_REG_P_H, SWITCHES_GPIO_PIN_P_L, SWITCHES_GPIO_PIN_P_H)
|
||||
SWITCH_3_CASE(16, SWITCHES_GPIO_REG_Q_L, SWITCHES_GPIO_REG_Q_H, SWITCHES_GPIO_PIN_Q_L, SWITCHES_GPIO_PIN_Q_H)
|
||||
SWITCH_3_CASE(17, SWITCHES_GPIO_REG_R_L, SWITCHES_GPIO_REG_R_H, SWITCHES_GPIO_PIN_R_L, SWITCHES_GPIO_PIN_R_H)
|
||||
#endif
|
||||
#endif
|
||||
#elif defined(PCBSKY9X)
|
||||
SWITCH_CASE(0, PIOC->PIO_PDSR, 1<<20)
|
||||
SWITCH_CASE(1, PIOA->PIO_PDSR, 1<<15)
|
||||
@@ -1315,7 +1322,7 @@ uint32_t pwrCheck() { return true; }
|
||||
void pwrOff() { }
|
||||
#endif
|
||||
|
||||
#if defined(CPUSTM32)
|
||||
#if defined(STM32)
|
||||
void pwrInit() { }
|
||||
int usbPlugged() { return false; }
|
||||
void USART_DeInit(USART_TypeDef* ) { }
|
||||
@@ -1376,21 +1383,7 @@ void unlockFlash() { }
|
||||
void lockFlash() { }
|
||||
void writeFlash(uint32_t *address, uint32_t *buffer) { SIMU_SLEEP(100); }
|
||||
uint32_t isBootloaderStart(const void *block) { return 1; }
|
||||
#if defined(PCBX9DP) || defined(PCBX9E)
|
||||
void turnBacklightOn(uint8_t level, uint8_t color)
|
||||
{
|
||||
TIM4->CCR4 = (100-level)*color;
|
||||
TIM4->CCR2 = (100-level)*(100-color);
|
||||
}
|
||||
|
||||
void turnBacklightOff(void)
|
||||
{
|
||||
TIM4->CCR4 = 0;
|
||||
TIM4->CCR2 = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // #if defined(PCBTARANIS)
|
||||
#endif // defined(PCBTARANIS)
|
||||
|
||||
#if defined(PCBFLAMENCO)
|
||||
void i2cWriteTW8823(unsigned char, unsigned char) { }
|
||||
|
||||
@@ -86,7 +86,7 @@ typedef const uint8_t pm_uint8_t;
|
||||
typedef const int16_t pm_int16_t;
|
||||
typedef const int8_t pm_int8_t;
|
||||
|
||||
#if defined(CPUSTM32)
|
||||
#if defined(STM32)
|
||||
extern GPIO_TypeDef gpioa, gpiob, gpioc, gpiod, gpioe, gpiof, gpiog, gpioh, gpioi, gpioj;
|
||||
extern TIM_TypeDef tim1, tim2, tim3, tim4, tim5, tim6, tim7, tim8, tim9, tim10;
|
||||
extern USART_TypeDef Usart0, Usart1, Usart2, Usart3, Usart4;
|
||||
@@ -349,6 +349,7 @@ extern uint32_t Master_frequency;
|
||||
#define NVIC_EnableIRQ(x)
|
||||
#define NVIC_DisableIRQ(x)
|
||||
#define NVIC_SetPriority(...)
|
||||
#define NVIC_SystemReset() exit(0)
|
||||
#define __disable_irq()
|
||||
#define __enable_irq()
|
||||
#endif
|
||||
@@ -442,7 +443,7 @@ OS_TID CoCreateTask(FUNCPtr task, void *argv, uint32_t parameter, void * stk, ui
|
||||
#define UART3_Stop(...)
|
||||
#define USART_GetITStatus(...) 0
|
||||
|
||||
#if defined(CPUSTM32)
|
||||
#if defined(STM32)
|
||||
inline void GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct) { }
|
||||
#define TIM_DeInit(...)
|
||||
#define TIM_SetCompare2(...)
|
||||
@@ -484,9 +485,7 @@ extern char simuSdDirectory[1024];
|
||||
#define sdPoll10ms()
|
||||
#define sd_card_ready() (true)
|
||||
#if !defined(SIMU_DISKIO)
|
||||
#define sdMounted() (true)
|
||||
#define sdMounted() (true)
|
||||
#endif
|
||||
|
||||
inline void ledOff() { }
|
||||
|
||||
#endif // _SIMPGMSPACE_H_
|
||||
|
||||
Reference in New Issue
Block a user