mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Tip res =0 protection
This commit is contained in:
@@ -48,8 +48,12 @@ uint32_t availableW10(uint8_t sample) {
|
|||||||
// P = V^2 / R, v*v = v^2 * 100
|
// P = V^2 / R, v*v = v^2 * 100
|
||||||
// R = R*10
|
// R = R*10
|
||||||
// P therefore is in V^2*100/R*10 = W*10.
|
// P therefore is in V^2*100/R*10 = W*10.
|
||||||
uint32_t v = getInputVoltageX10(getSettingValue(SettingsOptions::VoltageDiv), sample); // 100 = 10v
|
uint32_t v = getInputVoltageX10(getSettingValue(SettingsOptions::VoltageDiv), sample); // 100 = 10v
|
||||||
uint32_t availableWattsX10 = (v * v) / getTipResitanceX10();
|
uint32_t tipResistance = getTipResitanceX10();
|
||||||
|
if (tipResistance == 0) {
|
||||||
|
return 100; // say 100 watt to force scale down
|
||||||
|
}
|
||||||
|
uint32_t availableWattsX10 = (v * v) / tipResistance;
|
||||||
// However, 100% duty cycle is not possible as there is a dead time while the ADC takes a reading
|
// However, 100% duty cycle is not possible as there is a dead time while the ADC takes a reading
|
||||||
// Therefore need to scale available milliwats by this
|
// Therefore need to scale available milliwats by this
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user