1
0
mirror of https://github.com/bdring/Grbl_Esp32.git synced 2025-09-03 11:22:38 +02:00

Merge pull request #149 from luc-github/Devt

Bug fix for SD card > 4GB and rewrite of probe process V3
This commit is contained in:
bdring
2019-05-17 13:14:20 -05:00
committed by GitHub
4 changed files with 9 additions and 9 deletions

Binary file not shown.

View File

@@ -47,16 +47,16 @@ void ESPResponseStream::println(const char *data){
} }
//helper to format size to readable string //helper to format size to readable string
String ESPResponseStream::formatBytes (uint32_t bytes) String ESPResponseStream::formatBytes (uint64_t bytes)
{ {
if (bytes < 1024) { if (bytes < 1024) {
return String (bytes) + " B"; return String ((uint16_t)bytes) + " B";
} else if (bytes < (1024 * 1024) ) { } else if (bytes < (1024 * 1024) ) {
return String (bytes / 1024.0) + " KB"; return String ((float)(bytes / 1024.0),2) + " KB";
} else if (bytes < (1024 * 1024 * 1024) ) { } else if (bytes < (1024 * 1024 * 1024) ) {
return String (bytes / 1024.0 / 1024.0) + " MB"; return String ((float)(bytes / 1024.0 / 1024.0),2) + " MB";
} else { } else {
return String (bytes / 1024.0 / 1024.0 / 1024.0) + " GB"; return String ((float)(bytes / 1024.0 / 1024.0 / 1024.0),2) + " GB";
} }
} }

View File

@@ -31,7 +31,7 @@ class ESPResponseStream{
void print(const char *data); void print(const char *data);
void println(const char *data); void println(const char *data);
void flush(); void flush();
static String formatBytes (uint32_t bytes); static String formatBytes (uint64_t bytes);
uint8_t client() {return _client;} uint8_t client() {return _client;}
#if defined (ENABLE_HTTP) && defined(ENABLE_WIFI) #if defined (ENABLE_HTTP) && defined(ENABLE_WIFI)
ESPResponseStream(WebServer * webserver); ESPResponseStream(WebServer * webserver);

View File

@@ -1228,8 +1228,8 @@ void Web_Server::handle_direct_SDFileList()
_upload_status = UPLOAD_STATUS_NONE; _upload_status = UPLOAD_STATUS_NONE;
} }
bool list_files = true; bool list_files = true;
uint32_t totalspace = 0; uint64_t totalspace = 0;
uint32_t usedspace = 0; uint64_t usedspace = 0;
if (get_sd_state(true) != SDCARD_IDLE) { if (get_sd_state(true) != SDCARD_IDLE) {
_webserver->sendHeader("Cache-Control","no-cache"); _webserver->sendHeader("Cache-Control","no-cache");
_webserver->send(200, "application/json", "{\"status\":\"No SD Card\"}"); _webserver->send(200, "application/json", "{\"status\":\"No SD Card\"}");