Просмотр исходного кода

Revert "Merge pull request #1205 from Slider0007/Add-sdcard-info"

This reverts commit 437e8e4d25185bae43ca70def24359fa1c1b2968, reversing
changes made to 0a2b6b71cab68414eec8b3c8f8626e1db5c27f5e.
jomjol 3 лет назад
Родитель
Сommit
98d35e0412

+ 1 - 1
code/components/jomjol_helper/CMakeLists.txt

@@ -2,6 +2,6 @@ FILE(GLOB_RECURSE app_sources ${CMAKE_CURRENT_SOURCE_DIR}/*.*)
 
 idf_component_register(SRCS ${app_sources}
                     INCLUDE_DIRS "."
-                    REQUIRES tflite-lib jomjol_logfile fatfs sdmmc)
+                    REQUIRES tflite-lib jomjol_logfile)
 
 

+ 2 - 211
code/components/jomjol_helper/Helper.cpp

@@ -20,8 +20,7 @@ extern "C" {
 
 
 #include "ClassLogFile.h"
-
-#include "esp_vfs_fat.h"
+//#include "ClassLogFile.h"
 
 static const char* TAG = "helper";
 
@@ -30,9 +29,6 @@ static const char* TAG = "helper";
 
 using namespace std;
 
-sdmmc_cid_t SDCardCid;
-sdmmc_csd_t SDCardCsd;
-
 /////////////////////////////////////////////////////////////////////////////////////////////
 string getESPHeapInfo(){
 	string espInfoResultStr = "";
@@ -79,78 +75,8 @@ size_t getInternalESPHeapSize() {
 	return aFreeInternalHeapSize;
 }
 
-string getSDCardPartitionSize(){
-	FATFS *fs;
-    uint32_t fre_clust, tot_sect;
-
-    /* Get volume information and free clusters of drive 0 */
-    f_getfree("0:", (DWORD *)&fre_clust, &fs);
-    tot_sect = ((fs->n_fatent - 2) * fs->csize) /1024 /(1024/SDCardCsd.sector_size);	//corrected by SD Card sector size (usually 512 bytes) and convert to MB
-
-    printf("%d MB total drive space (Sector size [bytes]: %d)\n", (int)tot_sect, (int)fs->csize*512);
-
-	return std::to_string(tot_sect);
-}
-
-string getSDCardFreePartitionSpace(){
-	FATFS *fs;
-    uint32_t fre_clust, fre_sect;
-  
-    /* Get volume information and free clusters of drive 0 */
-    f_getfree("0:", (DWORD *)&fre_clust, &fs);
-    fre_sect = (fre_clust * fs->csize) / 1024 /(1024/SDCardCsd.sector_size);	//corrected by SD Card sector size (usually 512 bytes) and convert to MB
-
-    printf("%d MB free drive space (Sector size [bytes]: %d)\n", (int)fre_sect, (int)fs->ssize);
-
-	return std::to_string(fre_sect);
-}
-
-string getSDCardPartitionAllocationSize(){
-	FATFS *fs;
-    uint32_t fre_clust, allocation_size;
-  
-    /* Get volume information and free clusters of drive 0 */
-    f_getfree("0:", (DWORD *)&fre_clust, &fs);
-    allocation_size = fs->ssize;
-
-    printf("SD Card Partition Allocation Size (bytes): %d)\n", allocation_size);
-
-	return std::to_string(allocation_size);
-}
-
 
-void SaveSDCardInfo(sdmmc_card_t* card) {
-	SDCardCid = card->cid;
-    SDCardCsd = card->csd;
-}
-
-string getSDCardManufacturer(){
-	string SDCardManufacturer = SDCardParseManufacturerIDs(SDCardCid.mfg_id);
-	printf("SD Card Manufactuer: %s\n", SDCardManufacturer.c_str());
-	
-	return (SDCardManufacturer + " (ID: " + std::to_string(SDCardCid.mfg_id) + ")");
-}
 
-string getSDCardName(){
-	char *SDCardName = SDCardCid.name;
-	printf("SD Card Name: %s\n", SDCardName); 
-
-	return std::string(SDCardName);
-}
-
-string getSDCardCapacity(){
-	int SDCardCapacity = SDCardCsd.capacity / (1024/SDCardCsd.sector_size) / 1024;  // total sectors * sector size  --> Byte to MB (1024*1024)
-	printf("SD Card Capacity: %s\n", std::to_string(SDCardCapacity).c_str()); 
-
-	return std::to_string(SDCardCapacity);
-}
-
-string getSDCardSectorSize(){
-	int SDCardSectorSize = SDCardCsd.sector_size;
-	printf("SD Card Sector Size: %s\n", std::to_string(SDCardSectorSize).c_str()); 
-
-	return std::to_string(SDCardSectorSize);
-}
 
 ///////////////////////////////////////////////////////////////////////////////////////////////
 
@@ -536,6 +462,7 @@ int removeFolder(const char* folderPath, const char* logTag) {
 }
 
 
+
 std::vector<string> HelperZerlegeZeile(std::string input, std::string _delimiter = "")
 {
 	std::vector<string> Output;
@@ -560,139 +487,3 @@ std::vector<string> HelperZerlegeZeile(std::string input, std::string _delimiter
 	return Output;
 }
 
-
-/* Source: https://git.kernel.org/pub/scm/utils/mmc/mmc-utils.git/tree/lsmmc.c */
-/* SD Card Manufacturer Database */
-struct SDCard_Manufacturer_database {
-	string type;
-	int id;
-	string manufacturer;
-};
-
-/* Source: https://git.kernel.org/pub/scm/utils/mmc/mmc-utils.git/tree/lsmmc.c */
-/* SD Card Manufacturer Database */
-struct SDCard_Manufacturer_database database[] = {
-	{
-		.type = "sd",
-		.id = 0x01,
-		.manufacturer = "Panasonic",
-	},
-	{
-		.type = "sd",
-		.id = 0x02,
-		.manufacturer = "Toshiba/Kingston/Viking",
-	},
-	{
-		.type = "sd",
-		.id = 0x03,
-		.manufacturer = "SanDisk",
-	},
-	{
-		.type = "sd",
-		.id = 0x08,
-		.manufacturer = "Silicon Power",
-	},
-	{
-		.type = "sd",
-		.id = 0x18,
-		.manufacturer = "Infineon",
-	},
-	{
-		.type = "sd",
-		.id = 0x1b,
-		.manufacturer = "Transcend/Samsung",
-	},
-	{
-		.type = "sd",
-		.id = 0x1c,
-		.manufacturer = "Transcend",
-	},
-	{
-		.type = "sd",
-		.id = 0x1d,
-		.manufacturer = "Corsair/AData",
-	},
-	{
-		.type = "sd",
-		.id = 0x1e,
-		.manufacturer = "Transcend",
-	},
-	{
-		.type = "sd",
-		.id = 0x1f,
-		.manufacturer = "Kingston",
-	},
-	{
-		.type = "sd",
-		.id = 0x27,
-		.manufacturer = "Delkin/Phison",
-	},
-	{
-		.type = "sd",
-		.id = 0x28,
-		.manufacturer = "Lexar",
-	},
-	{
-		.type = "sd",
-		.id = 0x30,
-		.manufacturer = "SanDisk",
-	},
-	{
-		.type = "sd",
-		.id = 0x31,
-		.manufacturer = "Silicon Power",
-	},
-	{
-		.type = "sd",
-		.id = 0x33,
-		.manufacturer = "STMicroelectronics",
-	},
-	{
-		.type = "sd",
-		.id = 0x41,
-		.manufacturer = "Kingston",
-	},
-	{
-		.type = "sd",
-		.id = 0x6f,
-		.manufacturer = "STMicroelectronics",
-	},
-	{
-		.type = "sd",
-		.id = 0x74,
-		.manufacturer = "Transcend",
-	},
-	{
-		.type = "sd",
-		.id = 0x76,
-		.manufacturer = "Patriot",
-	},
-	{
-		.type = "sd",
-		.id = 0x82,
-		.manufacturer = "Gobe/Sony",
-	},
-	{
-		.type = "sd",
-		.id = 0x89,
-		.manufacturer = "Unknown",
-	}
-};
-
-/* Parse SD Card Manufacturer Database */
-string SDCardParseManufacturerIDs(int id) 
-{
-	unsigned int id_cnt = sizeof(database) / sizeof(struct SDCard_Manufacturer_database);
-	string ret_val = "";
-
-	for (int i = 0; i < id_cnt; i++) {
-		if (database[i].id == id) {
-			return database[i].manufacturer;
-		}
-		else {
-			ret_val = "ID unknown (not in DB)";
-		}
-	}
-	return ret_val;
-}
-

+ 1 - 11
code/components/jomjol_helper/Helper.h

@@ -2,7 +2,7 @@
 #include <string>
 #include <fstream>
 #include <vector>
-#include "sdmmc_cmd.h"
+
 
 using namespace std;
 
@@ -47,13 +47,3 @@ size_t getESPHeapSize();
 string getESPHeapInfo();
 
 /////////////////////////////
-string getSDCardPartitionSize();
-string getSDCardFreePartitionSpace();
-string getSDCardPartitionAllocationSize();
-
-void SaveSDCardInfo(sdmmc_card_t* card);
-string SDCardParseManufacturerIDs(int);
-string getSDCardManufacturer();
-string getSDCardName();
-string getSDCardCapacity();
-string getSDCardSectorSize();

+ 0 - 1
code/main/main.cpp

@@ -112,7 +112,6 @@ bool Init_NVS_SDCard()
         return false;
     }
     sdmmc_card_print_info(stdout, card);
-    SaveSDCardInfo(card);
 
     return true;
 }

+ 0 - 67
code/main/server_main.cpp

@@ -17,8 +17,6 @@
 #include "esp_log.h"
 
 
-#include "helper.h"
-
 //#define DEBUG_DETAIL_ON      
 
 
@@ -138,71 +136,6 @@ esp_err_t info_get_handler(httpd_req_t *req)
         return ESP_OK;        
     }
 
-    if (_task.compare("SDCardPartitionSize") == 0)
-    {
-        std::string zw;
-        zw = getSDCardPartitionSize();
-        httpd_resp_sendstr_chunk(req, zw.c_str());
-        httpd_resp_sendstr_chunk(req, NULL);  
-        return ESP_OK;        
-    }
-
-    if (_task.compare("SDCardFreePartitionSpace") == 0)
-    {
-        std::string zw;
-        zw = getSDCardFreePartitionSpace();
-        httpd_resp_sendstr_chunk(req, zw.c_str());
-        httpd_resp_sendstr_chunk(req, NULL);  
-        return ESP_OK;        
-    }
-
-    if (_task.compare("SDCardPartitionAllocationSize") == 0)
-    {
-        std::string zw;
-        zw = getSDCardPartitionAllocationSize();
-        httpd_resp_sendstr_chunk(req, zw.c_str());
-        httpd_resp_sendstr_chunk(req, NULL);  
-        return ESP_OK;        
-    }
-
-    if (_task.compare("SDCardManufacturer") == 0)
-    {
-        std::string zw;
-        zw = getSDCardManufacturer(); 
-        httpd_resp_sendstr_chunk(req, zw.c_str());
-        httpd_resp_sendstr_chunk(req, NULL);  
-        return ESP_OK;        
-    }
-
-    if (_task.compare("SDCardName") == 0)
-    {
-        std::string zw;
-        zw = getSDCardName(); 
-        httpd_resp_sendstr_chunk(req, zw.c_str());
-        httpd_resp_sendstr_chunk(req, NULL);  
-        return ESP_OK;        
-    }
-
-    if (_task.compare("SDCardCapacity") == 0)
-    {
-        std::string zw;
-        zw = getSDCardCapacity();
-        httpd_resp_sendstr_chunk(req, zw.c_str());
-        httpd_resp_sendstr_chunk(req, NULL);  
-        return ESP_OK;        
-    }
-
-    if (_task.compare("SDCardSectorSize") == 0)
-    {
-        std::string zw;
-        zw = getSDCardSectorSize();
-        httpd_resp_sendstr_chunk(req, zw.c_str());
-        httpd_resp_sendstr_chunk(req, NULL);  
-        return ESP_OK;        
-    }
-
-
-
     return ESP_OK;
 }
 

+ 0 - 78
sd-card/html/info.html

@@ -77,84 +77,6 @@ div {
 	</tr>
 </table>
 
-
-<table style="font-family: arial">
-<h3>SD Card Info</h3>
-<table style="font-family: arial">
-	<tr>
-		<td>
-			SD Card Manufacturer:
-		</td>
-		<td>
-			<div id="SDCardManufacturer">
-				<object data="/version?type=SDCardManufacturer"></object>
-			</div>
-		</td>
-	</tr>
-	<tr>
-		<td>
-			SD Card Name:
-		</td>
-		<td>
-			<div id="SDCardName">
-				<object data="/version?type=SDCardName"></object>
-			</div>
-		</td>
-	</tr>
-	<tr>
-		<td>
-			SD Card Size [MB]:
-		</td>
-		<td>
-			<div id="SDCardCapacity">
-				<object data="/version?type=SDCardCapacity"></object>
-			</div>
-		</td>
-	</tr>
-	<tr>
-		<td>
-			SD Card Sector Size [byte]:
-		</td>
-		<td>
-			<div id="SDCardSectorSize">
-				<object data="/version?type=SDCardSectorSize"></object>
-			</div>
-		</td>
-	</tr>
-	<tr>
-		<td>
-			Partition Size [MB]:
-		</td>
-		<td>
-			<div id="SDPartitionSize">
-				<object data="/version?type=SDCardPartitionSize"></object>
-			</div>
-		</td>
-	</tr>
-	<tr>
-		<td>
-			Partition Free Space [MB]:
-		</td>	
-		<td>
-			<div id="SDFreePartitionSpace">
-				<object data="/version?type=SDCardFreePartitionSpace"></object>
-			</div>
-		</td>
-	</tr>
-	<tr>
-		<td>
-			Partition Allocation Size [byte]:
-		</td>	
-		<td>
-			<div id="SDCardPartitionAllocationSize">
-				<object data="/version?type=SDCardPartitionAllocationSize"></object>
-			</div>
-		</td>
-	</tr>
-</table>
-
-
-<table style="font-family: arial">
 <h3>Version Info</h3>
 
 <table style="font-family: arial">