Selaa lähdekoodia

2020.04.22 / Folus Wen

Actions:
1. Local databse initial bug fix for config table.
2. Query connector operactive configuration value bug fix.

Files:
1. As follow commit history

Image version: B0.31.00.0000.00
Image checksum: XXXXXXXX

Hardware PWB P/N : XXXXXXX
Hardware Version : XXXXXXX
FolusWen 5 vuotta sitten
vanhempi
commit
6f805b3459
1 muutettua tiedostoa jossa 8 lisäystä ja 5 poistoa
  1. 8 5
      EVSE/Projects/AW-Regular/Apps/main.c

+ 8 - 5
EVSE/Projects/AW-Regular/Apps/main.c

@@ -443,7 +443,7 @@ int DB_Open(sqlite3 *db)
 						  "stopReason text"
 						  ");";
 
-	char* createCfgSql="CREATE TABLE `config` ( "
+	char* createCfgSql="CREATE TABLE IF NOT EXISTS `config` ( "
 					   "`idx` INTEGER PRIMARY KEY AUTOINCREMENT, "
 					   "`item` TEXT NOT NULL, "
 				       "`connector` INTEGER NOT NULL, "
@@ -573,7 +573,7 @@ int DB_Get_Operactive(sqlite3 *db, uint8_t gun_index)
 	int	 rows, cols;
 
 	sprintf(sqlStr, "select * from config where item='isOperactive' and connector=%d;", gun_index);
-	DEBUG_INFO("sqlStr= %s\r\n", sqlStr);
+	//DEBUG_INFO("sqlStr= %s\r\n", sqlStr);
 
 	if(sqlite3_open(DB_FILE, &db))
 	{
@@ -586,7 +586,7 @@ int DB_Get_Operactive(sqlite3 *db, uint8_t gun_index)
 		DEBUG_INFO( "Local config query database open successfully.\r\n");
 		sqlite3_get_table(db, sqlStr, &rs, &rows, &cols, &errMsg);
 
-		if(rows>0)
+		if(rows>1)
 		{
 			for(int idxRow=1;idxRow<=rows;idxRow++)
 			{
@@ -594,10 +594,13 @@ int DB_Get_Operactive(sqlite3 *db, uint8_t gun_index)
 				{
 					result = false;
 				}
-				DEBUG_INFO("%s, %s, %s, %s\r\n", rs[(idxRow*cols)+0], rs[(idxRow*cols)+1], rs[(idxRow*cols)+2], rs[(idxRow*cols)+3]);
 				DEBUG_INFO("Query connector-%d isOperactive: %s\r\n", gun_index, rs[(idxRow*cols)+3]);
 			}
 		}
+		else
+		{
+			DEBUG_INFO("Query connector-%d fail, set default value to operactive.\r\n", gun_index);
+		}
 
 		sqlite3_free_table(rs);
 		sqlite3_close(db);
@@ -1174,7 +1177,7 @@ void get_firmware_version(unsigned char gun_index)
 	strcpy((char*)ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev, ShmCharger->gun_info[gun_index].ver.Version_FW);
 
 	// Get CSU root file system version
-	sprintf((char*)ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev, "B0.30.00.0000.00");
+	sprintf((char*)ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev, "B0.31.00.0000.00");
 
 	// Get AC connector type from model name
 	for(uint8_t idx=0;idx<3;idx++)