Lizzy project

Dependencies:   aconno_I2C Lis2dh12 adc52832_common aconno_SEGGER_RTT

Branch:
master
Revision:
26:6101bb09f70d
Parent:
24:7539258b015c
Child:
29:b021b33cf666
--- a/tasks/tasks.cpp	Thu Sep 20 07:41:02 2018 +0000
+++ b/tasks/tasks.cpp	Thu Sep 20 13:20:13 2018 +0000
@@ -170,27 +170,44 @@
 
 void updateBuzzLedsF()
 {
+#if VODAFONE_COMPATIBILITY == 1
+    const uint8_t startBuzz = 0xBA;
+#endif    
+    
     while (1)
     {
         Thread::signal_wait(UPDATE_BUZZ_LEDS);
         updateBuzzLedsT.signal_clr(UPDATE_BUZZ_LEDS);
-        
-        if (buzzer.get_state() != (lizzy_service->get_buzz_state()))
+
+#if VODAFONE_COMPATIBILITY == 1
+        uint8_t tmpBuzzState[4];
+        if( buzzer.get_state() != 
+            (lizzy_service->getBuzz(tmpBuzzState)[0] == startBuzz) )
+#else
+        if( buzzer.get_state() != (lizzy_service->getBuzz()) )
+#endif
         {
-            if (lizzy_service->get_buzz_state())
+#if VODAFONE_COMPATIBILITY == 1
+            if( tmpBuzzState[0] == startBuzz )
+#else
+            if( lizzy_service->getBuzz() )
+#endif
                 buzzer.enable();
             else
                 buzzer.disable();
         }
-        if (!redLed != (lizzy_service->get_red_state()))
+#if VODAFONE_COMPATIBILITY == 1
+#else
+        if( !redLed != (lizzy_service->getRedLed()) )
         {
-            redLed = !(lizzy_service->get_red_state());
+            redLed = !(lizzy_service->getRedLed());
         }
-        if (!greenLed != (lizzy_service->get_green_state()))
+#endif
+        if( !greenLed != (lizzy_service->get_green_state()) )
         {
             greenLed = !(lizzy_service->get_green_state());
         }
-        if (!blueLed != (lizzy_service->get_blue_state()))
+        if( !blueLed != (lizzy_service->get_blue_state()) )
         {
             blueLed = !(lizzy_service->get_blue_state());
         }
@@ -203,51 +220,14 @@
     {
         Thread::signal_wait(MEAS_DONE);
         bleT.signal_clr(MEAS_DONE);
-        
-        /*
-        printf("%6d\t", advertisementPacket.accelerometer[0]);
-        printf("%6d\t", advertisementPacket.accelerometer[1]);
-        printf("%6d\r\n", advertisementPacket.accelerometer[2]);
-        */
 
-        
-        /* setup advertising */
-        
-        
-        /*
-        GapAdvertisingData advetisementData = GapAdvertisingData();
-        advetisementData = ble->getAdvertisingData();
-        advetisementData.updateData(advetisementData.MANUFACTURER_SPECIFIC_DATA, (uint8_t *)&advertisementPacket, sizeof(advertising_packet));
-        ble->setAdvertisingData(advetisementData);
-        */
+#if VODAFONE_COMPATIBILITY == 1
+#else
         adv_data = ble->getAdvertisingData();
         adv_data.updateData(adv_data.MANUFACTURER_SPECIFIC_DATA, (uint8_t *)&advertisementPacket, sizeof(advertisementPacket));
         ble->setAdvertisingData(adv_data);
-        
-        
-        //printf("Ble advertisement is ON.\r\n");
-        
-        #if DEBUG_LED
-            redLed = 0;
-        #endif
-        //ble->gap().startAdvertising();
-        //wait_ms(1000);
-        
-        //wait_ms(MEASURE_INTERVAL_MS);
-        //wait_ms(1000);
-        
-        //printf("Ble advertisement is OFF.\r\n\r\n");
-        #if DEBUG_LED
-            redLed = 1;
-        #endif
-        //ble->gap().stopAdvertising();
-        /*
-        GapAdvertisingData advetisementData = GapAdvertisingData();
-        advetisementData = ble->getAdvertisingData();
-        advetisementData.updateData(advetisementData.MANUFACTURER_SPECIFIC_DATA, (uint8_t *)&advertisementPacket, sizeof(advertising_packet));
-        ble->setAdvertisingData(advetisementData);
-        */
-        //wait_ms(100);
+#endif
+
     }
 }