Added two color led to indicate the app's status
[apps/native/gear-racing-car.git] / src / lap_counter / lap_counter.c
index aa9746d..b52bd8a 100644 (file)
@@ -22,6 +22,7 @@
 #include <stdlib.h>
 #include <time.h>
 #include "cloud/cloud_communication.h"
+#include "resource/resource_led.h"
 
 #define MIN_LAP_TIME 5
 #define MAX_NAME_LENGTH 256
@@ -98,6 +99,7 @@ static inline struct timespec _calculate_lap_time(struct timespec *prev, struct
        _D("----------------------------------------------");
 
        cloud_communication_post_lap(lap.tv_sec * 1e3 + lap.tv_nsec / 1e6, s_info.user_name);
+
        return lap;
 }
 
@@ -105,12 +107,13 @@ void lap_counter_get_lap_time()
 {
        struct timespec timestamp;
        int ret = clock_gettime(CLOCK_MONOTONIC, &timestamp);
-       retv_error_message(ret != 0, ret);
+       ret_error_message(ret != 0, ret);
 
        if (s_info.last_timestamp.tv_nsec != 0 || s_info.last_timestamp.tv_sec != 0) {
                _calculate_lap_time(&s_info.last_timestamp, &timestamp);
        } else {
                _D("Initial lap");
+               resource_led_blink(LED_COLOR_NONE, 1000);
        }
 
        s_info.last_timestamp.tv_sec = timestamp.tv_sec;