From c00f0c15f86b112f4b85cdc2c3752f16cfd4394d Mon Sep 17 00:00:00 2001 From: root Date: Fri, 24 Apr 2020 13:52:02 +0000 Subject: [PATCH] MAJ --- Ansible/MainTask.retry | 1 + Ansible/inventaire-rasp.ini | 1 + Ansible/roles/arduino/tasks/main.yml | 2 +- site/accesBase.php | 10 ++++++++++ site/add.php | 5 +++-- site/reception.php | 2 +- site/upload/inventaire.ini | 2 +- 7 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 Ansible/MainTask.retry diff --git a/Ansible/MainTask.retry b/Ansible/MainTask.retry new file mode 100644 index 0000000..067d99a --- /dev/null +++ b/Ansible/MainTask.retry @@ -0,0 +1 @@ +172.26.145.111 diff --git a/Ansible/inventaire-rasp.ini b/Ansible/inventaire-rasp.ini index e69de29..067d99a 100644 --- a/Ansible/inventaire-rasp.ini +++ b/Ansible/inventaire-rasp.ini @@ -0,0 +1 @@ +172.26.145.111 diff --git a/Ansible/roles/arduino/tasks/main.yml b/Ansible/roles/arduino/tasks/main.yml index 16bf303..e60b840 100644 --- a/Ansible/roles/arduino/tasks/main.yml +++ b/Ansible/roles/arduino/tasks/main.yml @@ -1,5 +1,5 @@ --- -- name: "envoyer du fichier binaire.c" +- name: "envoyer du fichier main.c" copy: src: ../../../../site/upload/main.c dest: /home/pi/capteur{{capteur}}/main.c diff --git a/site/accesBase.php b/site/accesBase.php index c6c7bb9..115edb3 100644 --- a/site/accesBase.php +++ b/site/accesBase.php @@ -352,4 +352,14 @@ return False; } } + + function getNumero($nom) + { + $db = connexion(); + $query = "SELECT numero FROM capteurs WHERE nom = '$nom'"; + $result = pg_query($db, $query) or die("La requ te a echou : ".pg_last_error()); + $tab = pg_fetch_assoc($result); + deconnexion($db); + return $tab['numero']; + } ?> diff --git a/site/add.php b/site/add.php index ce1c00a..1a08b89 100644 --- a/site/add.php +++ b/site/add.php @@ -23,7 +23,7 @@ session_start(); if(add($_POST['nom'], $_POST['type'], $_POST['raspberry'], $_POST['unite'], $_POST['version'])) { $arduino_simple = "[Arduino_init]\r\n"; - $arduino_spi = "[Arduino_spi_init]\r\n"; + $arduino_spi = "[Arduino_init]\r\n"; $nucleo = "[Nucleo_init]\r\n"; $setup = getSetup($_POST['raspberry']); @@ -40,7 +40,8 @@ session_start(); { $ini = $nucleo; } - $ini = $ini.$_POST['raspberry']." capteur=".$_POST['numero']."-".$_POST['version']." setup=".$setup."\n"; + $numero = getNumero($_POST['nom']); + $ini = $ini.$_POST['raspberry']." capteur=".$numero."-".$_POST['version']." setup=".$setup."\n"; file_put_contents('upload/inventaire.ini', $ini); setup($_POST['raspberry']); exec("super cmd.sh"); diff --git a/site/reception.php b/site/reception.php index 0a7222c..f0f2368 100644 --- a/site/reception.php +++ b/site/reception.php @@ -7,7 +7,7 @@ if(isset($_POST['sensor'])) { $ini = ""; $arduino_simple = "[Arduino]\r\n"; - $arduino_spi = "[Arduino_spi]\r\n"; + $arduino_spi = "[Arduino]\r\n"; $nucleo = "[Nucleo]\r\n"; $a_simple = false; diff --git a/site/upload/inventaire.ini b/site/upload/inventaire.ini index 0883f96..3c5bb1f 100644 --- a/site/upload/inventaire.ini +++ b/site/upload/inventaire.ini @@ -1,3 +1,3 @@ [Arduino] -172.26.145.113 capteur=1-0 +172.26.145.111 capteur=2-0 -- libgit2 0.21.2