diff --git a/.vscode/launch.json b/.vscode/launch.json index 01d967f..781cecf 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,28 +1,26 @@ - +{ + "version": "0.2.0", + "configurations": [ { - "version": "0.2.0", - "configurations": [ - { - "name": "Debug C++", - "type": "cppdbg", - "request": "launch", - "program": "${workspaceFolder}/main", - "args": [], - "stopAtEntry": false, - "cwd": "${workspaceFolder}", - "environment": [], - "externalConsole": true, - "MIMode": "gdb", - "setupCommands": [ - { - "description": "Enable pretty-printing for gdb", - "text": "-enable-pretty-printing", - "ignoreFailures": true - } - ], - "preLaunchTask": "build", - "miDebuggerPath": "/usr/bin/gdb" // ou chemin vers gdb sous Windows - } - ] - } - + "name": "Debug C++", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/main", + "args": [], + "stopAtEntry": false, + "cwd": "${workspaceFolder}", + "environment": [], + "externalConsole": true, + "MIMode": "gdb", + "miDebuggerPath": "C:/MinGW/bin/gdb.exe", // <- adjust this path to your Windows gdb + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ], + "preLaunchTask": "C/C++: g++.exe build active file" + } + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json index 53b0dab..19e7db3 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,50 @@ { - "C_Cpp.default.compilerPath": "C:/MinGW/bin/g++.exe" + "C_Cpp.default.compilerPath": "C:/MinGW/bin/g++.exe", + "files.associations": { + "array": "cpp", + "atomic": "cpp", + "*.tcc": "cpp", + "cctype": "cpp", + "chrono": "cpp", + "clocale": "cpp", + "cmath": "cpp", + "cstdarg": "cpp", + "cstddef": "cpp", + "cstdint": "cpp", + "cstdio": "cpp", + "cstdlib": "cpp", + "ctime": "cpp", + "cwchar": "cpp", + "cwctype": "cpp", + "deque": "cpp", + "unordered_map": "cpp", + "vector": "cpp", + "exception": "cpp", + "algorithm": "cpp", + "functional": "cpp", + "iterator": "cpp", + "memory": "cpp", + "memory_resource": "cpp", + "numeric": "cpp", + "random": "cpp", + "ratio": "cpp", + "string": "cpp", + "system_error": "cpp", + "tuple": "cpp", + "type_traits": "cpp", + "utility": "cpp", + "fstream": "cpp", + "initializer_list": "cpp", + "iosfwd": "cpp", + "iostream": "cpp", + "istream": "cpp", + "limits": "cpp", + "new": "cpp", + "ostream": "cpp", + "sstream": "cpp", + "stdexcept": "cpp", + "streambuf": "cpp", + "thread": "cpp", + "typeinfo": "cpp" + } } \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..82ad581 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,28 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "type": "cppbuild", + "label": "C/C++: g++.exe build active file", + "command": "C:/MinGW/bin/g++.exe", + "args": [ + "-fdiagnostics-color=always", + "-g", + "${file}", + "-o", + "${fileDirname}\\${fileBasenameNoExtension}.exe" + ], + "options": { + "cwd": "C:/MinGW/bin" + }, + "problemMatcher": [ + "$gcc" + ], + "group": { + "kind": "build", + "isDefault": true + }, + "detail": "compiler: C:/MinGW/bin/g++.exe" + } + ] +} \ No newline at end of file diff --git a/main.cpp b/main.cpp index b7d1300..e6a34ae 100644 --- a/main.cpp +++ b/main.cpp @@ -2,16 +2,27 @@ #include #include #include +#include +#include +#include // Seuils de BPM const int BPM_MIN = 50; const int BPM_MAX = 120; +int fakeBPM = 60; +const int secondsBetweenMeasures = 10; +const int bufferSize = 60480; // une semaine à 1 mesure/10s +int historique[bufferSize]; +int index = 0; // === Simule la récupération de données du capteur === int acquerirDonnees() { // Ici tu brancherais ton ADC ou capteur réel // Simulation d'une fréquence cardiaque variable - static int fakeBPM = 70 + rand() % 60 - 30; + fakeBPM = fakeBPM - 5 + rand() % 11 ; + std::cout << "Le random BPM est "< bufferBPM; const int tailleBuffer = 5; + std::srand(std::time(0)); while (true) { int mesure = acquerirDonnees(); @@ -68,7 +80,7 @@ int main() { alerter(bpm); } - std::this_thread::sleep_for(std::chrono::seconds(1)); // simulation de délai entre mesures + sleep(1); // simulation de délai entre mesures } return 0;