Merge pull request #90 from PavelSindler/sd_card_menu

Improved SD card menu
This commit is contained in:
XPila 2017-11-22 02:45:11 +01:00 committed by GitHub
commit 551db1ce6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1210,19 +1210,12 @@ static void lcd_implementation_drawmenu_sdfile_selected(uint8_t row, const char*
lcd.setCursor(0, row); lcd.setCursor(0, row);
lcd.print('>'); lcd.print('>');
if (longFilename[0] != '\0')
{
filename = longFilename;
//longFilename[LCD_WIDTH-1] = '\0';
}
int i = 1; int i = 1;
int j = 0; int j = 0;
int inter = 0;
char* longFilenameTMP = longFilename; char* longFilenameTMP = longFilename;
while( ((c = *longFilenameTMP) != '\0') && (inter == 0) ) while((c = *longFilenameTMP) != '\0')
{ {
lcd.setCursor(i, row); lcd.setCursor(i, row);
@ -1232,20 +1225,22 @@ static void lcd_implementation_drawmenu_sdfile_selected(uint8_t row, const char*
if(i==LCD_WIDTH){ if(i==LCD_WIDTH){
i=1; i=1;
j++; j++;
longFilenameTMP = longFilename; longFilenameTMP = longFilename + j;
longFilenameTMP = longFilenameTMP+j;
n = LCD_WIDTH - 1; n = LCD_WIDTH - 1;
for(int g = 0; ((g<300)&&(inter == 0)) ;g++){ for(int g = 0; g<300 ;g++){
if(LCD_CLICKED || ( enc_dif != encoderDiff )){ if(LCD_CLICKED || ( enc_dif != encoderDiff )){
longFilenameTMP = longFilename;
// inter = 1; *(longFilenameTMP + LCD_WIDTH - 2) = '\0';
i = 1;
j = 0;
break;
}else{ }else{
delay(1); if (j == 1) delay(3); //wait around 1.2 s to start scrolling text
delay(1); //then scroll with redrawing every 300 ms
} }
} }
} }
} }
if(c!='\0'){ if(c!='\0'){
lcd.setCursor(i, row); lcd.setCursor(i, row);