Xiaohai Li
/
AirBoxProto
Demo
Diff: PeripheralLayer/PeMod_ZPH01.cpp
- Revision:
- 1:0c1053275589
- Parent:
- 0:3dac4f477e98
--- a/PeripheralLayer/PeMod_ZPH01.cpp Wed Jul 08 17:50:18 2015 +0000 +++ b/PeripheralLayer/PeMod_ZPH01.cpp Thu Jul 09 05:14:58 2015 +0000 @@ -5,7 +5,7 @@ #define ZPH01_GAS_ID 0x18 #define uart_zph01 uart_sen -#define uart_db uart_pc +//#define uart_db uart_pc int ZPH01_Init(void) { @@ -56,7 +56,10 @@ if(data[ZPH01_DAT_LEN - 1] == sum) { //Unit: percents(%) - float ratioPM25 = data[3] * 1.0 + data[3] / 255.0; + float ratioPM25 = data[3] * 1.0 + data[4] / 100.0; + #if defined uart_db + uart_db.printf("PM2.5 PWM ratio is %f%%.\n\r", ratioPM25); + #endif //Unit: ug/m^3 float volPM25 = ratioPM25 * 20.43; return volPM25;