Change thermal defaults
Some checks are pending
Build / build-mac (push) Waiting to run
Build / build-linux (push) Waiting to run
Build / build-win (push) Waiting to run
CodeQL / Analyze (push) Waiting to run

This commit is contained in:
Andrea Mazzoleni 2025-10-17 09:12:21 +02:00
parent e00342557e
commit 6c1421f5a0
7 changed files with 16 additions and 21 deletions

View file

@ -1193,9 +1193,9 @@ void state_config(struct snapraid_state* state, const char* path, const char* co
exit(EXIT_FAILURE);
/* LCOV_EXCL_STOP */
}
if (time < 5 || time > 120) {
if (time < 3 || time > 120) {
/* LCOV_EXCL_START */
log_fatal("Invalid 'temp_sleep' temperature specification in '%s' at line %u. It must be between 5 and 120\n", path, line);
log_fatal("Invalid 'temp_sleep' temperature specification in '%s' at line %u. It must be between 3 and 120\n", path, line);
exit(EXIT_FAILURE);
/* LCOV_EXCL_STOP */
}

View file

@ -51,8 +51,8 @@ struct snapraid_thermal_params fit_thermal_model(const struct snapraid_thermal_p
model.t_ambient = t_ambient;
/* at least three points to have a result */
if (n_points < 3)
/* at least four points to have a result */
if (n_points < 4)
return model;
double last_temp = points[n_points - 1].temperature;
@ -220,7 +220,6 @@ void state_thermal(struct snapraid_state* state, time_t now)
struct snapraid_thermal* found;
devinfo_t* devinfo = i->data;
unsigned k;
unsigned count;
int temperature = smart_temp(devinfo);
if (temperature < 0)
@ -255,27 +254,23 @@ void state_thermal(struct snapraid_state* state, time_t now)
if (found->count + 1 >= THERMAL_MAX) /* keep one extra space at the end */
continue;
/* only monotone temperature */
if (found->count > 0 && found->data[found->count - 1].temperature > temperature)
/* only monotone increasing temperature */
if (found->count > 0 && found->data[found->count - 1].temperature >= temperature)
continue;
/* insert the new data point */
found->data[found->count].temperature = temperature;
found->data[found->count].time = now - state->thermal_first;
/* if it's a new temperature, store it, otherwise have it ovewritten the next time */
count = found->count + 1;
if (found->count == 0 || found->data[found->count - 1].temperature < temperature)
found->count = count;
++found->count;
/* log the new data */
log_tag("thermal:heat:%s:%" PRIu64 ":%u:", devinfo->name, devinfo->device, count);
for (k = 0; k < count; ++k)
log_tag("thermal:heat:%s:%" PRIu64 ":%u:", devinfo->name, devinfo->device, found->count);
for (k = 0; k < found->count; ++k)
log_tag("%s%d/%d", k > 0 ? "," : "", (int)found->data[k].temperature, (int)found->data[k].time);
log_tag("\n");
/* estimate parameters */
found->params = fit_thermal_model(found->data, count, state->thermal_ambient_temperature);
found->params = fit_thermal_model(found->data, found->count, state->thermal_ambient_temperature);
log_tag("thermal:params:%s:%" PRIu64 ":%g:%g:%g:%g:%g:%g\n", devinfo->name, devinfo->device,
found->params.k_heat, found->params.t_ambient, found->params.t_steady,
@ -309,7 +304,7 @@ void state_thermal_cooldown(struct snapraid_state* state)
unsigned sleep_time = state->thermal_cooldown_time;
if (sleep_time == 0)
sleep_time = 15 * 60; /* default sleep time */
sleep_time = 5 * 60; /* default sleep time */
if (sleep_time < 5 * 60)
sleep_time = 5 * 60; /* minimum sleep time */

View file

@ -26,7 +26,7 @@
/**
* Period of temperature measures
*/
#define THERMAL_PERIOD_SECONDS 60
#define THERMAL_PERIOD_SECONDS 30
/**
* Max number of temperature measures