mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
PID rework - use watts
This commit is contained in:
@@ -116,9 +116,8 @@ enum TipType {
|
||||
#endif
|
||||
|
||||
uint16_t getHandleTemperature();
|
||||
uint16_t getTipRawTemp(uint8_t instant);
|
||||
uint16_t getTipRawTemp(uint8_t refresh);
|
||||
uint16_t getInputVoltageX10(uint16_t divisor);
|
||||
uint16_t getTipInstantTemperature();
|
||||
uint8_t getTipPWM();
|
||||
void setTipPWM(uint8_t pulse);
|
||||
uint16_t ctoTipMeasurement(uint16_t temp);
|
||||
@@ -128,8 +127,8 @@ uint16_t tipMeasurementToF(uint16_t raw);
|
||||
void seekQC(int16_t Vx10,uint16_t divisor);
|
||||
void setCalibrationOffset(int16_t offSet);
|
||||
void setTipType(enum TipType tipType, uint8_t manualCalGain);
|
||||
uint32_t calculateTipR(uint8_t useFilter);
|
||||
int16_t calculateMaxVoltage(uint8_t useFilter, uint8_t useHP);
|
||||
uint32_t calculateTipR();
|
||||
int16_t calculateMaxVoltage(uint8_t useHP);
|
||||
void startQC(uint16_t divisor); // Tries to negotiate QC for highest voltage, must be run after
|
||||
// RToS
|
||||
// This will try for 12V, failing that 9V, failing that 5V
|
||||
|
||||
41
workspace/TS100/inc/history.hpp
Normal file
41
workspace/TS100/inc/history.hpp
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* history.hpp
|
||||
*
|
||||
* Created on: 28 Oct, 2018
|
||||
* Authors: Ben V. Brown, David Hilton
|
||||
*/
|
||||
|
||||
#ifndef HISTORY_HPP_
|
||||
#define HISTORY_HPP_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// max size = 127
|
||||
template <class T=uint16_t, uint8_t SIZE=15>
|
||||
struct history {
|
||||
static const uint8_t size = SIZE;
|
||||
T buf[size];
|
||||
int32_t sum;
|
||||
uint8_t loc;
|
||||
|
||||
void update(T const val) {
|
||||
// step backwards so i+1 is the previous value.
|
||||
loc = (size+loc-1) % size;
|
||||
|
||||
sum -= buf[loc];
|
||||
sum += val;
|
||||
buf[loc] = val;
|
||||
}
|
||||
|
||||
T operator[] (uint8_t i) const {
|
||||
// 0 = newest, size-1 = oldest.
|
||||
i = (i+loc) % size;
|
||||
return buf[i];
|
||||
}
|
||||
|
||||
T average() const {
|
||||
return sum / size;
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* HISTORY_HPP_ */
|
||||
21
workspace/TS100/inc/power.hpp
Normal file
21
workspace/TS100/inc/power.hpp
Normal file
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Power.hpp
|
||||
*
|
||||
* Created on: 28 Oct, 2018
|
||||
* Authors: Ben V. Brown, David Hilton
|
||||
*/
|
||||
|
||||
#include "stdint.h"
|
||||
#include <history.hpp>
|
||||
|
||||
#ifndef POWER_HPP_
|
||||
#define POWER_HPP_
|
||||
|
||||
extern history<uint16_t, 75> milliWattHistory;
|
||||
|
||||
int32_t tempToMilliWatts(int32_t rawTemp, uint16_t mass, uint8_t rawC);
|
||||
void setTipMilliWatts(int32_t mw);
|
||||
uint8_t milliWattsToPWM(int32_t milliWatts, uint8_t divisor);
|
||||
int32_t PWMToMilliWatts(uint8_t pwm, uint8_t divisor);
|
||||
|
||||
#endif /* POWER_HPP_ */
|
||||
Reference in New Issue
Block a user