Around 30bytes saved
This commit is contained in:
@@ -57,7 +57,9 @@ uint8_t frskyTxBufferCount = 0;
|
|||||||
#endif
|
#endif
|
||||||
uint8_t FrskyRxBufferReady = 0;
|
uint8_t FrskyRxBufferReady = 0;
|
||||||
int8_t frskyStreaming = -1;
|
int8_t frskyStreaming = -1;
|
||||||
|
#if defined(WS_HOW_HIGH)
|
||||||
uint8_t frskyUsrStreaming = 0;
|
uint8_t frskyUsrStreaming = 0;
|
||||||
|
#endif
|
||||||
uint8_t link_counter = 0;
|
uint8_t link_counter = 0;
|
||||||
FrskyData frskyData;
|
FrskyData frskyData;
|
||||||
|
|
||||||
@@ -685,9 +687,11 @@ NOINLINE void check_frsky()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifndef SIMU
|
#ifndef SIMU
|
||||||
|
#if defined(WS_HOW_HIGH)
|
||||||
if (frskyUsrStreaming > 0) {
|
if (frskyUsrStreaming > 0) {
|
||||||
frskyUsrStreaming--;
|
frskyUsrStreaming--;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (frskyStreaming > 0) {
|
if (frskyStreaming > 0) {
|
||||||
frskyStreaming--;
|
frskyStreaming--;
|
||||||
|
|||||||
+2
-2
@@ -186,7 +186,9 @@ extern uint8_t barsThresholds[THLD_MAX];
|
|||||||
|
|
||||||
// Global Fr-Sky telemetry data variables
|
// Global Fr-Sky telemetry data variables
|
||||||
extern int8_t frskyStreaming; // >0 (true) == data is streaming in. 0 = nodata detected for some time
|
extern int8_t frskyStreaming; // >0 (true) == data is streaming in. 0 = nodata detected for some time
|
||||||
|
#if defined(WS_HOW_HIGH)
|
||||||
extern uint8_t frskyUsrStreaming;
|
extern uint8_t frskyUsrStreaming;
|
||||||
|
#endif
|
||||||
|
|
||||||
#define SEND_MODEL_ALARMS 6
|
#define SEND_MODEL_ALARMS 6
|
||||||
extern uint8_t frskyAlarmsSendState;
|
extern uint8_t frskyAlarmsSendState;
|
||||||
@@ -196,8 +198,6 @@ extern FrskyData frskyData;
|
|||||||
extern uint8_t frskyTxBuffer[FRSKY_TX_PACKET_SIZE];
|
extern uint8_t frskyTxBuffer[FRSKY_TX_PACKET_SIZE];
|
||||||
extern uint8_t frskyTxBufferCount;
|
extern uint8_t frskyTxBufferCount;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void FRSKY_Init(void);
|
void FRSKY_Init(void);
|
||||||
NOINLINE void check_frsky(void);
|
NOINLINE void check_frsky(void);
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -73,7 +73,7 @@ void hapticQueue::heartbeat()
|
|||||||
buzzTimeLeft = queueHapticLength[t_queueRidx];
|
buzzTimeLeft = queueHapticLength[t_queueRidx];
|
||||||
buzzPause = queueHapticPause[t_queueRidx];
|
buzzPause = queueHapticPause[t_queueRidx];
|
||||||
if (!queueHapticRepeat[t_queueRidx]--) {
|
if (!queueHapticRepeat[t_queueRidx]--) {
|
||||||
t_queueRidx = (t_queueRidx + 1) % HAPTIC_QUEUE_LENGTH;
|
t_queueRidx = (t_queueRidx + 1) & (HAPTIC_QUEUE_LENGTH-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -94,7 +94,7 @@ void hapticQueue::play(uint8_t tLen, uint8_t tPause, uint8_t tFlags)
|
|||||||
|
|
||||||
tFlags &= 0x0f;
|
tFlags &= 0x0f;
|
||||||
if (tFlags) {
|
if (tFlags) {
|
||||||
uint8_t next_queueWidx = (t_queueWidx + 1) % HAPTIC_QUEUE_LENGTH;
|
uint8_t next_queueWidx = (t_queueWidx + 1) & (HAPTIC_QUEUE_LENGTH-1);
|
||||||
if (next_queueWidx != t_queueRidx) {
|
if (next_queueWidx != t_queueRidx) {
|
||||||
queueHapticLength[t_queueWidx] = tLen;
|
queueHapticLength[t_queueWidx] = tLen;
|
||||||
queueHapticPause[t_queueWidx] = tPause;
|
queueHapticPause[t_queueWidx] = tPause;
|
||||||
|
|||||||
+1
-1
@@ -34,7 +34,7 @@
|
|||||||
#ifndef haptic_h
|
#ifndef haptic_h
|
||||||
#define haptic_h
|
#define haptic_h
|
||||||
|
|
||||||
#define HAPTIC_QUEUE_LENGTH 3
|
#define HAPTIC_QUEUE_LENGTH 2
|
||||||
|
|
||||||
class hapticQueue
|
class hapticQueue
|
||||||
{
|
{
|
||||||
|
|||||||
+5
-3
@@ -72,7 +72,9 @@ void doMainScreenGrphics()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(MASSSTORAGE)
|
||||||
extern char usbState;
|
extern char usbState;
|
||||||
|
#endif
|
||||||
|
|
||||||
void menuMainView(uint8_t event)
|
void menuMainView(uint8_t event)
|
||||||
{
|
{
|
||||||
@@ -210,7 +212,7 @@ void menuMainView(uint8_t event)
|
|||||||
if (unexpectedShutdown) {
|
if (unexpectedShutdown) {
|
||||||
lcd_putcAtt(20*FW-3, 0*FH, '!', INVERS);
|
lcd_putcAtt(20*FW-3, 0*FH, '!', INVERS);
|
||||||
}
|
}
|
||||||
#if defined(PCBARM)
|
#if defined(MASSSTORAGE)
|
||||||
if (usbState >= '0')
|
if (usbState >= '0')
|
||||||
lcd_putcAtt(20*FW-3, 0*FH, usbState, INVERS);
|
lcd_putcAtt(20*FW-3, 0*FH, usbState, INVERS);
|
||||||
#endif
|
#endif
|
||||||
@@ -289,9 +291,9 @@ void menuMainView(uint8_t event)
|
|||||||
x0 = (i%4*9+3)*FW/2;
|
x0 = (i%4*9+3)*FW/2;
|
||||||
y0 = i/4*FH+40;
|
y0 = i/4*FH+40;
|
||||||
#if defined (DECIMALS_DISPLAYED)
|
#if defined (DECIMALS_DISPLAYED)
|
||||||
lcd_outdezAtt( x0+4*FW , y0, GPERC(val), PREC1);
|
lcd_outdezAtt( x0+4*FW , y0, calcRESXto1000(val), PREC1);
|
||||||
#else
|
#else
|
||||||
lcd_outdezAtt( x0+4*FW , y0, GPERC(val)/10, 0); // G: Don't like the decimal part*
|
lcd_outdezAtt( x0+4*FW , y0, calcRESXto1000(val)/10, 0); // G: Don't like the decimal part*
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -2145,7 +2145,7 @@ void menuProcLimits(uint8_t _event)
|
|||||||
lcd_outdezAtt(13*FW, 0, PPM_CENTER+limitaddress(sub)->ppmCenter+g_chans512[sub]/2, 0);
|
lcd_outdezAtt(13*FW, 0, PPM_CENTER+limitaddress(sub)->ppmCenter+g_chans512[sub]/2, 0);
|
||||||
lcd_puts(13*FW, 0, STR_US);
|
lcd_puts(13*FW, 0, STR_US);
|
||||||
#else
|
#else
|
||||||
lcd_outdezAtt(13*FW, 0, GPERC(g_chans512[sub]), PREC1);
|
lcd_outdezAtt(13*FW, 0, calcRESXto1000(g_chans512[sub]), PREC1);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+8
-5
@@ -468,6 +468,13 @@ int16_t calc1000toRESX(int16_t x) // improve calc time by Pat MacKenzie
|
|||||||
x-=y;
|
x-=y;
|
||||||
return x+(y>>2);
|
return x+(y>>2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int16_t calcRESXto1000(int16_t x)
|
||||||
|
{
|
||||||
|
// *1000/1024 = x - x/32 + x/128
|
||||||
|
return (x - x/32 + x/128);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int16_t applyLimits(uint8_t channel, int32_t value)
|
int16_t applyLimits(uint8_t channel, int32_t value)
|
||||||
@@ -3280,8 +3287,6 @@ void mixerTask(void * pdata)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// #define MASSSTORAGE
|
|
||||||
|
|
||||||
#ifdef MASSSTORAGE
|
#ifdef MASSSTORAGE
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
@@ -3314,8 +3319,6 @@ extern "C" {
|
|||||||
#include "../Atmel/sam3s/sam3s-ek/libraries/usb/device/massstorage/MSDDriver.c"
|
#include "../Atmel/sam3s/sam3s-ek/libraries/usb/device/massstorage/MSDDriver.c"
|
||||||
#include "../Atmel/sam3s/sam3s-ek/libraries/usb/device/core/USBDDriver.c"
|
#include "../Atmel/sam3s/sam3s-ek/libraries/usb/device/core/USBDDriver.c"
|
||||||
#include "../Atmel/sam3s/sam3s-ek/libraries/usb/device/core/USBD.c"
|
#include "../Atmel/sam3s/sam3s-ek/libraries/usb/device/core/USBD.c"
|
||||||
// #include "../Atmel/sam3s/sam3s-ek/libraries/usb/device/core/USBDCallbacks.c"
|
|
||||||
// #include "../Atmel/sam3s/sam3s-ek/libraries/usb/device/core/USBDDriverCallbacks.c"
|
|
||||||
#include "../Atmel/sam3s/sam3s-ek/libraries/libchip_sam3s/source/USBD_HAL.c"
|
#include "../Atmel/sam3s/sam3s-ek/libraries/libchip_sam3s/source/USBD_HAL.c"
|
||||||
#include "../Atmel/sam3s/sam3s-ek/libraries/usb/common/core/USBDescriptors.c"
|
#include "../Atmel/sam3s/sam3s-ek/libraries/usb/common/core/USBDescriptors.c"
|
||||||
#include "../Atmel/sam3s/sam3s-ek/libraries/usb/device/massstorage/MSDFunction.c"
|
#include "../Atmel/sam3s/sam3s-ek/libraries/usb/device/massstorage/MSDFunction.c"
|
||||||
@@ -3454,7 +3457,7 @@ static void _ConfigureTc0(void)
|
|||||||
void USBDCallbacks_Initialized(void)
|
void USBDCallbacks_Initialized(void)
|
||||||
{
|
{
|
||||||
TRACE_INFO("USBDCallbacks_Initialized\n\r");
|
TRACE_INFO("USBDCallbacks_Initialized\n\r");
|
||||||
NVIC_EnableIRQ(UDP_IRQn);
|
NVIC_EnableIRQ(UDP_IRQn);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+5
-4
@@ -42,6 +42,10 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#if defined(PCBARM)
|
||||||
|
// #define MASSSTORAGE
|
||||||
|
#endif
|
||||||
|
|
||||||
#define EEPROM_VARIANTS (0x00)
|
#define EEPROM_VARIANTS (0x00)
|
||||||
|
|
||||||
#if defined(PCBSTD)
|
#if defined(PCBSTD)
|
||||||
@@ -836,12 +840,9 @@ inline int16_t calc1000toRESX( register int32_t x) // improve calc time by Pat
|
|||||||
#else
|
#else
|
||||||
extern int16_t calc100toRESX(int8_t x);
|
extern int16_t calc100toRESX(int8_t x);
|
||||||
extern int16_t calc1000toRESX(int16_t x);
|
extern int16_t calc1000toRESX(int16_t x);
|
||||||
|
extern int16_t calcRESXto1000(int16_t x);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// *1000/1024 = x - x/32 + x/128
|
|
||||||
// TODO flash saving?
|
|
||||||
#define GPERC(x) (x - x/32 + x/128)
|
|
||||||
|
|
||||||
#if defined(PCBARM)
|
#if defined(PCBARM)
|
||||||
// This doesn't need protection on this processor
|
// This doesn't need protection on this processor
|
||||||
#define tmr10ms_t uint32_t
|
#define tmr10ms_t uint32_t
|
||||||
|
|||||||
+2
-2
@@ -79,7 +79,7 @@ void audioQueue::heartbeat()
|
|||||||
toneFreqIncr = queueToneFreqIncr[t_queueRidx];
|
toneFreqIncr = queueToneFreqIncr[t_queueRidx];
|
||||||
tonePause = queueTonePause[t_queueRidx];
|
tonePause = queueTonePause[t_queueRidx];
|
||||||
if (!queueToneRepeat[t_queueRidx]--) {
|
if (!queueToneRepeat[t_queueRidx]--) {
|
||||||
t_queueRidx = (t_queueRidx + 1) % AUDIO_QUEUE_LENGTH;
|
t_queueRidx = (t_queueRidx + 1) & (AUDIO_QUEUE_LENGTH-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -147,7 +147,7 @@ void audioQueue::play(uint8_t tFreq, uint8_t tLen, uint8_t tPause,
|
|||||||
|
|
||||||
tFlags &= 0x0f;
|
tFlags &= 0x0f;
|
||||||
if (tFlags) {
|
if (tFlags) {
|
||||||
uint8_t next_queueWidx = (t_queueWidx + 1) % AUDIO_QUEUE_LENGTH;
|
uint8_t next_queueWidx = (t_queueWidx + 1) & (AUDIO_QUEUE_LENGTH-1);
|
||||||
if (next_queueWidx != t_queueRidx) {
|
if (next_queueWidx != t_queueRidx) {
|
||||||
queueToneFreq[t_queueWidx] = tFreq;
|
queueToneFreq[t_queueWidx] = tFreq;
|
||||||
queueToneLength[t_queueWidx] = tLen;
|
queueToneLength[t_queueWidx] = tLen;
|
||||||
|
|||||||
Reference in New Issue
Block a user