1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-14 20:10:08 +03:00

VC++ compilation continued

This commit is contained in:
Kilrah 2019-05-04 12:06:56 +02:00
parent 03fa741aa6
commit 4a2a196607
5 changed files with 23 additions and 9 deletions

View file

@ -30,6 +30,12 @@
#define BLUETOOTH_COMMAND_BAUD_115200 "TTM:BPS-115200"
#endif
#if defined(_MSC_VER)
#define SWAP32(val) (_byteswap_ulong(val))
#elif defined(__GNUC__ )
#define SWAP32(val) (__builtin_bswap32(val))
#endif
extern Fifo<uint8_t, BT_TX_FIFO_SIZE> btTxFifo;
extern Fifo<uint8_t, BT_RX_FIFO_SIZE> btRxFifo;
@ -633,7 +639,7 @@ const char * Bluetooth::bootloaderEraseFlash(uint32_t start, uint32_t size)
uint32_t address = start;
uint32_t end = start + size;
while (address < end) {
uint32_t addressBigEndian = __builtin_bswap32(address);
uint32_t addressBigEndian = SWAP32(address);
bootloaderSendCommand(CMD_SECTOR_ERASE, &addressBigEndian, sizeof(addressBigEndian));
const char * result = bootloaderWaitCommandResponse();
if (result)
@ -649,8 +655,8 @@ const char * Bluetooth::bootloaderEraseFlash(uint32_t start, uint32_t size)
const char * Bluetooth::bootloaderStartWriteFlash(uint32_t start, uint32_t size)
{
uint32_t cmdArgs[2] = {
__builtin_bswap32(start),
__builtin_bswap32(size),
SWAP32(start),
SWAP32(size),
};
bootloaderSendCommand(CMD_DOWNLOAD, cmdArgs, sizeof(cmdArgs));
const char * result = bootloaderWaitCommandResponse();

View file

@ -19,6 +19,7 @@
*/
#include "opentx.h"
#define _USE_MATH_DEFINES
#include <math.h>
#define ACC_LSB_VALUE 0.000488 // 0.488 mg/LSB

View file

@ -30,7 +30,7 @@
#define GET_TRAINER_PPM_POLARITY() g_model.trainerData.pulsePol
#define GET_SBUS_POLARITY(idx) g_model.moduleData[idx].sbus.noninverted
#define GET_MODULE_PPM_DELAY(idx) (g_model.moduleData[idx].ppm.delay * 50 + 300)
#define GET_TRAINER_PPM_DELAY(idx) (g_model.trainerData.delay * 50 + 300)
#define GET_TRAINER_PPM_DELAY() (g_model.trainerData.delay * 50 + 300)
#define SET_DEFAULT_PPM_FRAME_LENGTH(idx) g_model.moduleData[idx].ppm.frameLength = 4 * max((int8_t)0, g_model.moduleData[idx].channelsCount)
#if defined(PCBHORUS)

View file

@ -137,6 +137,15 @@ struct BindInformation {
typedef void (* ModuleCallback)();
#if defined(SIMU)
#define BIND_INFO \
bindInformation->candidateReceiversCount = 2; \
strcpy(bindInformation->candidateReceiversNames[0], "SimuRX1"); \
strcpy(bindInformation->candidateReceiversNames[1], "SimuRX2");
#else
#define BIND_INFO
#endif
PACK(struct ModuleState {
uint8_t protocol:4;
uint8_t mode:4;
@ -155,11 +164,7 @@ PACK(struct ModuleState {
bindInformation = destination;
callback = bindCallback;
mode = MODULE_MODE_BIND;
#if defined(SIMU)
bindInformation->candidateReceiversCount = 2;
strcpy(bindInformation->candidateReceiversNames[0], "SimuRX1");
strcpy(bindInformation->candidateReceiversNames[1], "SimuRX2");
#endif
BIND_INFO;
}
void readModuleInformation(ModuleInformation * destination, int8_t first, int8_t last)
{

View file

@ -19,6 +19,8 @@
*/
#include "opentx.h"
#define _USE_MATH_DEFINES
#include <math.h>
TelemetryItem telemetryItems[MAX_TELEMETRY_SENSORS];
uint8_t allowNewSensors;