Skip to content

Comments

fix: Latest temperature may be insignificant in average computation#7

Open
clanoftheducks wants to merge 1 commit intoGnomedDev:masterfrom
clanoftheducks:tweak-reaction-time
Open

fix: Latest temperature may be insignificant in average computation#7
clanoftheducks wants to merge 1 commit intoGnomedDev:masterfrom
clanoftheducks:tweak-reaction-time

Conversation

@clanoftheducks
Copy link

The issue

I noticed that t2fanrd was often slower to react to temperature spikes than the 1s poll interval suggests.

I noticed that the following happens (here and following lines):

  1. append the latest temperature temp to the 50 samples / 5 seconds history temps
  2. compute the average temperature mean_temp
  3. in case of upcoming long sleep, appropriately append extra samples of temp to history

At the first poll after a sudden temperature spike (say, 50°C to 90°C in <1s1), the latest temp only contributes 1/50 to the average, and the integer mean_temp may not change. In practice, this often extends the reaction time to two intervals (up to 2s).

Proposed change

When exiting a long sleep, append the extra samples before the average computation, instead of after. In other words, the latest temperature is taken into account for the past long sleep's duration (which is already the case for the short sleep), instead of the next's.

Remark 1: this does not really make the fan settings "more aggressive": in case of a temp spike that does not immediately change the average temp, the same fan spin-up that would occur at T+2, now occurs at T+1.

Remark 2: this marginally increases how often fan speeds are set during ~idle periods, since mean_temp may change more often.

Let me know what you think.

Footnotes

  1. T2 Macs tend to be quite old, and like mine, may have degraded thermal paste that basically render temp hikes instantaneous.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant