Parcourir la source

debug threshold

zhangbo il y a 5 ans
Parent
commit
4c56f4289e

BIN
app/bmc/bmc_app


+ 8 - 3
app/bmc/msghndlr/Storlead/Storlead.c

@@ -11,8 +11,8 @@
 
 int  Storlead_GetSysInfo(uint8_t* pReq, uint8_t ReqLen,  uint8_t* pRes)
 {
-	char Title[] = "CPU info";
-	char Text[] = "CPU:Intel;Freq:1 GHZ;Memory:8 GB;Brief:This section test long string. Very very long string. long enough? not long";
+	char Title[] = "系统信息";
+	char Text[] = "CPU型号:FT1500;主频:1 GHZ;内存:8 GB;简介:太神奇了,竟然可以传汉字。哈哈哈。。。";
 	int len = 0,remainLen = 0;
 	uint16_t offset = (pReq[1]<<8) | pReq[2];
 	int totalLen = 0;
@@ -485,7 +485,12 @@ int Storlead_GetChassisInfo(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes)
 
 int Storlead_RestoreFactorSettings(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes)
 {
+    int i;
     pRes[0] = CC_NORMAL;
     //TODO:擦除Flash
-    return 5;
+    //for(i=0;i<)
+    //sf_sector_erase(5, CONFIG_FLASH_START);
+
+
+    return 1;
 }

+ 17 - 3
app/goahead-3.6.5/src/libipmi/src/sensor_helpers.c

@@ -1039,12 +1039,16 @@ unsigned char sdr_convert_sensor_value_to_raw(FullSensorRec_T	*sdr_record, doubl
 {
     int m, b, k1, k2;
     double result;
+    int tmp = 0;
+    unsigned char retVal;
     
     #define tos(val, bits)    ((val & ((1<<((bits)-1)))) ? (-((val) & (1<<((bits)-1))) | (val)) : (val))
     m = tos((((unsigned short int) sdr_record->M_Tolerance << 2 & 0x300) | sdr_record->M), 10);
     b = tos((((unsigned short int) sdr_record->B_Accuracy << 2 & 0x300) | sdr_record->B), 10);
     k1 = tos(sdr_record->R_B_Exp & 0x0f, 4);
     k2 = tos((sdr_record->R_B_Exp & 0xf0) >> 4, 4);
+
+    printf("---> m: %d, b: %d, k1: %d, k2: %d\n", m, b, k1, k2);
     
     /* only works for analog sensors */
     if (sdr_record->Units1 >> 6 > 2)
@@ -1056,9 +1060,19 @@ unsigned char sdr_convert_sensor_value_to_raw(FullSensorRec_T	*sdr_record, doubl
     
     result = (((val / pow(10, k2)) - (b * pow(10, k1))) / m);
     
-    if ((result - (int) result) >= .5)
-        return (unsigned char) ceil(result);
+
+    // if ((result - (int) result) >= .5)
+    //     return (unsigned char) ceil(result);
+    // else
+    //     return (unsigned char) result;
+
+    if(result > 0)
+        result += 0.5;
     else
-        return (unsigned char) result;
+        result += -0.5;
+    tmp = (int)result;
+    retVal = (unsigned char)tmp;
+    printf("---> result: %f, tmp = %d, retVal = %#x\n", result, tmp, retVal);
+    return  retVal;
 }
 

+ 1 - 0
app/goahead-3.6.5/src/web_interface/src/dashboard.c

@@ -152,6 +152,7 @@ void getSysInfo(Webs *wp){
     cJSON_AddStringToObject(data, "title", sysInfo.title);
     cJSON_AddStringToObject(data, "text", sysInfo.text);
 
+
     pStr = cJSON_PrintUnformatted(root);
 
     printf("---> cJSON Str:\n%s\n", pStr);