Polytech school project. RICM4 students, see http://air.imag.fr/index.php/Projets-2016-2017-Station_de_pompage_connect%C3%A9e for more information

Dependencies:   SX1272Lib mbed WakeUp

Fork of SX1272PingPong by Semtech

Revision:
17:cce0eada6d82
Parent:
15:79a78f997f18
diff -r 85fb5e37def7 -r cce0eada6d82 trame.cpp
--- a/trame.cpp	Fri Mar 03 13:42:44 2017 +0000
+++ b/trame.cpp	Sat Apr 01 12:29:59 2017 +0000
@@ -2,8 +2,9 @@
 #include "trame.h"
 #include "debug.h"
 
-TrameData::TrameData(char id, int nbNiveau, char etatP, char niveau, char batterie){
-    idEmetteur = id;
+TrameData::TrameData(char idE, char idS, int nbNiveau, char etatP, char niveau, char batterie){
+    idEmetteur = idE;
+    idStation = idS;
     if(nbNiveau >= 63){
         nombreNiveau = 0x1F;
     }else{
@@ -12,6 +13,7 @@
     mettreAJourEtatPompe(etatP);
     mettreAJourNiveauCuve(niveau);
     mettreAJourNiveauBatterie(batterie);
+    trame[4]=0;
     
 }
 char getiemebit(char c, int i)
@@ -20,9 +22,10 @@
 }
 
 char* TrameData::creerTrame(){
-    trame[0] = idEmetteur;
-    trame[1] = (etatPompe<<7)|(nombreNiveau<<2)|(niveauCuve>>3);
-    trame[2] = (niveauCuve<<5)|(niveauBatterie);
+    trame[0] = idStation;
+    trame[1] = idEmetteur;
+    trame[2] = (etatPompe<<7)|(nombreNiveau<<2)|(niveauCuve>>3);
+    trame[3] = (niveauCuve<<5)|(niveauBatterie);
     
     //Etat Pompe
     for(int i=0; i < 8; i++){
@@ -68,7 +71,7 @@
     //debug("%c ; %c ; %c\r\n",trame[0],trame[1],trame[2]);
     char courant;
     debug("%d\r\n", sizeof(char));
-    for(int j=0; j<3;j++){
+    for(int j=0; j<4;j++){
         courant = trame[j];
         for(int i=0; i < 8; i++){
             if(getiemebit(courant, i)){