1
0
forked from me/IronOS

Fix bug in tip -> F logic

This commit is contained in:
Ben V. Brown
2020-12-29 12:40:30 +11:00
parent 34226ebcdb
commit 7ea6d4afbd
3 changed files with 8 additions and 13 deletions

View File

@@ -160,14 +160,14 @@ uint32_t TipThermoModel::convertuVToDegF(uint32_t tipuVDelta) {
uint32_t TipThermoModel::convertCtoF(uint32_t degC) { uint32_t TipThermoModel::convertCtoF(uint32_t degC) {
//(Y °C × 9/5) + 32 =Y°F //(Y °C × 9/5) + 32 =Y°F
return (32 + ((degC * 9) / 5));
return (320 + ((degC * 90) / 5))/10;
} }
uint32_t TipThermoModel::convertFtoC(uint32_t degF) { uint32_t TipThermoModel::convertFtoC(uint32_t degF) {
//(Y°F 32) × 5/9 = Y°C //(Y°F 32) × 5/9 = Y°C
if (degF < 32) if (degF < 32) {
return 0; return 0;
}
return ((degF - 32) * 5) / 9; return ((degF - 32) * 5) / 9;
} }
#endif #endif
@@ -185,10 +185,8 @@ uint32_t TipThermoModel::getTipInC(bool sampleNow) {
} }
#ifdef ENABLED_FAHRENHEIT_SUPPORT #ifdef ENABLED_FAHRENHEIT_SUPPORT
uint32_t TipThermoModel::getTipInF(bool sampleNow) { uint32_t TipThermoModel::getTipInF(bool sampleNow) {
uint32_t currentTipTempInF = TipThermoModel::convertTipRawADCToDegF( uint32_t currentTipTempInF = getTipInC(sampleNow);
getTipRawTemp(sampleNow)); currentTipTempInF = convertCtoF(currentTipTempInF);
currentTipTempInF += convertCtoF(getHandleTemperature() / 10); //Add handle offset
currentTipTempInF += x10WattHistory.average() / 45; // 25 * 9 / 5, see getTipInC
return currentTipTempInF; return currentTipTempInF;
} }
#endif #endif

View File

@@ -11,10 +11,7 @@
#include "stdint.h" #include "stdint.h"
extern const uint8_t USER_FONT_12[]; extern const uint8_t USER_FONT_12[];
extern const uint8_t USER_FONT_6x8[]; extern const uint8_t USER_FONT_6x8[];
/*
* When SettingsShortNameType is SHORT_NAME_SINGLE_LINE
* use SettingsShortNames as SettingsShortNames[16][1].. second column undefined
*/
extern const char *SettingsShortNames[29][2]; extern const char *SettingsShortNames[29][2];
extern const char *SettingsDescriptions[29]; extern const char *SettingsDescriptions[29];
extern const char *SettingsMenuEntries[4]; extern const char *SettingsMenuEntries[4];

View File

@@ -66,7 +66,7 @@ void gui_drawTipTemp(bool symbol) {
Temp = TipThermoModel::getTipInC(); Temp = TipThermoModel::getTipInC();
} }
OLED::printNumber(Temp, 3); // Draw the tip temp out finally OLED::printNumber(Temp, 3); // Draw the tip temp out
if (symbol) { if (symbol) {
if (OLED::getFont() == 0) { if (OLED::getFont() == 0) {
// Big font, can draw nice symbols // Big font, can draw nice symbols