[sky9x] Stack probe
[sky9x] No sprintf (needed heap) [sky9x] Bug when retrieving available SD audio files
This commit is contained in:
+2
-10
@@ -128,10 +128,6 @@ PPM_LIMITS_UNIT = PERCENT
|
|||||||
# Values = YES, NO
|
# Values = YES, NO
|
||||||
DECIMALS = YES
|
DECIMALS = YES
|
||||||
|
|
||||||
# DISPLAY_USER_DATA to display on screen data from FrSky module (testing/demo purpose)
|
|
||||||
# Values = YES, NO
|
|
||||||
DISPLAY_USER_DATA = NO
|
|
||||||
|
|
||||||
# FrSky Hub
|
# FrSky Hub
|
||||||
# Values = YES, NO
|
# Values = YES, NO
|
||||||
FRSKY_HUB = YES
|
FRSKY_HUB = YES
|
||||||
@@ -438,7 +434,6 @@ ifeq ($(PCB), X9D)
|
|||||||
SRC += sky9x/usb/device/core/USBD_UDP.c sky9x/usb/device/core/USBDDriver.c
|
SRC += sky9x/usb/device/core/USBD_UDP.c sky9x/usb/device/core/USBDDriver.c
|
||||||
SRC += sky9x/usb/device/massstorage/MSDDriver.c sky9x/usb/device/massstorage/MSDDStateMachine.c sky9x/usb/device/massstorage/MSDLun.c sky9x/usb/device/massstorage/MSDDriverDescriptors.c sky9x/usb/device/massstorage/SBCMethods.c
|
SRC += sky9x/usb/device/massstorage/MSDDriver.c sky9x/usb/device/massstorage/MSDDStateMachine.c sky9x/usb/device/massstorage/MSDLun.c sky9x/usb/device/massstorage/MSDDriverDescriptors.c sky9x/usb/device/massstorage/SBCMethods.c
|
||||||
SRC += sky9x/usb/common/core/USBEndpointDescriptor.c sky9x/usb/common/core/USBGenericRequest.c sky9x/usb/common/core/USBFeatureRequest.c sky9x/usb/common/core/USBInterfaceRequest.c sky9x/usb/common/core/USBGetDescriptorRequest.c sky9x/usb/common/core/USBSetAddressRequest.c sky9x/usb/common/core/USBSetConfigurationRequest.c sky9x/usb/common/core/USBConfigurationDescriptor.c sky9x/usb/common/core/USBGenericDescriptor.c
|
SRC += sky9x/usb/common/core/USBEndpointDescriptor.c sky9x/usb/common/core/USBGenericRequest.c sky9x/usb/common/core/USBFeatureRequest.c sky9x/usb/common/core/USBInterfaceRequest.c sky9x/usb/common/core/USBGetDescriptorRequest.c sky9x/usb/common/core/USBSetAddressRequest.c sky9x/usb/common/core/USBSetConfigurationRequest.c sky9x/usb/common/core/USBConfigurationDescriptor.c sky9x/usb/common/core/USBGenericDescriptor.c
|
||||||
SRC += sky9x/syscalls.c
|
|
||||||
SRC += sky9x/MEDSdcard.c
|
SRC += sky9x/MEDSdcard.c
|
||||||
EEPROMSRC = eeprom_arm.cpp
|
EEPROMSRC = eeprom_arm.cpp
|
||||||
PULSESSRC = pulses_arm.cpp
|
PULSESSRC = pulses_arm.cpp
|
||||||
@@ -458,6 +453,7 @@ ifeq ($(PCB), X9D)
|
|||||||
|
|
||||||
ifeq ($(DEBUG), YES)
|
ifeq ($(DEBUG), YES)
|
||||||
CPPSRC += sky9x/debug.cpp
|
CPPSRC += sky9x/debug.cpp
|
||||||
|
SRC += sky9x/syscalls.c
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -472,7 +468,6 @@ ifeq ($(PCB), SKY9X)
|
|||||||
SRC += sky9x/usb/device/core/USBD_UDP.c sky9x/usb/device/core/USBDDriver.c
|
SRC += sky9x/usb/device/core/USBD_UDP.c sky9x/usb/device/core/USBDDriver.c
|
||||||
SRC += sky9x/usb/device/massstorage/MSDDriver.c sky9x/usb/device/massstorage/MSDDStateMachine.c sky9x/usb/device/massstorage/MSDLun.c sky9x/usb/device/massstorage/MSDDriverDescriptors.c sky9x/usb/device/massstorage/SBCMethods.c
|
SRC += sky9x/usb/device/massstorage/MSDDriver.c sky9x/usb/device/massstorage/MSDDStateMachine.c sky9x/usb/device/massstorage/MSDLun.c sky9x/usb/device/massstorage/MSDDriverDescriptors.c sky9x/usb/device/massstorage/SBCMethods.c
|
||||||
SRC += sky9x/usb/common/core/USBEndpointDescriptor.c sky9x/usb/common/core/USBGenericRequest.c sky9x/usb/common/core/USBFeatureRequest.c sky9x/usb/common/core/USBInterfaceRequest.c sky9x/usb/common/core/USBGetDescriptorRequest.c sky9x/usb/common/core/USBSetAddressRequest.c sky9x/usb/common/core/USBSetConfigurationRequest.c sky9x/usb/common/core/USBConfigurationDescriptor.c sky9x/usb/common/core/USBGenericDescriptor.c
|
SRC += sky9x/usb/common/core/USBEndpointDescriptor.c sky9x/usb/common/core/USBGenericRequest.c sky9x/usb/common/core/USBFeatureRequest.c sky9x/usb/common/core/USBInterfaceRequest.c sky9x/usb/common/core/USBGetDescriptorRequest.c sky9x/usb/common/core/USBSetAddressRequest.c sky9x/usb/common/core/USBSetConfigurationRequest.c sky9x/usb/common/core/USBConfigurationDescriptor.c sky9x/usb/common/core/USBGenericDescriptor.c
|
||||||
SRC += sky9x/syscalls.c
|
|
||||||
SRC += sky9x/MEDSdcard.c
|
SRC += sky9x/MEDSdcard.c
|
||||||
EEPROMSRC = eeprom_arm.cpp
|
EEPROMSRC = eeprom_arm.cpp
|
||||||
PULSESSRC = pulses_arm.cpp
|
PULSESSRC = pulses_arm.cpp
|
||||||
@@ -493,6 +488,7 @@ ifeq ($(PCB), SKY9X)
|
|||||||
|
|
||||||
ifeq ($(DEBUG), YES)
|
ifeq ($(DEBUG), YES)
|
||||||
CPPSRC += sky9x/debug.cpp
|
CPPSRC += sky9x/debug.cpp
|
||||||
|
SRC += sky9x/syscalls.c
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -614,10 +610,6 @@ ifeq ($(TEMPLATES), YES)
|
|||||||
CPPSRC += templates.cpp
|
CPPSRC += templates.cpp
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(DISPLAY_USER_DATA), YES)
|
|
||||||
CPPDEFS += -DDISPLAY_USER_DATA
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(PXX), YES)
|
ifeq ($(PXX), YES)
|
||||||
CPPDEFS += -DPXX
|
CPPDEFS += -DPXX
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -67,23 +67,6 @@ FrskyData frskyData;
|
|||||||
uint8_t barsThresholds[THLD_MAX];
|
uint8_t barsThresholds[THLD_MAX];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DISPLAY_USER_DATA
|
|
||||||
/*
|
|
||||||
Copies all available bytes (up to max bufsize) from frskyUserData circular
|
|
||||||
buffer into supplied *buffer. Returns number of bytes copied (or zero)
|
|
||||||
*/
|
|
||||||
uint8_t frskyGetUserData(char *buffer, uint8_t bufSize)
|
|
||||||
{
|
|
||||||
uint8_t i = 0;
|
|
||||||
while (!frskyUserData.isEmpty())
|
|
||||||
{
|
|
||||||
buffer[i] = frskyUserData.get();
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
uint16_t getChannelRatio(uint8_t channel)
|
uint16_t getChannelRatio(uint8_t channel)
|
||||||
{
|
{
|
||||||
return (uint16_t)g_model.frsky.channels[channel].ratio << g_model.frsky.channels[channel].multiplier;
|
return (uint16_t)g_model.frsky.channels[channel].ratio << g_model.frsky.channels[channel].multiplier;
|
||||||
|
|||||||
+20
-10
@@ -38,6 +38,7 @@
|
|||||||
|
|
||||||
uint8_t displayBuf[DISPLAY_W*DISPLAY_H/8];
|
uint8_t displayBuf[DISPLAY_W*DISPLAY_H/8];
|
||||||
#define DISPLAY_END (displayBuf+sizeof(displayBuf))
|
#define DISPLAY_END (displayBuf+sizeof(displayBuf))
|
||||||
|
#define ASSERT_IN_DISPLAY(p) assert((p) >= displayBuf && (p) < DISPLAY_END)
|
||||||
|
|
||||||
#ifdef SIMU
|
#ifdef SIMU
|
||||||
bool lcd_refresh = true;
|
bool lcd_refresh = true;
|
||||||
@@ -60,6 +61,7 @@ void lcd_img(uint8_t x, uint8_t y, const pm_uchar * img, uint8_t idx, uint8_t mo
|
|||||||
uint8_t *p = &displayBuf[ (y / 8 + yb) * DISPLAY_W + x ];
|
uint8_t *p = &displayBuf[ (y / 8 + yb) * DISPLAY_W + x ];
|
||||||
for (uint8_t i=0; i<w; i++){
|
for (uint8_t i=0; i<w; i++){
|
||||||
uint8_t b = pgm_read_byte(q++);
|
uint8_t b = pgm_read_byte(q++);
|
||||||
|
ASSERT_IN_DISPLAY(p);
|
||||||
*p++ = inv ? ~b : b;
|
*p++ = inv ? ~b : b;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -102,11 +104,13 @@ void lcd_putcAtt(uint8_t x, uint8_t y, const unsigned char c, uint8_t mode)
|
|||||||
b1 = pgm_read_byte(q++); /*top byte*/
|
b1 = pgm_read_byte(q++); /*top byte*/
|
||||||
b2 = pgm_read_byte(q++); /*top byte*/
|
b2 = pgm_read_byte(q++); /*top byte*/
|
||||||
}
|
}
|
||||||
if(inv) {
|
if (inv) {
|
||||||
b1=~b1;
|
b1=~b1;
|
||||||
b2=~b2;
|
b2=~b2;
|
||||||
}
|
}
|
||||||
if(&p[DISPLAY_W+1] < DISPLAY_END) {
|
if(&p[DISPLAY_W+1] < DISPLAY_END) {
|
||||||
|
ASSERT_IN_DISPLAY(p);
|
||||||
|
ASSERT_IN_DISPLAY(p+DISPLAY_W);
|
||||||
p[0]=b1;
|
p[0]=b1;
|
||||||
p[DISPLAY_W] = b2;
|
p[DISPLAY_W] = b2;
|
||||||
p++;
|
p++;
|
||||||
@@ -133,10 +137,16 @@ void lcd_putcAtt(uint8_t x, uint8_t y, const unsigned char c, uint8_t mode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (p<DISPLAY_END) {
|
if (p<DISPLAY_END) {
|
||||||
|
ASSERT_IN_DISPLAY(p);
|
||||||
*p = (*p & (~(0xff << ym8))) + (b << ym8);
|
*p = (*p & (~(0xff << ym8))) + (b << ym8);
|
||||||
if (ym8) { uint8_t *r = p + DISPLAY_W; if (r<DISPLAY_END) *r = (*r & (~(0xff >> (8-ym8)))) + (b >> (8-ym8)); }
|
if (ym8) {
|
||||||
|
uint8_t *r = p + DISPLAY_W;
|
||||||
|
if (r<DISPLAY_END)
|
||||||
|
*r = (*r & (~(0xff >> (8-ym8)))) + (b >> (8-ym8));
|
||||||
|
}
|
||||||
#ifdef BOLD_FONT
|
#ifdef BOLD_FONT
|
||||||
if (mode & BOLD) {
|
if (mode & BOLD) {
|
||||||
|
ASSERT_IN_DISPLAY(p+1);
|
||||||
if (inv)
|
if (inv)
|
||||||
*(p+1) &= (b << ym8);
|
*(p+1) &= (b << ym8);
|
||||||
else
|
else
|
||||||
@@ -342,7 +352,7 @@ void lcd_outdezNAtt(uint8_t x, uint8_t y, int16_t val, LcdFlags flags, uint8_t l
|
|||||||
|
|
||||||
void lcd_mask(uint8_t *p, uint8_t mask, uint8_t att)
|
void lcd_mask(uint8_t *p, uint8_t mask, uint8_t att)
|
||||||
{
|
{
|
||||||
assert(p >= displayBuf && p < DISPLAY_END);
|
ASSERT_IN_DISPLAY(p);
|
||||||
|
|
||||||
if (att & BLACK)
|
if (att & BLACK)
|
||||||
*p |= mask;
|
*p |= mask;
|
||||||
@@ -354,7 +364,7 @@ void lcd_mask(uint8_t *p, uint8_t mask, uint8_t att)
|
|||||||
|
|
||||||
void lcd_plot(uint8_t x,uint8_t y, uint8_t att)
|
void lcd_plot(uint8_t x,uint8_t y, uint8_t att)
|
||||||
{
|
{
|
||||||
uint8_t *p = &displayBuf[ y / 8 * DISPLAY_W + x ];
|
uint8_t *p = &displayBuf[ y / 8 * DISPLAY_W + x ];
|
||||||
if (p<DISPLAY_END)
|
if (p<DISPLAY_END)
|
||||||
lcd_mask(p, BITMASK(y%8), att);
|
lcd_mask(p, BITMASK(y%8), att);
|
||||||
}
|
}
|
||||||
@@ -400,7 +410,7 @@ void lcd_vlineStip(uint8_t x, int8_t y, int8_t h, uint8_t pat, uint8_t att)
|
|||||||
uint8_t *p = &displayBuf[ y / 8 * DISPLAY_W + x ];
|
uint8_t *p = &displayBuf[ y / 8 * DISPLAY_W + x ];
|
||||||
y = y % 8;
|
y = y % 8;
|
||||||
if (y) {
|
if (y) {
|
||||||
assert(p >= displayBuf && p < DISPLAY_END);
|
ASSERT_IN_DISPLAY(p);
|
||||||
uint8_t msk = ~(BITMASK(y)-1);
|
uint8_t msk = ~(BITMASK(y)-1);
|
||||||
h -= 8-y;
|
h -= 8-y;
|
||||||
if (h < 0)
|
if (h < 0)
|
||||||
@@ -409,13 +419,13 @@ void lcd_vlineStip(uint8_t x, int8_t y, int8_t h, uint8_t pat, uint8_t att)
|
|||||||
p += DISPLAY_W;
|
p += DISPLAY_W;
|
||||||
}
|
}
|
||||||
while (h>=8) {
|
while (h>=8) {
|
||||||
assert(p >= displayBuf && p < DISPLAY_END);
|
ASSERT_IN_DISPLAY(p);
|
||||||
lcd_mask(p, pat, att);
|
lcd_mask(p, pat, att);
|
||||||
p += DISPLAY_W;
|
p += DISPLAY_W;
|
||||||
h -= 8;
|
h -= 8;
|
||||||
}
|
}
|
||||||
if (h>0) {
|
if (h>0) {
|
||||||
assert(p >= displayBuf && p < DISPLAY_END);
|
ASSERT_IN_DISPLAY(p);
|
||||||
lcd_mask(p, (BITMASK(h)-1) & pat, att);
|
lcd_mask(p, (BITMASK(h)-1) & pat, att);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -433,13 +443,13 @@ void lcd_vlineStip(uint8_t x, int8_t y, int8_t h, uint8_t pat)
|
|||||||
uint8_t *p = &displayBuf[ y / 8 * DISPLAY_W + x ];
|
uint8_t *p = &displayBuf[ y / 8 * DISPLAY_W + x ];
|
||||||
y = y % 8;
|
y = y % 8;
|
||||||
if (y) {
|
if (y) {
|
||||||
assert(p >= displayBuf && p < DISPLAY_END);
|
ASSERT_IN_DISPLAY(p);
|
||||||
*p ^= ~(BITMASK(y)-1) & pat;
|
*p ^= ~(BITMASK(y)-1) & pat;
|
||||||
p += DISPLAY_W;
|
p += DISPLAY_W;
|
||||||
h -= 8-y;
|
h -= 8-y;
|
||||||
}
|
}
|
||||||
while (h>0) {
|
while (h>0) {
|
||||||
assert(p >= displayBuf && p < DISPLAY_END);
|
ASSERT_IN_DISPLAY(p);
|
||||||
*p ^= pat;
|
*p ^= pat;
|
||||||
p += DISPLAY_W;
|
p += DISPLAY_W;
|
||||||
h -= 8;
|
h -= 8;
|
||||||
@@ -447,7 +457,7 @@ void lcd_vlineStip(uint8_t x, int8_t y, int8_t h, uint8_t pat)
|
|||||||
if (h < 0) h += 8;
|
if (h < 0) h += 8;
|
||||||
if (h) {
|
if (h) {
|
||||||
p -= DISPLAY_W;
|
p -= DISPLAY_W;
|
||||||
assert(p >= displayBuf && p < DISPLAY_END);
|
ASSERT_IN_DISPLAY(p);
|
||||||
*p ^= ~(BITMASK(h)-1) & pat;
|
*p ^= ~(BITMASK(h)-1) & pat;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+30
-44
@@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
#if defined(PCBSKY9X)
|
#if defined(PCBSKY9X)
|
||||||
#define MIXER_STACK_SIZE 500
|
#define MIXER_STACK_SIZE 500
|
||||||
#define MENUS_STACK_SIZE 2500
|
#define MENUS_STACK_SIZE 1000
|
||||||
#define AUDIO_STACK_SIZE 500
|
#define AUDIO_STACK_SIZE 500
|
||||||
#define BT_STACK_SIZE 500
|
#define BT_STACK_SIZE 500
|
||||||
#define DEBUG_STACK_SIZE 500
|
#define DEBUG_STACK_SIZE 500
|
||||||
@@ -2293,10 +2293,6 @@ void perOut(uint8_t tick10ms)
|
|||||||
mixWarning = lv_mixWarning;
|
mixWarning = lv_mixWarning;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DISPLAY_USER_DATA
|
|
||||||
char userDataDisplayBuf[TELEM_SCREEN_BUFFER_SIZE];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(SIMU)
|
#if defined(SIMU)
|
||||||
#define TIME_TO_WRITE s_eeDirtyMsk
|
#define TIME_TO_WRITE s_eeDirtyMsk
|
||||||
#else
|
#else
|
||||||
@@ -2672,27 +2668,6 @@ void perMain()
|
|||||||
writeLogs();
|
writeLogs();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(FRSKY) && defined(DISPLAY_USER_DATA)
|
|
||||||
char userDataRxBuffer[21]; // Temp buffer used to collect fr-sky user data
|
|
||||||
|
|
||||||
// retrieve bytes from user data buffer and insert into display string,
|
|
||||||
// scrolling at the 21 character mark (edge of screen)
|
|
||||||
uint8_t numbytes = frskyGetUserData(userDataRxBuffer, 21); // Get as many bytes as we can
|
|
||||||
|
|
||||||
static uint8_t displayBufferIndex;
|
|
||||||
for (uint8_t byt=0; byt < numbytes; byt++)
|
|
||||||
{
|
|
||||||
displayBufferIndex++;
|
|
||||||
if (displayBufferIndex > 20)
|
|
||||||
{
|
|
||||||
for (int xx=0; xx<20; xx++) // scroll one char left
|
|
||||||
userDataDisplayBuf[xx] = userDataDisplayBuf[xx+1];
|
|
||||||
displayBufferIndex = 20;
|
|
||||||
}
|
|
||||||
userDataDisplayBuf[displayBufferIndex] = userDataRxBuffer[byt];
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
lcd_clear();
|
lcd_clear();
|
||||||
|
|
||||||
#if defined(PCBSKY9X) && defined(SIMU)
|
#if defined(PCBSKY9X) && defined(SIMU)
|
||||||
@@ -3186,8 +3161,35 @@ ISR(INT6_vect)
|
|||||||
}
|
}
|
||||||
#endif //PCBGRUVIN9X+ROTARY_ENCODERS
|
#endif //PCBGRUVIN9X+ROTARY_ENCODERS
|
||||||
|
|
||||||
#if !defined(PCBSKY9X)
|
#if defined(PCBSKY9X)
|
||||||
|
void stack_paint()
|
||||||
|
{
|
||||||
|
for (uint16_t i=0; i<MENUS_STACK_SIZE; i++)
|
||||||
|
menusStack[i] = 0x55555555;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t stack_free()
|
||||||
|
{
|
||||||
|
for (uint16_t i=0; i<MENUS_STACK_SIZE; i++)
|
||||||
|
if (menusStack[i] != 0x55555555)
|
||||||
|
return i;
|
||||||
|
return MENUS_STACK_SIZE;
|
||||||
|
}
|
||||||
|
#else
|
||||||
extern unsigned char __bss_end ;
|
extern unsigned char __bss_end ;
|
||||||
|
#define STACKPTR _SFR_IO16(0x3D)
|
||||||
|
void stack_paint()
|
||||||
|
{
|
||||||
|
// Init Stack while interrupts are disabled
|
||||||
|
unsigned char *p ;
|
||||||
|
unsigned char *q ;
|
||||||
|
|
||||||
|
p = (unsigned char *) STACKPTR ;
|
||||||
|
q = &__bss_end ;
|
||||||
|
p -= 2 ;
|
||||||
|
while ( p > q )
|
||||||
|
*p-- = 0x55 ;
|
||||||
|
}
|
||||||
|
|
||||||
uint16_t stack_free()
|
uint16_t stack_free()
|
||||||
{
|
{
|
||||||
@@ -3200,7 +3202,6 @@ uint16_t stack_free()
|
|||||||
}
|
}
|
||||||
return p - &__bss_end ;
|
return p - &__bss_end ;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBGRUVIN9X)
|
#if defined(PCBGRUVIN9X)
|
||||||
@@ -3382,22 +3383,7 @@ int main(void)
|
|||||||
|
|
||||||
lcd_init();
|
lcd_init();
|
||||||
|
|
||||||
#if !defined(PCBSKY9X)
|
stack_paint();
|
||||||
// Init Stack while interrupts are disabled
|
|
||||||
#define STACKPTR _SFR_IO16(0x3D)
|
|
||||||
{
|
|
||||||
unsigned char *p ;
|
|
||||||
unsigned char *q ;
|
|
||||||
|
|
||||||
p = (unsigned char *) STACKPTR ;
|
|
||||||
q = &__bss_end ;
|
|
||||||
p -= 2 ;
|
|
||||||
while ( p > q )
|
|
||||||
{
|
|
||||||
*p-- = 0x55 ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
g_menuStack[0] = menuMainView;
|
g_menuStack[0] = menuMainView;
|
||||||
g_menuStack[1] = menuProcModelSelect;
|
g_menuStack[1] = menuProcModelSelect;
|
||||||
|
|||||||
@@ -945,11 +945,6 @@ inline bool isFunctionActive(uint8_t func)
|
|||||||
return activeFunctions & (1 << (func-FUNC_TRAINER));
|
return activeFunctions & (1 << (func-FUNC_TRAINER));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DISPLAY_USER_DATA
|
|
||||||
#define TELEM_SCREEN_BUFFER_SIZE 21
|
|
||||||
extern char userDataDisplayBuf[TELEM_SCREEN_BUFFER_SIZE]; // text buffer for frsky telem. user data experiments
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(ROTARY_ENCODERS)
|
#if defined(ROTARY_ENCODERS)
|
||||||
// Global rotary encoder registers -- 8-bit, 0-255
|
// Global rotary encoder registers -- 8-bit, 0-255
|
||||||
#if defined(PCBSKY9X)
|
#if defined(PCBSKY9X)
|
||||||
|
|||||||
@@ -72,6 +72,12 @@ extern "C" {
|
|||||||
void retrieveAvailableAudioFiles()
|
void retrieveAvailableAudioFiles()
|
||||||
{
|
{
|
||||||
FILINFO info;
|
FILINFO info;
|
||||||
|
#if _USE_LFN
|
||||||
|
TCHAR lfn[_MAX_LFN + 1];
|
||||||
|
info.lfname = lfn;
|
||||||
|
info.lfsize = sizeof(lfn);
|
||||||
|
#endif
|
||||||
|
|
||||||
char filename[32] = SYSTEM_SOUNDS_PATH "/";
|
char filename[32] = SYSTEM_SOUNDS_PATH "/";
|
||||||
|
|
||||||
#if !defined WIN32 && defined __GNUC__
|
#if !defined WIN32 && defined __GNUC__
|
||||||
|
|||||||
+87
-14
@@ -78,17 +78,90 @@ Media medias[MAX_LUNS];
|
|||||||
/** Device LUNs. */
|
/** Device LUNs. */
|
||||||
MSDLun luns[MAX_LUNS];
|
MSDLun luns[MAX_LUNS];
|
||||||
|
|
||||||
char *bytes2Str(char *str, uint32_t bytes)
|
int itoa(int val, char* buf)
|
||||||
{
|
{
|
||||||
if (bytes < 1024*100)
|
const unsigned int radix = 10;
|
||||||
sprintf(str, "%lu.%luK", bytes / 1024, (bytes % 1024) / 103);
|
|
||||||
else if (bytes < 1024*1024)
|
char* p;
|
||||||
sprintf(str, "%luK", bytes / 1024);
|
unsigned int a; //every digit
|
||||||
else if (bytes < 1024*1024*100)
|
int len;
|
||||||
sprintf(str, "%lu.%luM", bytes / (1024*1024), (bytes % (1024*1024)) / 104858);
|
char* b; //start of the digit char
|
||||||
else
|
char temp;
|
||||||
sprintf(str, "%luM", bytes / (1024*1024));
|
unsigned int u;
|
||||||
return str;
|
|
||||||
|
p = buf;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
if (val < 0)
|
||||||
|
{
|
||||||
|
*p++ = '-';
|
||||||
|
val = 0 - val;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
u = (unsigned int)val;
|
||||||
|
|
||||||
|
b = p;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
a = u % radix;
|
||||||
|
u /= radix;
|
||||||
|
|
||||||
|
*p++ = a + '0';
|
||||||
|
|
||||||
|
} while (u > 0);
|
||||||
|
|
||||||
|
len = (int)(p - buf);
|
||||||
|
|
||||||
|
*p-- = 0;
|
||||||
|
|
||||||
|
//swap
|
||||||
|
do
|
||||||
|
{
|
||||||
|
temp = *p;
|
||||||
|
*p = *b;
|
||||||
|
*b = temp;
|
||||||
|
--p;
|
||||||
|
++b;
|
||||||
|
|
||||||
|
} while (b < p);
|
||||||
|
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t write_bytes(char *str, uint32_t bytes)
|
||||||
|
{
|
||||||
|
uint8_t len;
|
||||||
|
if (bytes < 1024*100) {
|
||||||
|
len = itoa(bytes / 1024, str);
|
||||||
|
str[len] = '.';
|
||||||
|
str[len+1] = '0' + ((bytes % 1024) / 103);
|
||||||
|
str[len+2] = 'K';
|
||||||
|
str[len+3] = '\0';
|
||||||
|
len += 3;
|
||||||
|
}
|
||||||
|
else if (bytes < 1024*1024) {
|
||||||
|
len = itoa(bytes / 1024, str);
|
||||||
|
str[len] = 'K';
|
||||||
|
str[len+1] = '\0';
|
||||||
|
len += 1;
|
||||||
|
}
|
||||||
|
else if (bytes < 1024*1024*100) {
|
||||||
|
len = itoa(bytes / (1024*1024), str);
|
||||||
|
str[len] = '.';
|
||||||
|
str[len+1] = '0' + ((bytes % (1024*1024)) / 104858);
|
||||||
|
str[len+2] = 'M';
|
||||||
|
str[len+3] = '\0';
|
||||||
|
len += 3;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
len = itoa(bytes / (1024*1024), str);
|
||||||
|
str[len] = 'M';
|
||||||
|
str[len+1] = '\0';
|
||||||
|
len += 1;
|
||||||
|
}
|
||||||
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MSDCallbacks_Data( unsigned char flowDirection, unsigned int dataLength,
|
static void MSDCallbacks_Data( unsigned char flowDirection, unsigned int dataLength,
|
||||||
@@ -99,10 +172,10 @@ static void MSDCallbacks_Data( unsigned char flowDirection, unsigned int dataLen
|
|||||||
else
|
else
|
||||||
msdWriteTotal += dataLength;
|
msdWriteTotal += dataLength;
|
||||||
|
|
||||||
char rdStr[10];
|
strcpy(statusLineMsg, "USB Rd:");
|
||||||
char wrStr[10];
|
uint8_t len = write_bytes(statusLineMsg+7, msdReadTotal);
|
||||||
|
strcpy(statusLineMsg+7+len, " Wr:");
|
||||||
sprintf(statusLineMsg, "USB Rd:%s Wr:%s", bytes2Str(rdStr, msdReadTotal), bytes2Str(wrStr, msdWriteTotal));
|
write_bytes(statusLineMsg+7+len+4, msdWriteTotal);
|
||||||
showStatusLine();
|
showStatusLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -128,12 +128,13 @@ SECTIONS
|
|||||||
*(.bss.*)
|
*(.bss.*)
|
||||||
|
|
||||||
. = ALIGN(4); /* Align the end of the section */
|
. = ALIGN(4); /* Align the end of the section */
|
||||||
*(.ram.b)
|
|
||||||
_end = .;
|
|
||||||
__end = .;
|
|
||||||
} > RAM
|
} > RAM
|
||||||
_ebss = .; /* Provide the name for the end of this section */
|
_ebss = .; /* Provide the name for the end of this section */
|
||||||
|
|
||||||
|
. = ALIGN(4); /* Align the end of the section */
|
||||||
|
__end = .;
|
||||||
|
_end = .;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The ".stack" section is our stack.
|
* The ".stack" section is our stack.
|
||||||
* Here this section starts at the end of the ram segment.
|
* Here this section starts at the end of the ram segment.
|
||||||
|
|||||||
+19
-28
@@ -117,43 +117,34 @@ void menuProcDebug(uint8_t event)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(PCBSKY9X)
|
#if defined(PCBSKY9X)
|
||||||
|
#if defined(REVB)
|
||||||
|
lcd_putsLeft(1*FH, STR_CPU_CURRENT);
|
||||||
|
putsTelemetryValue(MENU_DEBUG_COL_OFS, 1*FH, getCurrent(), UNIT_MILLIAMPS, 0);
|
||||||
|
uint32_t current_scale = 488 + g_eeGeneral.currentCalib;
|
||||||
|
putsTelemetryValue(20*FW+2, 1*FH, Current_max*10*current_scale/8192, UNIT_RAW, 0);
|
||||||
|
lcd_putsLeft(2*FH, STR_CPU_MAH);
|
||||||
|
putsTelemetryValue(MENU_DEBUG_COL_OFS, 2*FH, g_eeGeneral.mAhUsed + Current_used*current_scale/8192/36, UNIT_MAH, PREC1);
|
||||||
|
putsTime(17*FW, 2*FH, g_eeGeneral.globalTimer + sessionTimer, 0, 0);
|
||||||
|
#endif
|
||||||
|
lcd_putsLeft(3*FH, STR_CPU_TEMP);
|
||||||
|
putsTelemetryValue(MENU_DEBUG_COL_OFS, 3*FH, getTemperature(), UNIT_DEGREES, 0);
|
||||||
|
putsTelemetryValue(20*FW+2, 3*FH, maxTemperature+g_eeGeneral.temperatureCalib, UNIT_DEGREES, 0);
|
||||||
|
lcd_putsLeft(4*FH, STR_TMAINMAXMS);
|
||||||
|
lcd_outdezAtt(MENU_DEBUG_COL_OFS, 4*FH, (g_timeMainMax)/20, PREC2);
|
||||||
|
#else
|
||||||
lcd_putsLeft(1*FH, STR_TMR1LATMAXUS);
|
lcd_putsLeft(1*FH, STR_TMR1LATMAXUS);
|
||||||
lcd_outdez8(MENU_DEBUG_COL_OFS , 1*FH, g_tmr1Latency_max/2 );
|
lcd_outdez8(MENU_DEBUG_COL_OFS , 1*FH, g_tmr1Latency_max/2 );
|
||||||
lcd_putsLeft(2*FH, STR_TMR1LATMINUS);
|
lcd_putsLeft(2*FH, STR_TMR1LATMINUS);
|
||||||
lcd_outdez8(MENU_DEBUG_COL_OFS , 2*FH, g_tmr1Latency_min/2 );
|
lcd_outdez8(MENU_DEBUG_COL_OFS , 2*FH, g_tmr1Latency_min/2 );
|
||||||
lcd_putsLeft(3*FH, STR_TMR1JITTERUS);
|
lcd_putsLeft(3*FH, STR_TMR1JITTERUS);
|
||||||
lcd_outdez8(MENU_DEBUG_COL_OFS , 3*FH, (g_tmr1Latency_max - g_tmr1Latency_min) /2 );
|
lcd_outdez8(MENU_DEBUG_COL_OFS , 3*FH, (g_tmr1Latency_max - g_tmr1Latency_min) /2 );
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PCBSKY9X)
|
|
||||||
lcd_putsLeft(5*FH, STR_TMAINMAXMS);
|
|
||||||
lcd_outdezAtt(MENU_DEBUG_COL_OFS, 5*FH, (g_timeMainMax)/20, PREC2);
|
|
||||||
#else
|
|
||||||
lcd_putsLeft(4*FH, STR_TMAINMAXMS);
|
lcd_putsLeft(4*FH, STR_TMAINMAXMS);
|
||||||
lcd_outdezAtt(MENU_DEBUG_COL_OFS, 4*FH, (g_timeMainMax*100)/16, PREC2);
|
lcd_outdezAtt(MENU_DEBUG_COL_OFS, 4*FH, (g_timeMainMax*100)/16, PREC2);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBSKY9X)
|
lcd_putsLeft(5*FH, STR_FREESTACKMINB);
|
||||||
#if defined(REVB)
|
lcd_outdezAtt(14*FW, 5*FH, stack_free(), UNSIGN) ;
|
||||||
lcd_putsLeft(2*FH, STR_CPU_CURRENT);
|
|
||||||
putsTelemetryValue(MENU_DEBUG_COL_OFS, 2*FH, getCurrent(), UNIT_MILLIAMPS, 0);
|
|
||||||
uint32_t current_scale = 488 + g_eeGeneral.currentCalib;
|
|
||||||
putsTelemetryValue(20*FW+2, 2*FH, Current_max*10*current_scale/8192, UNIT_RAW, 0);
|
|
||||||
lcd_putsLeft(3*FH, STR_CPU_MAH);
|
|
||||||
putsTelemetryValue(MENU_DEBUG_COL_OFS, 3*FH, g_eeGeneral.mAhUsed + Current_used*current_scale/8192/36, UNIT_MAH, PREC1);
|
|
||||||
putsTime(17*FW, 3*FH, g_eeGeneral.globalTimer + sessionTimer, 0, 0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
lcd_putsLeft(4*FH, STR_CPU_TEMP);
|
lcd_puts(3*FW, 7*FH, STR_MENUTORESET);
|
||||||
putsTelemetryValue(MENU_DEBUG_COL_OFS, 4*FH, getTemperature(), UNIT_DEGREES, 0);
|
|
||||||
putsTelemetryValue(20*FW+2, 4*FH, maxTemperature+g_eeGeneral.temperatureCalib, UNIT_DEGREES, 0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(PCBSKY9X)
|
|
||||||
lcd_puts( 0*FW, 5*FH, STR_FREESTACKMINB);
|
|
||||||
lcd_outdezAtt(14*FW, 5*FH, stack_free(), UNSIGN) ;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
lcd_puts( 3*FW, 7*FH, STR_MENUTORESET);
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user