mirror of
https://github.com/opentx/opentx.git
synced 2025-07-15 12:25:12 +03:00
VC++ compilation continued
This commit is contained in:
parent
03fa741aa6
commit
4a2a196607
5 changed files with 23 additions and 9 deletions
|
@ -30,6 +30,12 @@
|
||||||
#define BLUETOOTH_COMMAND_BAUD_115200 "TTM:BPS-115200"
|
#define BLUETOOTH_COMMAND_BAUD_115200 "TTM:BPS-115200"
|
||||||
#endif
|
#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_TX_FIFO_SIZE> btTxFifo;
|
||||||
extern Fifo<uint8_t, BT_RX_FIFO_SIZE> btRxFifo;
|
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 address = start;
|
||||||
uint32_t end = start + size;
|
uint32_t end = start + size;
|
||||||
while (address < end) {
|
while (address < end) {
|
||||||
uint32_t addressBigEndian = __builtin_bswap32(address);
|
uint32_t addressBigEndian = SWAP32(address);
|
||||||
bootloaderSendCommand(CMD_SECTOR_ERASE, &addressBigEndian, sizeof(addressBigEndian));
|
bootloaderSendCommand(CMD_SECTOR_ERASE, &addressBigEndian, sizeof(addressBigEndian));
|
||||||
const char * result = bootloaderWaitCommandResponse();
|
const char * result = bootloaderWaitCommandResponse();
|
||||||
if (result)
|
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)
|
const char * Bluetooth::bootloaderStartWriteFlash(uint32_t start, uint32_t size)
|
||||||
{
|
{
|
||||||
uint32_t cmdArgs[2] = {
|
uint32_t cmdArgs[2] = {
|
||||||
__builtin_bswap32(start),
|
SWAP32(start),
|
||||||
__builtin_bswap32(size),
|
SWAP32(size),
|
||||||
};
|
};
|
||||||
bootloaderSendCommand(CMD_DOWNLOAD, cmdArgs, sizeof(cmdArgs));
|
bootloaderSendCommand(CMD_DOWNLOAD, cmdArgs, sizeof(cmdArgs));
|
||||||
const char * result = bootloaderWaitCommandResponse();
|
const char * result = bootloaderWaitCommandResponse();
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "opentx.h"
|
#include "opentx.h"
|
||||||
|
#define _USE_MATH_DEFINES
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#define ACC_LSB_VALUE 0.000488 // 0.488 mg/LSB
|
#define ACC_LSB_VALUE 0.000488 // 0.488 mg/LSB
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#define GET_TRAINER_PPM_POLARITY() g_model.trainerData.pulsePol
|
#define GET_TRAINER_PPM_POLARITY() g_model.trainerData.pulsePol
|
||||||
#define GET_SBUS_POLARITY(idx) g_model.moduleData[idx].sbus.noninverted
|
#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_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)
|
#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)
|
#if defined(PCBHORUS)
|
||||||
|
|
|
@ -137,6 +137,15 @@ struct BindInformation {
|
||||||
|
|
||||||
typedef void (* ModuleCallback)();
|
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 {
|
PACK(struct ModuleState {
|
||||||
uint8_t protocol:4;
|
uint8_t protocol:4;
|
||||||
uint8_t mode:4;
|
uint8_t mode:4;
|
||||||
|
@ -155,11 +164,7 @@ PACK(struct ModuleState {
|
||||||
bindInformation = destination;
|
bindInformation = destination;
|
||||||
callback = bindCallback;
|
callback = bindCallback;
|
||||||
mode = MODULE_MODE_BIND;
|
mode = MODULE_MODE_BIND;
|
||||||
#if defined(SIMU)
|
BIND_INFO;
|
||||||
bindInformation->candidateReceiversCount = 2;
|
|
||||||
strcpy(bindInformation->candidateReceiversNames[0], "SimuRX1");
|
|
||||||
strcpy(bindInformation->candidateReceiversNames[1], "SimuRX2");
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
void readModuleInformation(ModuleInformation * destination, int8_t first, int8_t last)
|
void readModuleInformation(ModuleInformation * destination, int8_t first, int8_t last)
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "opentx.h"
|
#include "opentx.h"
|
||||||
|
#define _USE_MATH_DEFINES
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
TelemetryItem telemetryItems[MAX_TELEMETRY_SENSORS];
|
TelemetryItem telemetryItems[MAX_TELEMETRY_SENSORS];
|
||||||
uint8_t allowNewSensors;
|
uint8_t allowNewSensors;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue