Implement more aggressive cooling to help with a problem of MacBooks randomly shutting down due to heat.

Changes:
- New temperature-to-fan-speed mapping. The minimal fan speed is 3500 RPM.
- Smoothing of temperature measurements so that short term fluctuations don't result in frequent fan speed updates.
- Don't write the fan setting if it is the same as the last one written.
- Measure temperature every 2 seconds instead of 3.
- When the machine wakes up from sleep, force a fan speed update. This is needed to work around the fact that the fan speed gets reset by the system's sleep.