Convert sleep time from minutes to milliseconds
This commit is contained in:
@@ -20,6 +20,6 @@ void initialize_config(Config *config, JsonDocument json);
|
|||||||
|
|
||||||
bool load_config_file(const char *file_path, Config *config);
|
bool load_config_file(const char *file_path, Config *config);
|
||||||
|
|
||||||
long minutes_to_microseconds(int minutes);
|
long minutes_to_milliseconds(int minutes);
|
||||||
|
|
||||||
#endif // CONFIG_H_
|
#endif // CONFIG_H_
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ void initialize_config(Config *config, JsonDocument json) {
|
|||||||
config->topic = strdup(json["mqtt_topic"]);
|
config->topic = strdup(json["mqtt_topic"]);
|
||||||
config->device_id = strdup(json["device_id"]);
|
config->device_id = strdup(json["device_id"]);
|
||||||
config->mqtt_port = json["mqtt_port"];
|
config->mqtt_port = json["mqtt_port"];
|
||||||
config->sleep_time = minutes_to_microseconds(json["sleep_time"]);
|
config->sleep_time = minutes_to_milliseconds(json["sleep_time"]);
|
||||||
config->connection_attempts = json["connection_attempts"];
|
config->connection_attempts = json["connection_attempts"];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -28,4 +28,4 @@ bool load_config_file(const char *file_path, Config *config) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
long minutes_to_microseconds(int minutes) { return (minutes * 6e7); }
|
long minutes_to_milliseconds(int minutes) { return (minutes * 6e4); }
|
||||||
|
|||||||
Reference in New Issue
Block a user