mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
With this a TS-I tip is usable with a small netbook 19 V / 30 W PSU with power limit set to 40 W (38.9 W is reported during the heating up stage). Without this the device just reboots on attempt to turn on the heater (unless the power limit is set to 10 or even 5 W). This code doesn't affect maximum power available and allows up to 73 W when a beefy 24 V / 96 W PSU is used. Should be useful for all models, not just TS100. The fixed comments are based on calculations, not measurements! Fixes #693.
29 lines
935 B
C++
29 lines
935 B
C++
/*
|
|
* Power.hpp
|
|
*
|
|
* Created on: 28 Oct, 2018
|
|
* Authors: Ben V. Brown, David Hilton (David's Idea)
|
|
*/
|
|
|
|
#include "stdint.h"
|
|
#include <history.hpp>
|
|
#include "BSP.h"
|
|
#include "expMovingAverage.h"
|
|
#include "../../configuration.h"
|
|
#ifndef POWER_HPP_
|
|
#define POWER_HPP_
|
|
|
|
// thermal mass = 1690 milliJ/*C for my tip.
|
|
// -> Wattsx10*Seconds to raise Temp from room temp to +100*C, divided by 100*C.
|
|
// we divide mass by 20 to let the I term dominate near the set point.
|
|
// This is necessary because of the temp noise and thermal lag in the system.
|
|
// Once we have feed-forward temp estimation we should be able to better tune this.
|
|
|
|
const uint8_t wattHistoryFilter = 24; // I term look back weighting
|
|
extern expMovingAverage<uint32_t, wattHistoryFilter> x10WattHistory;
|
|
|
|
int32_t tempToX10Watts(int32_t rawTemp);
|
|
void setTipX10Watts(int32_t mw);
|
|
uint8_t X10WattsToPWM(int32_t milliWatts, uint8_t sample = 0);
|
|
#endif /* POWER_HPP_ */
|