仕倫 林 / Mbed OS 12_1

Dependencies:   X_NUCLEO_IKS01A2

Revision:
2:5da515ba10ff
Parent:
1:b12ac7b02a21
--- a/source/main.cpp	Wed Apr 29 16:18:37 2020 +0000
+++ b/source/main.cpp	Thu Apr 30 14:28:59 2020 +0000
@@ -33,6 +33,7 @@
 #include "XNucleoIKS01A2.h"
 #include "ESS.h"
 #include "ESS2.h"
+#include "EnvironmentalService.h"
 
 //const static char DEVICE_NAME[] = "Heartrate";
 
@@ -71,11 +72,12 @@
         _hr_counter(100),
         _bt_service(ble, 25),
         //_hr_service(ble, _hr_counter, HeartRateService::LOCATION_FINGER),
-        _deviceInfo(ble, "ST", "Nucleo", "SN1" ),
+        _deviceInfo(ble, "ST", "Nucleo", "SN1","","","" ),
         _adv_data_builder(_adv_buffer),
         
-        _air (ble, (uint16_t) HUMIDITY, (int16_t) TEMPERATURE_C ),
-        _wind (ble, (uint16_t) WIND_DIRECTION, (uint32_t) PRESSURE)
+        _air (ble)
+        //_es(ble),
+        //_wind (ble, (uint16_t) WIND_DIRECTION, (uint32_t) PRESSURE)
         { 
             uuid16_list = new UUID[1]{0x181A};
             //_uuid_list = new UUID(3);
@@ -164,8 +166,8 @@
             hum_temp->get_humidity((float *)&HUMIDITY);
             press_temp->get_pressure((float *)&PRESSURE);
             magnetometer->get_m_axes_raw((int16_t *)MAGNETIC);
-            TEMPERATURE_C = TEMPERATURE_C*100;  //2 decimals
-            HUMIDITY = HUMIDITY*100;                        //2 decimals
+            //TEMPERATURE_C = TEMPERATURE_C*100;  //2 decimals
+            //HUMIDITY = HUMIDITY*100;                        //2 decimals
             PRESSURE = PRESSURE*1000;           //hPa to Pa + 1 decimal
             
             
@@ -182,10 +184,13 @@
             
             WIND_DIRECTION *=100;                             //2 decimals
             
-            _air.updateTemperature((uint16_t)TEMPERATURE_C);   
-            _air.updateHumidity((uint16_t)HUMIDITY);
-            _wind.updateWinddirection((uint16_t)WIND_DIRECTION);
-            _wind.updatePressure((uint16_t)PRESSURE);
+            _air.updateTemperature((float)TEMPERATURE_C);   
+            //_es.updateTemperature((float)TEMPERATURE_C); 
+            _air.updateHumidity((uint16_t)1);
+            //_es.updateHumidity((uint16_t)1);
+            _air.updateWinddirection((uint16_t)WIND_DIRECTION);
+            _air.updatePressure((uint16_t)PRESSURE);
+            //_es.updatePressure((uint16_t)PRESSURE);
             
             
             TEMPERATURE_F = (TEMPERATURE_C * 1.8f) + 32.0f; //Convert the temperature from Celsius to Fahrenheit
@@ -230,7 +235,8 @@
     BatteryService _bt_service;
     
     EnvironmentalSensingService _air;
-    EnvironmentalSensingService2 _wind;
+    //EnvironmentalSensingService2 _wind;
+    //EnvironmentalService _es;
     
     UUID * uuid16_list;