diff --git a/Code-C/CMakeLists.txt b/Code-C/CMakeLists.txt index 584eb68..78dc654 100644 --- a/Code-C/CMakeLists.txt +++ b/Code-C/CMakeLists.txt @@ -1,9 +1,10 @@ + cmake_minimum_required(VERSION 2.8) project(Traitement-signal-plantes C) include(CTest) enable_testing() -set(CMAKE_C_FLAGS "-lsqlite3 -std=c99 -g -Wall") #what are the flag for ? +set(CMAKE_C_FLAGS "-std=c99 -g -Wall") #what are the flag for ? file(MAKE_DIRECTORY RawDataFiles) #why do we make this folder each time ? file(MAKE_DIRECTORY Executable) @@ -13,7 +14,7 @@ set (CMAKE_RUNTIME_OUTPUT_DIRECTORY Executable) #Set Executable directory as def add_executable(exect fileGestion.c getArray.c average.c growthRate.c power.c queue.c simulateFlux.c database.c main.c) # add_executable(exect main.c simulateFlux.c queue.c power.c growthRate.c average.c getArray.c fileGestion.c) -find_package(SQLite3) +find_package(SQLite3 REQUIRED) target_link_libraries(exect ${SQLite3_LIBRARIES} m) @@ -24,6 +25,7 @@ set(CTEST_MEMORYCHECK_TYPE "AddressSanitizer") set(CTEST_MEMORYCHECK_SANITIZER_OPTIONS "verbosity=1:symbolize=1:abort_on_error=1:detect_leaks=1") add_executable(ctest fileGestion.c getArray.c average.c growthRate.c queue.c simulateFlux.c database.c ctest.c) +target_link_libraries(ctest ${SQLite3_LIBRARIES} m) target_link_libraries(ctest ${CMAKE_THREAD_LIBS_INIT} m) add_test(test_queueCreateEmpty ./ctest queueCreateEmpty) diff --git a/Code-C/database.c b/Code-C/database.c index 55214f5..3b81cce 100644 --- a/Code-C/database.c +++ b/Code-C/database.c @@ -240,7 +240,7 @@ int initiaizeNewTrial(char *position, double frequency, bool *captorOneHot) { if (captorOneHot[i]) { - insertCaptorMetadataElement(i, trialId); + insertCaptorMetadataElement(i + 1, trialId); createCaptorDataTable(trialId, i + 1); } } diff --git a/Code-C/main b/Code-C/main deleted file mode 100755 index 7269e1e..0000000 Binary files a/Code-C/main and /dev/null differ diff --git a/Code-C/main.c b/Code-C/main.c index d8555f4..479d933 100644 --- a/Code-C/main.c +++ b/Code-C/main.c @@ -148,14 +148,6 @@ int main(int argc, char **argv) } printf("%d", nCol); - for (int i = 0; i < 8; i++) - { - if (selectionCaptors[i]) - { - nCol++; - } - } - rawDataWriteFlag = true; period = 1 / freqEch; @@ -167,19 +159,19 @@ int main(int argc, char **argv) createDb(); // Created the Db if not exist initiaizeNewTrial("test", freqEch, selectionCaptors); // Initialize Trials data and tables - pthread_t rawData; - if (pthread_create(&rawData, NULL, threadSimulateFlux, "threadSimulflux") != 0) - { - perror("threadSimulflux() error"); - exit(1); - } + // pthread_t rawData; + // if (pthread_create(&rawData, NULL, threadSimulateFlux, "threadSimulflux") != 0) + // { + // perror("threadSimulflux() error"); + // exit(1); + // } - pthread_t calculAverage; - if (pthread_create(&calculAverage, NULL, threadCalculAverage, "threadCalculAverage")) - { - perror("threadCalculAverage() error"); - exit(1); - } + // pthread_t calculAverage; + // if (pthread_create(&calculAverage, NULL, threadCalculAverage, "threadCalculAverage")) + // { + // perror("threadCalculAverage() error"); + // exit(1); + // } // pthread_t calculGrowthRate; // if (pthread_create(&calculGrowthRate, NULL, threadCalculGrowthRate, "threadCalculGrowthRate")) @@ -188,7 +180,7 @@ int main(int argc, char **argv) // exit(1); // } - pthread_exit(NULL); + // pthread_exit(NULL); sqlite3_shutdown(); } \ No newline at end of file diff --git a/Code-C/robotgowest.db b/Code-C/robotgowest.db new file mode 100644 index 0000000..eaf2675 Binary files /dev/null and b/Code-C/robotgowest.db differ