I promised :)
This commit is contained in:
@@ -620,12 +620,12 @@ void menuGeneralSdManagerInfo(uint8_t event)
|
|||||||
|
|
||||||
inline bool isFilenameGreater(bool isfile, const char * fn, const char * line)
|
inline bool isFilenameGreater(bool isfile, const char * fn, const char * line)
|
||||||
{
|
{
|
||||||
return (isfile && !line[SD_SCREEN_FILE_LENGTH+1]) || (isfile==(bool)line[SD_SCREEN_FILE_LENGTH+1] && strcmp(fn, line) > 0);
|
return (isfile && !line[SD_SCREEN_FILE_LENGTH+1]) || (isfile==(bool)line[SD_SCREEN_FILE_LENGTH+1] && strcasecmp(fn, line) > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool isFilenameLower(bool isfile, const char * fn, const char * line)
|
inline bool isFilenameLower(bool isfile, const char * fn, const char * line)
|
||||||
{
|
{
|
||||||
return (!isfile && line[SD_SCREEN_FILE_LENGTH+1]) || (isfile==(bool)line[SD_SCREEN_FILE_LENGTH+1] && strcmp(fn, line) < 0);
|
return (!isfile && line[SD_SCREEN_FILE_LENGTH+1]) || (isfile==(bool)line[SD_SCREEN_FILE_LENGTH+1] && strcasecmp(fn, line) < 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onSdManagerMenu(const char *result)
|
void onSdManagerMenu(const char *result)
|
||||||
@@ -713,7 +713,7 @@ void menuGeneralSdManager(uint8_t event)
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (m_posVert > 0) {
|
if (m_posVert > 0) {
|
||||||
uint8_t index = m_posVert-1-s_pgOfs;
|
vertpos_t index = m_posVert-1-s_pgOfs;
|
||||||
if (!reusableBuffer.sdmanager.lines[index][SD_SCREEN_FILE_LENGTH+1]) {
|
if (!reusableBuffer.sdmanager.lines[index][SD_SCREEN_FILE_LENGTH+1]) {
|
||||||
f_chdir(reusableBuffer.sdmanager.lines[index]);
|
f_chdir(reusableBuffer.sdmanager.lines[index]);
|
||||||
s_pgOfs = 0;
|
s_pgOfs = 0;
|
||||||
@@ -741,7 +741,7 @@ void menuGeneralSdManager(uint8_t event)
|
|||||||
/* TODO if (!strcmp(ext, MODELS_EXT)) {
|
/* TODO if (!strcmp(ext, MODELS_EXT)) {
|
||||||
s_menu[s_menu_count++] = STR_LOAD_FILE;
|
s_menu[s_menu_count++] = STR_LOAD_FILE;
|
||||||
}
|
}
|
||||||
else */ if (!strcmp(ext, SOUNDS_EXT)) {
|
else */ if (!strcasecmp(ext, SOUNDS_EXT)) {
|
||||||
MENU_ADD_ITEM(STR_PLAY_FILE);
|
MENU_ADD_ITEM(STR_PLAY_FILE);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -845,6 +845,24 @@ void menuGeneralSdManager(uint8_t event)
|
|||||||
if (!reusableBuffer.sdmanager.lines[i][SD_SCREEN_FILE_LENGTH+1]) { lcd_putcAtt(lcdLastPos, y, ']', attr); }
|
if (!reusableBuffer.sdmanager.lines[i][SD_SCREEN_FILE_LENGTH+1]) { lcd_putcAtt(lcdLastPos, y, ']', attr); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(PCBTARANIS)
|
||||||
|
static vertpos_t sdBitmapIdx = 0xFFFF;
|
||||||
|
static uint8_t sdBitmap[MODEL_BITMAP_SIZE];
|
||||||
|
vertpos_t index = m_posVert-1-s_pgOfs;
|
||||||
|
if (m_posVert > 0) {
|
||||||
|
char * ext = reusableBuffer.sdmanager.lines[index];
|
||||||
|
ext += strlen(ext) - 4;
|
||||||
|
if (!strcasecmp(ext, BITMAPS_EXT)) {
|
||||||
|
if (sdBitmapIdx != m_posVert) {
|
||||||
|
sdBitmapIdx = m_posVert;
|
||||||
|
if (bmpLoad(sdBitmap, reusableBuffer.sdmanager.lines[index], MODEL_BITMAP_WIDTH, MODEL_BITMAP_HEIGHT))
|
||||||
|
memcpy(sdBitmap, logo_taranis, MODEL_BITMAP_SIZE);
|
||||||
|
}
|
||||||
|
lcd_bmp(22*FW+2, 2*FH+FH/2, sdBitmap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -203,19 +203,19 @@ bool listSdFiles(const char *path, const char *extension, const uint8_t maxlen,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint8_t len = strlen(fn);
|
uint8_t len = strlen(fn);
|
||||||
if (len < 5 || len > maxlen+4 || strcmp(fn+len-4, extension) || (fno.fattrib & AM_DIR)) continue;
|
if (len < 5 || len > maxlen+4 || strcasecmp(fn+len-4, extension) || (fno.fattrib & AM_DIR)) continue;
|
||||||
|
|
||||||
s_menu_count++;
|
s_menu_count++;
|
||||||
fn[len-4] = '\0';
|
fn[len-4] = '\0';
|
||||||
|
|
||||||
if (s_menu_offset == 0) {
|
if (s_menu_offset == 0) {
|
||||||
if (selection && strncmp(fn, selection, maxlen) < 0) {
|
if (selection && strncasecmp(fn, selection, maxlen) < 0) {
|
||||||
s_last_menu_offset++;
|
s_last_menu_offset++;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (uint8_t i=0; i<MENU_MAX_LINES; i++) {
|
for (uint8_t i=0; i<MENU_MAX_LINES; i++) {
|
||||||
char *line = reusableBuffer.modelsel.menu_bss[i];
|
char *line = reusableBuffer.modelsel.menu_bss[i];
|
||||||
if (line[0] == '\0' || strcmp(fn, line) < 0) {
|
if (line[0] == '\0' || strcasecmp(fn, line) < 0) {
|
||||||
if (i < MENU_MAX_LINES-1) memmove(reusableBuffer.modelsel.menu_bss[i+1], line, sizeof(reusableBuffer.modelsel.menu_bss[i]) * (MENU_MAX_LINES-1-i));
|
if (i < MENU_MAX_LINES-1) memmove(reusableBuffer.modelsel.menu_bss[i+1], line, sizeof(reusableBuffer.modelsel.menu_bss[i]) * (MENU_MAX_LINES-1-i));
|
||||||
memset(line, 0, MENU_LINE_LENGTH);
|
memset(line, 0, MENU_LINE_LENGTH);
|
||||||
strcpy(line, fn);
|
strcpy(line, fn);
|
||||||
@@ -229,7 +229,7 @@ bool listSdFiles(const char *path, const char *extension, const uint8_t maxlen,
|
|||||||
else if (s_last_menu_offset == 0xffff) {
|
else if (s_last_menu_offset == 0xffff) {
|
||||||
for (int i=MENU_MAX_LINES-1; i>=0; i--) {
|
for (int i=MENU_MAX_LINES-1; i>=0; i--) {
|
||||||
char *line = reusableBuffer.modelsel.menu_bss[i];
|
char *line = reusableBuffer.modelsel.menu_bss[i];
|
||||||
if (line[0] == '\0' || strcmp(fn, line) > 0) {
|
if (line[0] == '\0' || strcasecmp(fn, line) > 0) {
|
||||||
if (i > 0) memmove(reusableBuffer.modelsel.menu_bss[0], reusableBuffer.modelsel.menu_bss[1], sizeof(reusableBuffer.modelsel.menu_bss[i]) * i);
|
if (i > 0) memmove(reusableBuffer.modelsel.menu_bss[0], reusableBuffer.modelsel.menu_bss[1], sizeof(reusableBuffer.modelsel.menu_bss[i]) * i);
|
||||||
memset(line, 0, MENU_LINE_LENGTH);
|
memset(line, 0, MENU_LINE_LENGTH);
|
||||||
strcpy(line, fn);
|
strcpy(line, fn);
|
||||||
@@ -240,13 +240,13 @@ bool listSdFiles(const char *path, const char *extension, const uint8_t maxlen,
|
|||||||
s_menu[i] = reusableBuffer.modelsel.menu_bss[i];
|
s_menu[i] = reusableBuffer.modelsel.menu_bss[i];
|
||||||
}
|
}
|
||||||
else if (s_menu_offset > s_last_menu_offset) {
|
else if (s_menu_offset > s_last_menu_offset) {
|
||||||
if (strcmp(fn, reusableBuffer.modelsel.menu_bss[MENU_MAX_LINES-2]) > 0 && strcmp(fn, reusableBuffer.modelsel.menu_bss[MENU_MAX_LINES-1]) < 0) {
|
if (strcasecmp(fn, reusableBuffer.modelsel.menu_bss[MENU_MAX_LINES-2]) > 0 && strcasecmp(fn, reusableBuffer.modelsel.menu_bss[MENU_MAX_LINES-1]) < 0) {
|
||||||
memset(reusableBuffer.modelsel.menu_bss[MENU_MAX_LINES-1], 0, MENU_LINE_LENGTH);
|
memset(reusableBuffer.modelsel.menu_bss[MENU_MAX_LINES-1], 0, MENU_LINE_LENGTH);
|
||||||
strcpy(reusableBuffer.modelsel.menu_bss[MENU_MAX_LINES-1], fn);
|
strcpy(reusableBuffer.modelsel.menu_bss[MENU_MAX_LINES-1], fn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (strcmp(fn, reusableBuffer.modelsel.menu_bss[1]) < 0 && strcmp(fn, reusableBuffer.modelsel.menu_bss[0]) > 0) {
|
if (strcasecmp(fn, reusableBuffer.modelsel.menu_bss[1]) < 0 && strcasecmp(fn, reusableBuffer.modelsel.menu_bss[0]) > 0) {
|
||||||
memset(reusableBuffer.modelsel.menu_bss[0], 0, MENU_LINE_LENGTH);
|
memset(reusableBuffer.modelsel.menu_bss[0], 0, MENU_LINE_LENGTH);
|
||||||
strcpy(reusableBuffer.modelsel.menu_bss[0], fn);
|
strcpy(reusableBuffer.modelsel.menu_bss[0], fn);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,48 +37,48 @@
|
|||||||
#ifndef board_gruvin9x_h
|
#ifndef board_gruvin9x_h
|
||||||
#define board_gruvin9x_h
|
#define board_gruvin9x_h
|
||||||
|
|
||||||
#define GPIO_BUTTON_MENU pinl
|
#define GPIO_BUTTON_MENU pinl
|
||||||
#define GPIO_BUTTON_EXIT pinl
|
#define GPIO_BUTTON_EXIT pinl
|
||||||
#define GPIO_BUTTON_RIGHT pinl
|
#define GPIO_BUTTON_RIGHT pinl
|
||||||
#define GPIO_BUTTON_LEFT pinl
|
#define GPIO_BUTTON_LEFT pinl
|
||||||
#define GPIO_BUTTON_UP pinl
|
#define GPIO_BUTTON_UP pinl
|
||||||
#define GPIO_BUTTON_DOWN pinl
|
#define GPIO_BUTTON_DOWN pinl
|
||||||
#define PIN_BUTTON_MENU (1<<INP_L_KEY_MEN)
|
#define PIN_BUTTON_MENU (1<<INP_L_KEY_MEN)
|
||||||
#define PIN_BUTTON_EXIT (1<<INP_L_KEY_EXT)
|
#define PIN_BUTTON_EXIT (1<<INP_L_KEY_EXT)
|
||||||
#define PIN_BUTTON_UP (1<<INP_L_KEY_UP)
|
#define PIN_BUTTON_UP (1<<INP_L_KEY_UP)
|
||||||
#define PIN_BUTTON_DOWN (1<<INP_L_KEY_DWN)
|
#define PIN_BUTTON_DOWN (1<<INP_L_KEY_DWN)
|
||||||
#define PIN_BUTTON_RIGHT (1<<INP_L_KEY_RGT)
|
#define PIN_BUTTON_RIGHT (1<<INP_L_KEY_RGT)
|
||||||
#define PIN_BUTTON_LEFT (1<<INP_L_KEY_LFT)
|
#define PIN_BUTTON_LEFT (1<<INP_L_KEY_LFT)
|
||||||
|
|
||||||
#define GPIO_TRIM_LH_L pinj
|
#define GPIO_TRIM_LH_L pinj
|
||||||
#define GPIO_TRIM_LV_DN pinj
|
#define GPIO_TRIM_LV_DN pinj
|
||||||
#define GPIO_TRIM_RV_UP pinj
|
#define GPIO_TRIM_RV_UP pinj
|
||||||
#define GPIO_TRIM_RH_L pinj
|
#define GPIO_TRIM_RH_L pinj
|
||||||
#define GPIO_TRIM_LH_R pinj
|
#define GPIO_TRIM_LH_R pinj
|
||||||
#define GPIO_TRIM_LV_UP pinj
|
#define GPIO_TRIM_LV_UP pinj
|
||||||
#define GPIO_TRIM_RV_DN pinj
|
#define GPIO_TRIM_RV_DN pinj
|
||||||
#define GPIO_TRIM_RH_R pinj
|
#define GPIO_TRIM_RH_R pinj
|
||||||
#define PIN_TRIM_LH_L (1<<INP_J_TRM_LH_DWN)
|
#define PIN_TRIM_LH_L (1<<INP_J_TRM_LH_DWN)
|
||||||
#define PIN_TRIM_LV_DN (1<<INP_J_TRM_LV_DWN)
|
#define PIN_TRIM_LV_DN (1<<INP_J_TRM_LV_DWN)
|
||||||
#define PIN_TRIM_RV_UP (1<<INP_J_TRM_RV_UP)
|
#define PIN_TRIM_RV_UP (1<<INP_J_TRM_RV_UP)
|
||||||
#define PIN_TRIM_RH_L (1<<INP_J_TRM_RH_DWN)
|
#define PIN_TRIM_RH_L (1<<INP_J_TRM_RH_DWN)
|
||||||
#define PIN_TRIM_LH_R (1<<INP_J_TRM_LH_UP)
|
#define PIN_TRIM_LH_R (1<<INP_J_TRM_LH_UP)
|
||||||
#define PIN_TRIM_LV_UP (1<<INP_J_TRM_LV_UP)
|
#define PIN_TRIM_LV_UP (1<<INP_J_TRM_LV_UP)
|
||||||
#define PIN_TRIM_RV_DN (1<<INP_J_TRM_RV_DWN)
|
#define PIN_TRIM_RV_DN (1<<INP_J_TRM_RV_DWN)
|
||||||
#define PIN_TRIM_RH_R (1<<INP_J_TRM_RH_UP)
|
#define PIN_TRIM_RH_R (1<<INP_J_TRM_RH_UP)
|
||||||
|
|
||||||
#define TIMER_16KHZ_VECT TIMER2_OVF_vect
|
#define TIMER_16KHZ_VECT TIMER2_OVF_vect
|
||||||
#define COUNTER_16KHZ TCNT2
|
#define COUNTER_16KHZ TCNT2
|
||||||
#define TIMER_10MS_VECT TIMER2_COMPA_vect
|
#define TIMER_10MS_VECT TIMER2_COMPA_vect
|
||||||
#define TIMER_10MS_COMPVAL OCR2A
|
#define TIMER_10MS_COMPVAL OCR2A
|
||||||
#define PAUSE_10MS_INTERRUPT() TIMSK2 &= ~(1<<OCIE2A)
|
#define PAUSE_10MS_INTERRUPT() TIMSK2 &= ~(1<<OCIE2A)
|
||||||
#define RESUME_10MS_INTERRUPT() TIMSK2 |= (1<<OCIE2A)
|
#define RESUME_10MS_INTERRUPT() TIMSK2 |= (1<<OCIE2A)
|
||||||
#define PAUSE_PPMIN_INTERRUPT() TIMSK3 &= ~(1<<ICIE3)
|
#define PAUSE_PPMIN_INTERRUPT() TIMSK3 &= ~(1<<ICIE3)
|
||||||
#define RESUME_PPMIN_INTERRUPT() TIMSK3 |= (1<<ICIE3)
|
#define RESUME_PPMIN_INTERRUPT() TIMSK3 |= (1<<ICIE3)
|
||||||
|
|
||||||
#define SLAVE_MODE() (PING & (1<<INP_G_RF_POW))
|
#define SLAVE_MODE() (PING & (1<<INP_G_RF_POW))
|
||||||
#define JACK_PPM_OUT() PORTG |= (1<<OUT_G_SIM_CTL)
|
#define JACK_PPM_OUT() PORTG |= (1<<OUT_G_SIM_CTL)
|
||||||
#define JACK_PPM_IN() PORTG &= ~(1<<OUT_G_SIM_CTL)
|
#define JACK_PPM_IN() PORTG &= ~(1<<OUT_G_SIM_CTL)
|
||||||
|
|
||||||
// SD driver
|
// SD driver
|
||||||
#if !defined(SIMU)
|
#if !defined(SIMU)
|
||||||
@@ -86,17 +86,17 @@ bool sdMounted();
|
|||||||
void sdMountPoll();
|
void sdMountPoll();
|
||||||
void sdPoll10ms();
|
void sdPoll10ms();
|
||||||
|
|
||||||
#define SD_IS_HC() (0)
|
#define SD_IS_HC() (0)
|
||||||
#define SD_GET_BLOCKNR() (0)
|
#define SD_GET_BLOCKNR() (0)
|
||||||
#define SD_GET_SIZE_MB() (0)
|
#define SD_GET_SIZE_MB() (0)
|
||||||
#define SD_GET_SPEED() (0)
|
#define SD_GET_SPEED() (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SPEAKER_ON TCCR0A |= (1 << COM0A0)
|
#define SPEAKER_ON TCCR0A |= (1 << COM0A0)
|
||||||
#define SPEAKER_OFF TCCR0A &= ~(1 << COM0A0)
|
#define SPEAKER_OFF TCCR0A &= ~(1 << COM0A0)
|
||||||
#define __BACKLIGHT_ON PORTC |= (1 << OUT_C_LIGHT)
|
#define __BACKLIGHT_ON PORTC |= (1 << OUT_C_LIGHT)
|
||||||
#define __BACKLIGHT_OFF PORTC &= ~(1 << OUT_C_LIGHT)
|
#define __BACKLIGHT_OFF PORTC &= ~(1 << OUT_C_LIGHT)
|
||||||
#define IS_BACKLIGHT_ON() (PORTC & (1<<OUT_C_LIGHT))
|
#define IS_BACKLIGHT_ON() (PORTC & (1<<OUT_C_LIGHT))
|
||||||
|
|
||||||
|
|
||||||
# define INP_L_SPARE6 7
|
# define INP_L_SPARE6 7
|
||||||
|
|||||||
Reference in New Issue
Block a user