Skip to content

Commit

Permalink
basic change to implement #389
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Baldinetti committed Jan 22, 2022
1 parent 55b91a6 commit f6c823f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions platformio/stima_v3/stima/src/stima-config.h
Original file line number Diff line number Diff line change
Expand Up @@ -554,4 +554,10 @@ coming from recovery json RPC.
*/
#define DATE_TIME_STRING_LENGTH (25)

/*!
\def MQTT_TX_S
\brief Default MQTT TX seconds.
*/
#define MQTT_TX_S (900)

#endif
7 changes: 6 additions & 1 deletion platformio/stima_v3/stima/src/stima.ino
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,8 @@ void set_default_configuration() {
writable_configuration.module_main_version = MODULE_MAIN_VERSION;
writable_configuration.module_configuration_version = MODULE_CONFIGURATION_VERSION;

writable_configuration.report_seconds = 900;
writable_configuration.report_seconds = MQTT_TX_S;
writable_configuration.transmit_seconds = MQTT_TX_S;

writable_configuration.sensors_count = 0;
memset(writable_configuration.sensors, 0, sizeof(sensor_t) * SENSORS_MAX);
Expand Down Expand Up @@ -920,6 +921,10 @@ int configure(JsonObject params, JsonObject result) {
}
else if (strcmp(it.key().c_str(), "mqttsampletime") == 0) {
writable_configuration.report_seconds = it.value().as<unsigned int>();
writable_configuration.transmit_seconds = writable_configuration.report_seconds;
}
else if (strcmp(it.key().c_str(), "mqtttxtime") == 0) {
writable_configuration.transmit_seconds = it.value().as<unsigned int>();
}
else if (strcmp(it.key().c_str(), "mqttuser") == 0) {
strncpy(writable_configuration.mqtt_username, it.value().as<const char*>(), MQTT_USERNAME_LENGTH);
Expand Down

0 comments on commit f6c823f

Please sign in to comment.