Merge with latest 2.3

This commit is contained in:
Bertrand Songis
2020-05-30 11:57:03 +02:00
240 changed files with 16050 additions and 14404 deletions
+7 -7
View File
@@ -357,7 +357,7 @@ bool sdListFiles(const char * path, const char * extension, const uint8_t maxlen
constexpr uint32_t TEXT_FILE_MAXSIZE = 2048;
void sdReadTextFile(const char * filename, char lines[NUM_BODY_LINES][LCD_COLS + 1], int & lines_count)
void sdReadTextFile(const char * filename, char lines[TEXT_VIEWER_LINES][LCD_COLS + 1], int & lines_count)
{
FIL file;
int result;
@@ -368,17 +368,17 @@ void sdReadTextFile(const char * filename, char lines[NUM_BODY_LINES][LCD_COLS +
char escape_chars[4] = {0};
int current_line = 0;
memclear(lines, NUM_BODY_LINES * (LCD_COLS + 1));
memclear(lines, TEXT_VIEWER_LINES * (LCD_COLS + 1));
result = f_open(&file, filename, FA_OPEN_EXISTING | FA_READ);
if (result == FR_OK) {
for (uint32_t i = 0; i < TEXT_FILE_MAXSIZE && f_read(&file, &c, 1, &sz) == FR_OK && sz == 1 && (lines_count == 0 || current_line - menuVerticalOffset < int(NUM_BODY_LINES)); i++) {
for (uint32_t i = 0; i < TEXT_FILE_MAXSIZE && f_read(&file, &c, 1, &sz) == FR_OK && sz == 1 && (lines_count == 0 || current_line - menuVerticalOffset < int(TEXT_VIEWER_LINES)); i++) {
if (c == '\n') {
++current_line;
line_length = 0;
escape = 0;
}
else if (c != '\r' && current_line >= menuVerticalOffset && current_line - menuVerticalOffset < int(NUM_BODY_LINES) && line_length < LCD_COLS) {
else if (c != '\r' && current_line >= menuVerticalOffset && current_line - menuVerticalOffset < int(TEXT_VIEWER_LINES) && line_length < LCD_COLS) {
if (c == '\\' && escape == 0) {
escape = 1;
continue;
@@ -386,15 +386,15 @@ void sdReadTextFile(const char * filename, char lines[NUM_BODY_LINES][LCD_COLS +
else if (c != '\\' && escape > 0 && escape < sizeof(escape_chars)) {
escape_chars[escape - 1] = c;
if (escape == 2 && !strncmp(escape_chars, "up", 2)) {
c = '\300';
c = CHAR_UP;
}
else if (escape == 2 && !strncmp(escape_chars, "dn", 2)) {
c = '\301';
c = CHAR_DOWN;
}
else if (escape == 3) {
int val = atoi(escape_chars);
if (val >= 200 && val < 225) {
c = '\200' + val-200;
c = '\200' + val - 200;
}
}
else {