ROVER - corrections to some files
Signed-off-by: Mustafa Ozcelikors <mozcelikors@gmail.com>
diff --git a/rover/src/RaspberryTest.cpp b/rover/src/RaspberryTest.cpp
index ce81e15..db2e4d4 100644
--- a/rover/src/RaspberryTest.cpp
+++ b/rover/src/RaspberryTest.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 Eclipse Foundation, FH Dortmund and others
+ * Copyright (c) 2017 FH Dortmund and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -41,6 +41,10 @@
#include "tasks/parking_task.h"
#include "tasks/hono_interaction_task.h"
#include "tasks/cpu_logger_task.h"
+#include "tasks/oled_task.h"
+#include "tasks/srf02_task.h"
+#include "tasks/bluetooth_task.h"
+#include "tasks/external_gpio_task.h"
#include "interfaces.h"
#include "pthread_monitoring/collect_thread_name.h"
@@ -106,6 +110,17 @@
timing_interface cpu_logger_task_ti;
pthread_mutex_t cpu_logger_task_ti_l;
+timing_interface oled_task_ti;
+pthread_mutex_t oled_task_ti_l;
+
+timing_interface srf02_task_ti;
+pthread_mutex_t srf02_task_ti_l;
+
+timing_interface bluetooth_task_ti;
+pthread_mutex_t bluetooth_task_ti_l;
+
+timing_interface extgpio_task_ti;
+pthread_mutex_t extgpio_task_ti_l;
//Shared data between threads
@@ -145,6 +160,9 @@
double cpu_util_shared[4];
pthread_mutex_t cpu_util_shared_lock;
+int buzzer_status_shared;
+pthread_mutex_t buzzer_status_shared_lock;
+
int main()
{
//Register all the entries as devices to cloud
@@ -172,6 +190,7 @@
bearing_shared = 0.0;
driving_mode = MANUAL;
speed_shared = FULL_SPEED;
+ buzzer_status_shared = 0;
//Initialize mutexes
pthread_mutex_init(&temperature_lock, NULL);
@@ -183,6 +202,7 @@
pthread_mutex_init(&infrared_lock, NULL);
pthread_mutex_init(&compass_lock, NULL);
pthread_mutex_init(&driving_mode_lock, NULL);
+ pthread_mutex_init(&buzzer_status_shared_lock, NULL);
//Thread objects
pthread_t main_thread = pthread_self();
@@ -204,6 +224,10 @@
pthread_t parking_thread;
pthread_t hono_interaction_thread;
pthread_t cpu_logger_thread;
+ pthread_t oled_thread;
+ pthread_t srf02_thread;
+ pthread_t bluetooth_thread;
+ pthread_t extgpio_thread;
//Thread creation
@@ -345,8 +369,44 @@
pthread_setname_np(cpu_logger_thread, "cpulog"); //If name is too long, this function silently fails.
}
+ if(pthread_create(&oled_thread, NULL, OLED_Task, NULL)) {
+ fprintf(stderr, "Error creating thread\n");
+ return 1;
+ }
+ else
+ {
+ pthread_setname_np(oled_thread, "oled"); //If name is too long, this function silently fails.
+ }
+
+ if(pthread_create(&extgpio_thread, NULL, External_GPIO_Task, NULL)) {
+ fprintf(stderr, "Error creating thread\n");
+ return 1;
+ }
+ else
+ {
+ pthread_setname_np(extgpio_thread, "extg"); //If name is too long, this function silently fails.
+ }
+
+ /*if(pthread_create(&srf02_thread, NULL, SRF02_Task, NULL)) {
+ fprintf(stderr, "Error creating thread\n");
+ return 1;
+ }
+ else
+ {
+ pthread_setname_np(srf02_thread, "srf02"); //If name is too long, this function silently fails.
+ }*/
+
+ /*if(pthread_create(&bluetooth_thread, NULL, Bluetooth_Task, NULL)) {
+ fprintf(stderr, "Error creating thread\n");
+ return 1;
+ }
+ else
+ {
+ pthread_setname_np(bluetooth_thread, "ble"); //If name is too long, this function silently fails.
+ }*/
+
//Core pinning/mapping
- placeAThreadToCore (main_thread, 1);
+/* placeAThreadToCore (main_thread, 1);
placeAThreadToCore (ultrasonic_sr04_front_thread, 2);
#ifdef USE_GROOVE_SENSOR
placeAThreadToCore (ultrasonic_grove_thread, 3);
@@ -361,6 +421,7 @@
placeAThreadToCore (infrared_thread, 2);
placeAThreadToCore (displaysensors_thread, 0);
placeAThreadToCore (webserver_motordrive_thread, 0);
+ */
while (1)
{
diff --git a/rover/src/api/basic_psys_rover.h b/rover/src/api/basic_psys_rover.h
index 8bb7ec8..8c069f6 100644
--- a/rover/src/api/basic_psys_rover.h
+++ b/rover/src/api/basic_psys_rover.h
@@ -48,7 +48,7 @@
extern void stop(void);
-extern void shutdown(void);
+extern void shutdown_rover(void);
extern void go(int direction, int speed);
diff --git a/rover/src/hono_interaction/hono_interaction.cpp b/rover/src/hono_interaction/hono_interaction.cpp
index fc6e1ba..352b937 100644
--- a/rover/src/hono_interaction/hono_interaction.cpp
+++ b/rover/src/hono_interaction/hono_interaction.cpp
@@ -340,6 +340,7 @@
registerDeviceToHonoInstance("idial.institute",8080,"DEFAULT_TENANT", "roverUtilCpu2");
registerDeviceToHonoInstance("idial.institute",8080,"DEFAULT_TENANT", "roverUtilCpu3");
registerDeviceToHonoInstance("idial.institute",8080,"DEFAULT_TENANT", "roverUtilCpu4");
+ registerDeviceToHonoInstance("idial.institute",8080,"DEFAULT_TENANT", "connectionCheck");
return 1;
}
diff --git a/rover/src/hono_interaction/hono_interaction.h b/rover/src/hono_interaction/hono_interaction.h
index 47c86a9..9550b2e 100644
--- a/rover/src/hono_interaction/hono_interaction.h
+++ b/rover/src/hono_interaction/hono_interaction.h
@@ -30,5 +30,6 @@
int registerDeviceToHonoInstance (char * host_name, int port, char * tenant_name, char * device_id);
int sendTelemetryDataToHonoInstance (char * host_name, int port, char * tenant_name, char * device_id, char * field, double value);
int sendEventDataToHonoInstance (char * host_name, int port, char * tenant_name, char * device_id, char * field, double value);
+int handleCode(int code);
#endif /* HONO_INTERACTION_HONO_INTERACTION_H_ */
diff --git a/rover/src/interfaces.h b/rover/src/interfaces.h
index 6ea16ec..3fc5937 100644
--- a/rover/src/interfaces.h
+++ b/rover/src/interfaces.h
@@ -92,6 +92,18 @@
extern timing_interface cpu_logger_task_ti;
extern pthread_mutex_t cpu_logger_task_ti_l;
+extern timing_interface oled_task_ti;
+extern pthread_mutex_t oled_task_ti_l;
+
+extern timing_interface srf02_task_ti;
+extern pthread_mutex_t srf02_task_ti_l;
+
+extern timing_interface bluetooth_task_ti;
+extern pthread_mutex_t bluetooth_task_ti_l;
+
+extern timing_interface extgpio_task_ti;
+extern pthread_mutex_t extgpio_task_ti_l;
+
//---
extern float temperature_shared;
@@ -127,5 +139,8 @@
extern double cpu_util_shared[4];
extern pthread_mutex_t cpu_util_shared_lock;
+extern int buzzer_status_shared;
+extern pthread_mutex_t buzzer_status_shared_lock;
+
#endif /* INTERFACES_H_ */
diff --git a/rover/src/tasks/record_timing_task.cpp b/rover/src/tasks/record_timing_task.cpp
index 26933e9..6eed3f2 100644
--- a/rover/src/tasks/record_timing_task.cpp
+++ b/rover/src/tasks/record_timing_task.cpp
@@ -74,7 +74,7 @@
record_timing_task_tmr.calculatePreviousSlackTime();
//Task content starts here -----------------------------------------------
- printf("---------- TASK TIMING/SCHEDULING INFO ----------\n");
+ /*printf("---------- TASK TIMING/SCHEDULING INFO ----------\n");
PrintTimingInfo(temperature_task_ti);
PrintTimingInfo(display_sensors_task_ti);
PrintTimingInfo(infrared_distance_task_ti);
@@ -88,7 +88,9 @@
PrintTimingInfo(record_sensor_data_task_ti);
PrintTimingInfo(parking_task_ti);
PrintTimingInfo(compass_task_ti);
- printf("-------------------------------------------------\n");
+ PrintTimingInfo(oled_task_ti);
+ PrintTimingInfo(srf02_task_ti);
+ printf("-------------------------------------------------\n");*/
//Task content ends here -------------------------------------------------
record_timing_task_tmr.recordEndTime();