diff --git a/index.h b/index.h index 19a001d..9c252d2 100644 --- a/index.h +++ b/index.h @@ -396,6 +396,14 @@ const char index_html[] PROGMEM = R"rawliteral( return; } + // 파일명 기준으로 내림차순 정렬 (최신 파일이 위로) + files.sort((a, b) => { + // canlog_XXXXX.bin에서 숫자 부분 추출 + const numA = parseInt(a.name.match(/\d+/)?.[0] || '0'); + const numB = parseInt(b.name.match(/\d+/)?.[0] || '0'); + return numB - numA; // 내림차순 + }); + fileList.innerHTML = ''; files.forEach(file => { const fileItem = document.createElement('div'); @@ -410,7 +418,7 @@ const char index_html[] PROGMEM = R"rawliteral( fileList.appendChild(fileItem); }); - console.log(`파일 목록 업데이트: ${files.length}개`); + console.log(`파일 목록 업데이트: ${files.length}개 (최신순)`); } function formatBytes(bytes) {