Xiaohai Li
/
AirBoxProto
Demo
Diff: AplicationLayer/DebugCommander.cpp
- Revision:
- 1:0c1053275589
- Parent:
- 0:3dac4f477e98
- Child:
- 2:0ee90da44162
--- a/AplicationLayer/DebugCommander.cpp Wed Jul 08 17:50:18 2015 +0000 +++ b/AplicationLayer/DebugCommander.cpp Thu Jul 09 05:14:58 2015 +0000 @@ -26,14 +26,14 @@ if(co2Vol < 0) uart_db.printf("CheckSum Error!\n\r"); else - uart_db.printf("OK!\n\rCO2 Vol = %dppm.\n\r", co2Vol); + uart_db.printf("OK!\n\rCO2 Vol = %dppm.\n\r\n\r", co2Vol); } void DebugFunc_PM25(void) { float pm25Vol = 0, pm25VolAvg = 0; int cnt = 0, cnt_max = 30; - uart_db.printf("Reading ZPH01 (need %dsec)...", cnt_max); + uart_db.printf("Reading ZPH01 (need %dsec)", cnt_max); SerialMuxSel(SMUX_ZPH01); while(cnt < cnt_max) @@ -41,16 +41,18 @@ pm25Vol = ZPH01_ReadPM25(); if(pm25Vol < 0) { - uart_db.printf("CheckSum Error!\n\rRepeat reading..."); + uart_db.printf("CheckSum Error!\n\rRepeat reading"); } else { pm25VolAvg += pm25Vol; + uart_db.printf("."); + //uart_db.printf("Single sample = %fug/m^3.\n\r", pm25Vol); cnt++; } } pm25VolAvg = pm25VolAvg / cnt_max; - uart_db.printf("OK!\n\rPM2.5 Vol = %dug/m^3.\n\r", pm25VolAvg); + uart_db.printf("OK!\n\rPM2.5 Vol = %fug/m^3.\n\r\n\r", pm25VolAvg); } void DebugFunc_CH2O(void) @@ -61,7 +63,7 @@ if(ch2oVol < 0) uart_db.printf("CheckSum Error!\n\r"); else - uart_db.printf("OK!\n\rCH2O Vol = %dug/m^3.\n\r", ch2oVol); + uart_db.printf("OK!\n\rCH2O Vol = %dug/m^3.\n\r\n\r", ch2oVol); } void DebugFunc_TempRh(void) @@ -69,22 +71,22 @@ uart_db.printf("Reading SHT20..."); float temp = SHT20_ReadTemp(); float rh = SHT20_ReadRh(); - uart_db.printf("OK!\n\rTemperature = %.2f, Humidity = %2.f\n\r", temp, rh); + uart_db.printf("OK!\n\rTemperature = %.2f, Humidity = %2.f\n\r\n\r", temp, rh); } void DebugFunc_AirPress(void) { - uart_db.printf("Not implemented..."); + uart_db.printf("Air pressure test not implemented...\n\r"); } void DebugFunc_UvLevel(void) { - uart_db.printf("Not implemented..."); + uart_db.printf("UV level test not implemented...\n\r"); } void DebugFunc_WiFi(void) { - uart_db.printf("Not implemented..."); + uart_db.printf("WiFi test not implemented...\n\r"); } void DebugFunc_SwitchSmux(void) @@ -135,7 +137,16 @@ case 'w': DebugFunc_WiFi(); - break; + break; + + case '0': + DebugFunc_CO2(); + DebugFunc_CH2O(); + DebugFunc_PM25(); + DebugFunc_TempRh(); + DebugFunc_AirPress(); + DebugFunc_UvLevel(); + break; case '1': DebugFunc_CO2();