mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Move to latest HAL release trying to get I2C DMA to be more reliable, and known good point.
Cleans up some redundant calls as well to make some flash room.
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
|
||||
uint8_t tipResistance = 85; //x10 ohms, 8.5 typical for ts100, 4.5 typical for ts80
|
||||
const uint16_t powerPWM = 255;
|
||||
const uint16_t totalPWM = 255 + 65; //htim2.Init.Period, the full PWM cycle
|
||||
const uint16_t totalPWM = 255 + 60; //htim2.Init.Period, the full PWM cycle
|
||||
|
||||
history<uint32_t, oscillationPeriod> milliWattHistory = { { 0 }, 0, 0 };
|
||||
|
||||
@@ -44,9 +44,8 @@ uint8_t milliWattsToPWM(int32_t milliWatts, uint8_t divisor) {
|
||||
int32_t v = getInputVoltageX10(divisor, 1); // 100 = 10v
|
||||
int32_t availableMilliWatts = v * v / tipResistance;
|
||||
|
||||
int32_t pwm = ((powerPWM * totalPWM / powerPWM) * milliWatts)
|
||||
/ availableMilliWatts;
|
||||
|
||||
//int32_t pwm = ((powerPWM * totalPWM / powerPWM) * milliWatts) / availableMilliWatts;
|
||||
int32_t pwm = (totalPWM * milliWatts) / availableMilliWatts;
|
||||
if (pwm > powerPWM) {
|
||||
pwm = powerPWM;
|
||||
} else if (pwm < 0) {
|
||||
|
||||
Reference in New Issue
Block a user