Fix line endings to CRLF
This commit is contained in:
parent
0c46bdbfc8
commit
ceb1f78526
24
src/cli.c
24
src/cli.c
|
@ -216,12 +216,12 @@ const clivalue_t valueTable[] = {
|
||||||
|
|
||||||
#define VALUE_COUNT (sizeof(valueTable) / sizeof(clivalue_t))
|
#define VALUE_COUNT (sizeof(valueTable) / sizeof(clivalue_t))
|
||||||
|
|
||||||
|
|
||||||
typedef union {
|
typedef union {
|
||||||
int32_t int_value;
|
int32_t int_value;
|
||||||
float float_value;
|
float float_value;
|
||||||
} int_float_value_t;
|
} int_float_value_t;
|
||||||
|
|
||||||
static void cliSetVar(const clivalue_t *var, const int_float_value_t value);
|
static void cliSetVar(const clivalue_t *var, const int_float_value_t value);
|
||||||
static void cliPrintVar(const clivalue_t *var, uint32_t full);
|
static void cliPrintVar(const clivalue_t *var, uint32_t full);
|
||||||
static void cliPrint(const char *str);
|
static void cliPrint(const char *str);
|
||||||
|
@ -932,12 +932,12 @@ static void cliSet(char *cmdline)
|
||||||
val = &valueTable[i];
|
val = &valueTable[i];
|
||||||
if (strncasecmp(cmdline, valueTable[i].name, strlen(valueTable[i].name)) == 0) {
|
if (strncasecmp(cmdline, valueTable[i].name, strlen(valueTable[i].name)) == 0) {
|
||||||
if (valuef >= valueTable[i].min && valuef <= valueTable[i].max) { // here we compare the float value since... it should work, RIGHT?
|
if (valuef >= valueTable[i].min && valuef <= valueTable[i].max) { // here we compare the float value since... it should work, RIGHT?
|
||||||
int_float_value_t tmp;
|
int_float_value_t tmp;
|
||||||
if (valueTable[i].type == VAR_FLOAT)
|
if (valueTable[i].type == VAR_FLOAT)
|
||||||
tmp.float_value = valuef;
|
tmp.float_value = valuef;
|
||||||
else
|
else
|
||||||
tmp.int_value = value;
|
tmp.int_value = value;
|
||||||
cliSetVar(val, tmp);
|
cliSetVar(val, tmp);
|
||||||
printf("%s set to ", valueTable[i].name);
|
printf("%s set to ", valueTable[i].name);
|
||||||
cliPrintVar(val, 0);
|
cliPrintVar(val, 0);
|
||||||
} else {
|
} else {
|
||||||
|
|
24
src/mixer.c
24
src/mixer.c
|
@ -43,12 +43,12 @@ static const motorMixer_t mixerY6[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static const motorMixer_t mixerHex6P[] = {
|
static const motorMixer_t mixerHex6P[] = {
|
||||||
{ 1.0f, -0.866025f, 0.5f, 1.0f }, // REAR_R
|
{ 1.0f, -0.866025f, 0.5f, 1.0f }, // REAR_R
|
||||||
{ 1.0f, -0.866025f, -0.5f, -1.0f }, // FRONT_R
|
{ 1.0f, -0.866025f, -0.5f, -1.0f }, // FRONT_R
|
||||||
{ 1.0f, 0.866025f, 0.5f, 1.0f }, // REAR_L
|
{ 1.0f, 0.866025f, 0.5f, 1.0f }, // REAR_L
|
||||||
{ 1.0f, 0.866025f, -0.5f, -1.0f }, // FRONT_L
|
{ 1.0f, 0.866025f, -0.5f, -1.0f }, // FRONT_L
|
||||||
{ 1.0f, 0.0f, -1.0f, 1.0f }, // FRONT
|
{ 1.0f, 0.0f, -1.0f, 1.0f }, // FRONT
|
||||||
{ 1.0f, 0.0f, 1.0f, -1.0f }, // REAR
|
{ 1.0f, 0.0f, 1.0f, -1.0f }, // REAR
|
||||||
};
|
};
|
||||||
|
|
||||||
static const motorMixer_t mixerY4[] = {
|
static const motorMixer_t mixerY4[] = {
|
||||||
|
@ -59,12 +59,12 @@ static const motorMixer_t mixerY4[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static const motorMixer_t mixerHex6X[] = {
|
static const motorMixer_t mixerHex6X[] = {
|
||||||
{ 1.0f, -0.5f, 0.866025f, 1.0f }, // REAR_R
|
{ 1.0f, -0.5f, 0.866025f, 1.0f }, // REAR_R
|
||||||
{ 1.0f, -0.5f, -0.866025f, 1.0f }, // FRONT_R
|
{ 1.0f, -0.5f, -0.866025f, 1.0f }, // FRONT_R
|
||||||
{ 1.0f, 0.5f, 0.866025f, -1.0f }, // REAR_L
|
{ 1.0f, 0.5f, 0.866025f, -1.0f }, // REAR_L
|
||||||
{ 1.0f, 0.5f, -0.866025f, -1.0f }, // FRONT_L
|
{ 1.0f, 0.5f, -0.866025f, -1.0f }, // FRONT_L
|
||||||
{ 1.0f, -1.0f, 0.0f, -1.0f }, // RIGHT
|
{ 1.0f, -1.0f, 0.0f, -1.0f }, // RIGHT
|
||||||
{ 1.0f, 1.0f, 0.0f, 1.0f }, // LEFT
|
{ 1.0f, 1.0f, 0.0f, 1.0f }, // LEFT
|
||||||
};
|
};
|
||||||
|
|
||||||
static const motorMixer_t mixerOctoX8[] = {
|
static const motorMixer_t mixerOctoX8[] = {
|
||||||
|
|
152
src/sumd.c
152
src/sumd.c
|
@ -1,76 +1,76 @@
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
#include "mw.h"
|
#include "mw.h"
|
||||||
|
|
||||||
// driver for SUMD receiver using UART2
|
// driver for SUMD receiver using UART2
|
||||||
|
|
||||||
#define SUMD_SYNCBYTE 0xA8
|
#define SUMD_SYNCBYTE 0xA8
|
||||||
#define SUMD_MAX_CHANNEL 8
|
#define SUMD_MAX_CHANNEL 8
|
||||||
#define SUMD_BUFFSIZE (SUMD_MAX_CHANNEL * 2 + 5) // 6 channels + 5 -> 17 bytes for 6 channels
|
#define SUMD_BUFFSIZE (SUMD_MAX_CHANNEL * 2 + 5) // 6 channels + 5 -> 17 bytes for 6 channels
|
||||||
|
|
||||||
static bool sumdFrameDone = false;
|
static bool sumdFrameDone = false;
|
||||||
static void sumdDataReceive(uint16_t c);
|
static void sumdDataReceive(uint16_t c);
|
||||||
static uint16_t sumdReadRawRC(uint8_t chan);
|
static uint16_t sumdReadRawRC(uint8_t chan);
|
||||||
|
|
||||||
static uint32_t sumdChannelData[SUMD_MAX_CHANNEL];
|
static uint32_t sumdChannelData[SUMD_MAX_CHANNEL];
|
||||||
|
|
||||||
void sumdInit(rcReadRawDataPtr *callback)
|
void sumdInit(rcReadRawDataPtr *callback)
|
||||||
{
|
{
|
||||||
core.rcvrport = uartOpen(USART2, sumdDataReceive, 115200, MODE_RX);
|
core.rcvrport = uartOpen(USART2, sumdDataReceive, 115200, MODE_RX);
|
||||||
if (callback)
|
if (callback)
|
||||||
*callback = sumdReadRawRC;
|
*callback = sumdReadRawRC;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t sumd[SUMD_BUFFSIZE] = { 0, };
|
static uint8_t sumd[SUMD_BUFFSIZE] = { 0, };
|
||||||
static uint8_t sumdSize;
|
static uint8_t sumdSize;
|
||||||
|
|
||||||
// Receive ISR callback
|
// Receive ISR callback
|
||||||
static void sumdDataReceive(uint16_t c)
|
static void sumdDataReceive(uint16_t c)
|
||||||
{
|
{
|
||||||
uint32_t sumdTime;
|
uint32_t sumdTime;
|
||||||
static uint32_t sumdTimeLast;
|
static uint32_t sumdTimeLast;
|
||||||
static uint8_t sumdIndex;
|
static uint8_t sumdIndex;
|
||||||
|
|
||||||
sumdTime = micros();
|
sumdTime = micros();
|
||||||
if ((sumdTime - sumdTimeLast) > 4000)
|
if ((sumdTime - sumdTimeLast) > 4000)
|
||||||
sumdIndex = 0;
|
sumdIndex = 0;
|
||||||
sumdTimeLast = sumdTime;
|
sumdTimeLast = sumdTime;
|
||||||
|
|
||||||
if (sumdIndex == 0) {
|
if (sumdIndex == 0) {
|
||||||
if (c != SUMD_SYNCBYTE)
|
if (c != SUMD_SYNCBYTE)
|
||||||
return;
|
return;
|
||||||
else
|
else
|
||||||
sumdFrameDone = false; // lazy main loop didnt fetch the stuff
|
sumdFrameDone = false; // lazy main loop didnt fetch the stuff
|
||||||
}
|
}
|
||||||
if (sumdIndex == 2)
|
if (sumdIndex == 2)
|
||||||
sumdSize = (uint8_t)c;
|
sumdSize = (uint8_t)c;
|
||||||
if (sumdIndex < SUMD_BUFFSIZE)
|
if (sumdIndex < SUMD_BUFFSIZE)
|
||||||
sumd[sumdIndex] = (uint8_t)c;
|
sumd[sumdIndex] = (uint8_t)c;
|
||||||
sumdIndex++;
|
sumdIndex++;
|
||||||
if (sumdIndex == sumdSize * 2 + 5) {
|
if (sumdIndex == sumdSize * 2 + 5) {
|
||||||
sumdIndex = 0;
|
sumdIndex = 0;
|
||||||
sumdFrameDone = true;
|
sumdFrameDone = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool sumdFrameComplete(void)
|
bool sumdFrameComplete(void)
|
||||||
{
|
{
|
||||||
uint8_t b;
|
uint8_t b;
|
||||||
|
|
||||||
if (sumdFrameDone) {
|
if (sumdFrameDone) {
|
||||||
sumdFrameDone = false;
|
sumdFrameDone = false;
|
||||||
if (sumd[1] == 0x01) {
|
if (sumd[1] == 0x01) {
|
||||||
failsafeCnt = 0;
|
failsafeCnt = 0;
|
||||||
if (sumdSize > SUMD_MAX_CHANNEL)
|
if (sumdSize > SUMD_MAX_CHANNEL)
|
||||||
sumdSize = SUMD_MAX_CHANNEL;
|
sumdSize = SUMD_MAX_CHANNEL;
|
||||||
for (b = 0; b < sumdSize; b++)
|
for (b = 0; b < sumdSize; b++)
|
||||||
sumdChannelData[b] = ((sumd[2 * b + 3] << 8) | sumd[2 * b + 4]);
|
sumdChannelData[b] = ((sumd[2 * b + 3] << 8) | sumd[2 * b + 4]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint16_t sumdReadRawRC(uint8_t chan)
|
static uint16_t sumdReadRawRC(uint8_t chan)
|
||||||
{
|
{
|
||||||
return sumdChannelData[mcfg.rcmap[chan]] / 8;
|
return sumdChannelData[mcfg.rcmap[chan]] / 8;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue