From 0f83278b92125dbf0ec125be4c25ec3111cf0ce7 Mon Sep 17 00:00:00 2001 From: Jeonghoon Park Date: Fri, 10 Aug 2018 13:19:43 +0900 Subject: [PATCH] disable example codes for calculating ppm --- src/co2-sensor.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/co2-sensor.c b/src/co2-sensor.c index 11973c3..5c58667 100644 --- a/src/co2-sensor.c +++ b/src/co2-sensor.c @@ -26,17 +26,19 @@ #define CO2_SENSOR_REF_VOLTAGE (5) #define CO2_SENSOR_VALUE_MAX (1024) +//#define USE_EXAMPLE_CODE + +#ifdef USE_EXAMPLE_CODE /* CAUTION !! These data are EXAMPLE Data, NOT REAL data */ #define CO2_SENSOR_DEFAULT_VALUE_ZP (690) // 400ppm #define CO2_SENSOR_DEFAULT_VALUE_1000 (600) - -#define USE_EXAMPLE_CODE +#endif /* USE_EXAMPLE_CODE */ static const double log400 = 2.602; static bool initialized = false; static double co2_zp_volt = -1; -static double slope_value = 10000; +static double slope_value = 10000; // A real slope value should be a negative value. void co2_sensor_close(void) { @@ -117,7 +119,7 @@ unsigned int co2_sensor_voltage_to_ppm(double voltage) ppm = pow(10, (voltage - co2_zp_volt)/slope_value + log400); // if (ppm > 10000) // ppm = 10000; -#endif +#endif /* USE_EXAMPLE_CODE */ return (unsigned int)ppm; } -- 2.7.4