Commit ee56f086 authored by Eric Duminil's avatar Eric Duminil
Browse files

Pass by reference

parent 2e99fa40
...@@ -40,7 +40,7 @@ namespace lorawan { ...@@ -40,7 +40,7 @@ namespace lorawan {
extern String last_transmission; extern String last_transmission;
void initialize(); void initialize();
void process(); void process();
void preparePayloadIfTimeHasCome(int16_t co2, float temp, float hum); void preparePayloadIfTimeHasCome(const int16_t &co2, const float &temp, const float &hum);
} }
#endif #endif
......
...@@ -207,7 +207,7 @@ namespace mqtt { ...@@ -207,7 +207,7 @@ namespace mqtt {
} }
} }
void publishIfTimeHasCome(const String &timeStamp, int16_t co2, float temp, float hum) { void publishIfTimeHasCome(const String &timeStamp, const int16_t &co2, const float &temp, const float &hum) {
// Send message via MQTT according to sending interval // Send message via MQTT according to sending interval
unsigned long now = seconds(); unsigned long now = seconds();
//TODO: Send average since last MQTT message? //TODO: Send average since last MQTT message?
......
...@@ -9,12 +9,12 @@ ...@@ -9,12 +9,12 @@
#include "src/lib/PubSubClient/src/PubSubClient.h" #include "src/lib/PubSubClient/src/PubSubClient.h"
#include "wifi_util.h" #include "wifi_util.h"
namespace config { namespace config {
extern uint16_t sending_interval; // [s] extern uint16_t sending_interval; // [s]
} }
namespace mqtt { namespace mqtt {
extern String last_successful_publish; extern String last_successful_publish;
void initialize(String &topic); void initialize(String &topic);
void keepConnection(); void keepConnection();
void publishIfTimeHasCome(const String &timeStamp, int16_t co2, float temp, float hum); void publishIfTimeHasCome(const String &timeStamp, const int16_t &co2, const float &temp, const float &hum);
} }
#endif #endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment