Convert sleep time from minutes to milliseconds

This commit is contained in:
2025-11-27 13:14:35 +01:00
parent 183882ee41
commit 8c74f99efc
2 changed files with 3 additions and 3 deletions

View File

@@ -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_

View File

@@ -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); }