Module sigfox pour le projet toiture

Dependents:   projet_embarque1 projet_embarque1

Files at this revision

API Documentation at this revision

Comitter:
3874313
Date:
Tue Oct 15 15:02:13 2019 +0000
Parent:
2:fd9cadc78239
Commit message:
final;

Changed in this revision

Sigfox.cpp Show annotated file Show diff for this revision Revisions of this file
Sigfox.h Show annotated file Show diff for this revision Revisions of this file
--- a/Sigfox.cpp	Tue Oct 15 12:27:21 2019 +0000
+++ b/Sigfox.cpp	Tue Oct 15 15:02:13 2019 +0000
@@ -23,8 +23,13 @@
   * @param  Les valeurs detectees par les capteurs
   * @retval 
   */
-void Sigfox::send(s16 temp_air, u16 hum_air, s16 temp_sol, u16 hum_sol, u8 lum, u8 val_r, u8 val_g, u8 val_b) {
-    printf("AT$SF=%04x%04x%04x%04x%02x%02x%02x%02x\r", temp_air, hum_air, temp_sol, hum_sol, lum, val_r, val_g, val_b);
+void Sigfox::send(s16 temp_air, u16 hum_air, s16 temp_sol, u16 hum_sol, u8 lum, u8 val_r, u8 val_g, u8 val_b, u8 bat) {
+    uint16_t temp1, temp2;
+    uint32_t tmp;
+    temp1 = temp_air + 200;
+    temp2 = temp_sol + 200;
+    tmp = temp1 | (temp2<<10) | (hum_air<<20);
+    printf("AT$SF=%08x%04x%02x%02x%02x%02x%02x\r", tmp, hum_sol, lum, val_r, val_g, val_b, bat);
 }
 
 void Sigfox::sleep() {
--- a/Sigfox.h	Tue Oct 15 12:27:21 2019 +0000
+++ b/Sigfox.h	Tue Oct 15 15:02:13 2019 +0000
@@ -23,7 +23,7 @@
         * @param  Les valeurs detectees par les capteurs
         * @retval 
         */
-        void send(s16 temp_air, u16 hum_air, s16 temp_sol, u16 hum_sol, u8 lum, u8 val_r, u8 val_g, u8 val_b);
+        void send(s16 temp_air, u16 hum_air, s16 temp_sol, u16 hum_sol, u8 lum, u8 val_r, u8 val_g, u8 val_b,u8 bat);
         
         // Sleep mode
         void sleep();