Unit - Fahrenheit support in language translations
°F Fahrenheit - You will find the default Fahrenheit configuration in the translation_xx.json If tempUnitFahrenheit is set to: true - you can switch in menu settings to Fahrenheit or Celsius. false - you see only Celsius. All settings are then is in Celsius only.
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -66,6 +66,9 @@ ci/secrets/unencrypted/
|
|||||||
codeship.aes
|
codeship.aes
|
||||||
.vscode/settings.json
|
.vscode/settings.json
|
||||||
|
|
||||||
|
# Auto generated files
|
||||||
|
workspace/TS100/Core/Src/Translation.cpp
|
||||||
|
workspace/TS100/Core/Inc/unit.h
|
||||||
# IDE configs
|
# IDE configs
|
||||||
.vs/*
|
.vs/*
|
||||||
.settings/*
|
.settings/*
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import re
|
|||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
TRANSLATION_CPP = "Translation.cpp"
|
TRANSLATION_CPP = "Translation.cpp"
|
||||||
|
UNIT_H = "unit.h"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
to_unicode = unicode
|
to_unicode = unicode
|
||||||
@@ -32,6 +33,7 @@ def loadJson(fileName, skipFirstLine):
|
|||||||
# Reading all language translations into a dictionary by langCode
|
# Reading all language translations into a dictionary by langCode
|
||||||
def readTranslations(jsonDir):
|
def readTranslations(jsonDir):
|
||||||
langDict = {}
|
langDict = {}
|
||||||
|
UnitDict = {}
|
||||||
|
|
||||||
# Read all translation files from the input dir
|
# Read all translation files from the input dir
|
||||||
for fileName in os.listdir(jsonDir):
|
for fileName in os.listdir(jsonDir):
|
||||||
@@ -56,14 +58,19 @@ def readTranslations(jsonDir):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
langCodeFromJson = "(missing)"
|
langCodeFromJson = "(missing)"
|
||||||
|
|
||||||
|
try:
|
||||||
|
TempUnitF_FromJson = lang['tempUnitFahrenheit']
|
||||||
|
except KeyError:
|
||||||
|
TempUnitF_FromJson = True # Default to true.
|
||||||
|
|
||||||
# ...cause they should be the same!
|
# ...cause they should be the same!
|
||||||
if langCode != langCodeFromJson:
|
if langCode != langCodeFromJson:
|
||||||
raise ValueError("Invalid languageCode " + langCodeFromJson +
|
raise ValueError("Invalid languageCode " + langCodeFromJson +
|
||||||
" in file " + fileName)
|
" in file " + fileName)
|
||||||
|
|
||||||
langDict[langCode] = lang
|
langDict[langCode] = lang
|
||||||
|
UnitDict[langCode] = TempUnitF_FromJson
|
||||||
return langDict
|
return langDict, UnitDict
|
||||||
|
|
||||||
|
|
||||||
def writeStart(f):
|
def writeStart(f):
|
||||||
@@ -78,6 +85,23 @@ def writeStart(f):
|
|||||||
"""))
|
"""))
|
||||||
|
|
||||||
|
|
||||||
|
def writeStartUnit(f):
|
||||||
|
f.write(
|
||||||
|
to_unicode(
|
||||||
|
"""// WARNING: THIS FILE WAS AUTO GENERATED BY make_translation.py. PLEASE DO NOT EDIT.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* °F Fahrenheit Support
|
||||||
|
* You will find the default Fahrenheit configuration in the translation_xx.json
|
||||||
|
* If tempUnitFahrenheit is set to:
|
||||||
|
* true - you can switch in menu settings to Fahrenheit or Celsius.
|
||||||
|
* false - you see only Celsius. All settings are then is in Celsius only.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _UNIT_H
|
||||||
|
#define _UNIT_H\n
|
||||||
|
"""))
|
||||||
|
|
||||||
def escapeC(s):
|
def escapeC(s):
|
||||||
return s.replace("\"", "\\\"")
|
return s.replace("\"", "\\\"")
|
||||||
|
|
||||||
@@ -453,6 +477,22 @@ def writeLanguage(languageCode, defs, f):
|
|||||||
# ----- Block end
|
# ----- Block end
|
||||||
f.write(to_unicode("#endif\n"))
|
f.write(to_unicode("#endif\n"))
|
||||||
|
|
||||||
|
|
||||||
|
def writeUnit(languageCode, defs, f, UnitCodes):
|
||||||
|
print("Generating unit block for " + languageCode)
|
||||||
|
lang = langDict[languageCode]
|
||||||
|
unit = UnitDict[UnitCodes]
|
||||||
|
try:
|
||||||
|
langName = lang['languageLocalName']
|
||||||
|
except KeyError:
|
||||||
|
langName = languageCode
|
||||||
|
f.write(to_unicode(" #ifdef LANG_" + languageCode + "\n"))
|
||||||
|
if unit:
|
||||||
|
f.write(to_unicode(" #define ENABLED_FAHRENHEIT_SUPPORT" + "\n"))
|
||||||
|
else: f.write(to_unicode(" //#define ENABLED_FAHRENHEIT_SUPPORT" + "\n"))
|
||||||
|
# ----- Block end
|
||||||
|
f.write(to_unicode(" #endif /* ---- " + langName + " ---- */\n"))
|
||||||
|
|
||||||
def readVersion():
|
def readVersion():
|
||||||
with open(os.path.relpath(jsonDir +
|
with open(os.path.relpath(jsonDir +
|
||||||
"/../workspace/TS100/version.h"),"r") as version_file:
|
"/../workspace/TS100/version.h"),"r") as version_file:
|
||||||
@@ -473,7 +513,8 @@ def readVersion():
|
|||||||
def read_opts():
|
def read_opts():
|
||||||
""" Reading input parameters
|
""" Reading input parameters
|
||||||
First parameter = json directory
|
First parameter = json directory
|
||||||
Second parameter = target directory
|
Second parameter = translation directory
|
||||||
|
Third paramter = unit directory
|
||||||
"""
|
"""
|
||||||
if len(sys.argv) > 1:
|
if len(sys.argv) > 1:
|
||||||
jsonDir = sys.argv[1]
|
jsonDir = sys.argv[1]
|
||||||
@@ -481,15 +522,21 @@ def read_opts():
|
|||||||
jsonDir = "."
|
jsonDir = "."
|
||||||
|
|
||||||
if len(sys.argv) > 2:
|
if len(sys.argv) > 2:
|
||||||
outFile = sys.argv[2]
|
outFileTranslationCPP = sys.argv[2]
|
||||||
else:
|
else:
|
||||||
outDir = os.path.relpath(jsonDir + "/../workspace/TS100/Core/Src")
|
outDir = os.path.relpath(jsonDir + "/../workspace/TS100/Core/Src")
|
||||||
outFile = os.path.join(outDir, TRANSLATION_CPP)
|
outFileTranslationCPP = os.path.join(outDir, TRANSLATION_CPP)
|
||||||
|
|
||||||
if len(sys.argv) > 3:
|
if len(sys.argv) > 3:
|
||||||
|
outFileUnitH = sys.argv[3]
|
||||||
|
else:
|
||||||
|
outDir = os.path.relpath(jsonDir + "/../workspace/TS100/Core/Inc")
|
||||||
|
outFileUnitH = os.path.join(outDir,UNIT_H)
|
||||||
|
|
||||||
|
if len(sys.argv) > 4:
|
||||||
raise Exception("Too many parameters!")
|
raise Exception("Too many parameters!")
|
||||||
|
|
||||||
return jsonDir, outFile
|
return jsonDir, outFileTranslationCPP, outFileUnitH
|
||||||
|
|
||||||
|
|
||||||
def orderOutput(langDict):
|
def orderOutput(langDict):
|
||||||
@@ -507,17 +554,22 @@ def orderOutput(langDict):
|
|||||||
return mandatoryOrder
|
return mandatoryOrder
|
||||||
|
|
||||||
|
|
||||||
def writeTarget(outFile, defs, langCodes):
|
def writeTarget(outFileTranslationCPP, outFileUnitH, defs, langCodes, UnitCodes):
|
||||||
# Start writing the file
|
# Start writing the file
|
||||||
with io.open(outFile, 'w', encoding='utf-8', newline="\n") as f:
|
with io.open(outFileTranslationCPP, 'w', encoding='utf-8', newline="\n") as f:
|
||||||
writeStart(f)
|
writeStart(f)
|
||||||
|
|
||||||
for langCode in langCodes:
|
for langCode in langCodes:
|
||||||
writeLanguage(langCode, defs, f)
|
writeLanguage(langCode, defs, f)
|
||||||
|
|
||||||
|
with io.open(outFileUnitH, 'w', encoding='utf-8', newline="\n") as f:
|
||||||
|
writeStartUnit(f)
|
||||||
|
for langCode, UnitCode in zip(langCodes, UnitCodes):
|
||||||
|
writeUnit(langCode, defs, f, UnitCode)
|
||||||
|
f.write(to_unicode("\n#endif /* _UNIT_H */\n"))
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
try:
|
try:
|
||||||
jsonDir, outFile = read_opts()
|
jsonDir, outFileTranslationCPP, outFileUnitH = read_opts()
|
||||||
except:
|
except:
|
||||||
print("usage: make_translation.py {json dir} {cpp dir}")
|
print("usage: make_translation.py {json dir} {cpp dir}")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
@@ -526,11 +578,13 @@ if __name__ == "__main__":
|
|||||||
except: print("error: could not get/extract build version"); sys.exit(1)
|
except: print("error: could not get/extract build version"); sys.exit(1)
|
||||||
|
|
||||||
print("Build version: " + buildVersion)
|
print("Build version: " + buildVersion)
|
||||||
print("Making " + outFile + " from " + jsonDir)
|
print("Making " + outFileTranslationCPP + " from " + jsonDir)
|
||||||
|
print("Making " + outFileUnitH + " from " + jsonDir)
|
||||||
|
|
||||||
langDict = readTranslations(jsonDir)
|
langDict, UnitDict = readTranslations(jsonDir)
|
||||||
defs = loadJson(os.path.join(jsonDir, "translations_def.js"), True)
|
defs = loadJson(os.path.join(jsonDir, "translations_def.js"), True)
|
||||||
langCodes = orderOutput(langDict)
|
langCodes = orderOutput(langDict)
|
||||||
writeTarget(outFile, defs, langCodes)
|
UnitCodes = orderOutput(UnitDict)
|
||||||
|
writeTarget(outFileTranslationCPP, outFileUnitH, defs, langCodes, UnitCodes)
|
||||||
|
|
||||||
print("Done")
|
print("Done")
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
"languageCode": "DE",
|
"languageCode": "DE",
|
||||||
"languageLocalName": "Deutsch",
|
"languageLocalName": "Deutsch",
|
||||||
"cyrillicGlyphs": false,
|
"cyrillicGlyphs": false,
|
||||||
|
"tempUnitFahrenheit": false,
|
||||||
"messages": {
|
"messages": {
|
||||||
"SettingsCalibrationDone": "Kalibrierung abgeschlossen!",
|
"SettingsCalibrationDone": "Kalibrierung abgeschlossen!",
|
||||||
"SettingsCalibrationWarning": "Vor dem Fortfahren muss die Lötspitze vollständig abgekühlt sein!",
|
"SettingsCalibrationWarning": "Vor dem Fortfahren muss die Lötspitze vollständig abgekühlt sein!",
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
"languageCode": "EN",
|
"languageCode": "EN",
|
||||||
"languageLocalName": "English",
|
"languageLocalName": "English",
|
||||||
"cyrillicGlyphs": false,
|
"cyrillicGlyphs": false,
|
||||||
|
"tempUnitFahrenheit": true,
|
||||||
"messages": {
|
"messages": {
|
||||||
"SettingsCalibrationDone": "Calibration done!",
|
"SettingsCalibrationDone": "Calibration done!",
|
||||||
"SettingsCalibrationWarning": "Please ensure the tip is at room temperature before continuing!",
|
"SettingsCalibrationWarning": "Please ensure the tip is at room temperature before continuing!",
|
||||||
|
|||||||
@@ -11,7 +11,8 @@
|
|||||||
#define SETTINGS_H_
|
#define SETTINGS_H_
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "stm32f1xx_hal.h"
|
#include "stm32f1xx_hal.h"
|
||||||
#define SETTINGSVERSION ( 0x1D )
|
#include "unit.h"
|
||||||
|
#define SETTINGSVERSION ( 0x1E )
|
||||||
/*Change this if you change the struct below to prevent people getting \
|
/*Change this if you change the struct below to prevent people getting \
|
||||||
out of sync*/
|
out of sync*/
|
||||||
|
|
||||||
@@ -35,7 +36,9 @@ typedef struct {
|
|||||||
// down screen until its <50C
|
// down screen until its <50C
|
||||||
uint8_t detailedIDLE :1; // Detailed idle screen
|
uint8_t detailedIDLE :1; // Detailed idle screen
|
||||||
uint8_t detailedSoldering :1; // Detailed soldering screens
|
uint8_t detailedSoldering :1; // Detailed soldering screens
|
||||||
|
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||||
uint8_t temperatureInF; // Should the temp be in F or C (true is F)
|
uint8_t temperatureInF; // Should the temp be in F or C (true is F)
|
||||||
|
#endif
|
||||||
uint8_t descriptionScrollSpeed :1; // Description scroll speed
|
uint8_t descriptionScrollSpeed :1; // Description scroll speed
|
||||||
uint16_t voltageDiv; // Voltage divisor factor
|
uint16_t voltageDiv; // Voltage divisor factor
|
||||||
uint16_t BoostTemp; // Boost mode set point for the iron
|
uint16_t BoostTemp; // Boost mode set point for the iron
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
#ifndef TRANSLATION_H_
|
#ifndef TRANSLATION_H_
|
||||||
#define TRANSLATION_H_
|
#define TRANSLATION_H_
|
||||||
#include "stm32f1xx_hal.h"
|
#include "stm32f1xx_hal.h"
|
||||||
|
#include "unit.h"
|
||||||
enum ShortNameType {
|
enum ShortNameType {
|
||||||
SHORT_NAME_SINGLE_LINE = 1, SHORT_NAME_DOUBLE_LINE = 2,
|
SHORT_NAME_SINGLE_LINE = 1, SHORT_NAME_DOUBLE_LINE = 2,
|
||||||
};
|
};
|
||||||
@@ -64,7 +65,9 @@ extern const char *SymbolMinus;
|
|||||||
extern const char *SymbolSpace;
|
extern const char *SymbolSpace;
|
||||||
extern const char *SymbolDot;
|
extern const char *SymbolDot;
|
||||||
extern const char *SymbolDegC;
|
extern const char *SymbolDegC;
|
||||||
extern const char *SymbolDegF;
|
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||||
|
extern const char *SymbolDegF;
|
||||||
|
#endif
|
||||||
extern const char *SymbolMinutes;
|
extern const char *SymbolMinutes;
|
||||||
extern const char *SymbolSeconds;
|
extern const char *SymbolSeconds;
|
||||||
extern const char *SymbolWatts;
|
extern const char *SymbolWatts;
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#include "FreeRTOS.h"
|
#include "FreeRTOS.h"
|
||||||
#include "stm32f1xx_hal.h"
|
#include "stm32f1xx_hal.h"
|
||||||
#include "cmsis_os.h"
|
#include "cmsis_os.h"
|
||||||
|
#include "unit.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -124,7 +125,9 @@ void setTipPWM(uint8_t pulse);
|
|||||||
uint16_t ctoTipMeasurement(uint16_t temp);
|
uint16_t ctoTipMeasurement(uint16_t temp);
|
||||||
uint16_t tipMeasurementToC(uint16_t raw);
|
uint16_t tipMeasurementToC(uint16_t raw);
|
||||||
uint16_t ftoTipMeasurement(uint16_t temp);
|
uint16_t ftoTipMeasurement(uint16_t temp);
|
||||||
|
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||||
uint16_t tipMeasurementToF(uint16_t raw);
|
uint16_t tipMeasurementToF(uint16_t raw);
|
||||||
|
#endif
|
||||||
void seekQC(int16_t Vx10, uint16_t divisor);
|
void seekQC(int16_t Vx10, uint16_t divisor);
|
||||||
void setCalibrationOffset(int16_t offSet);
|
void setCalibrationOffset(int16_t offSet);
|
||||||
void setTipType(enum TipType tipType, uint8_t manualCalGain);
|
void setTipType(enum TipType tipType, uint8_t manualCalGain);
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
#include "stm32f1xx_hal.h"
|
#include "stm32f1xx_hal.h"
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
#include "TipThermoModel.h"
|
#include "TipThermoModel.h"
|
||||||
|
#include "unit.h"
|
||||||
#include "../../configuration.h"
|
#include "../../configuration.h"
|
||||||
|
|
||||||
extern uint8_t PCBVersion;
|
extern uint8_t PCBVersion;
|
||||||
@@ -58,25 +59,30 @@ void GUIDelay() {
|
|||||||
void gui_drawTipTemp(bool symbol) {
|
void gui_drawTipTemp(bool symbol) {
|
||||||
// Draw tip temp handling unit conversion & tolerance near setpoint
|
// Draw tip temp handling unit conversion & tolerance near setpoint
|
||||||
uint16_t Temp = 0;
|
uint16_t Temp = 0;
|
||||||
|
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||||
if (systemSettings.temperatureInF)
|
if (systemSettings.temperatureInF)
|
||||||
Temp = TipThermoModel::getTipInF();
|
Temp = TipThermoModel::getTipInF();
|
||||||
else
|
else
|
||||||
Temp = TipThermoModel::getTipInC();
|
#endif
|
||||||
|
Temp = TipThermoModel::getTipInC();
|
||||||
|
|
||||||
OLED::printNumber(Temp, 3); // Draw the tip temp out finally
|
OLED::printNumber(Temp, 3); // Draw the tip temp out finally
|
||||||
if (symbol) {
|
if (symbol) {
|
||||||
if (OLED::getFont() == 0) {
|
if (OLED::getFont() == 0) {
|
||||||
//Big font, can draw nice symbols
|
//Big font, can draw nice symbols
|
||||||
if (systemSettings.temperatureInF)
|
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||||
OLED::drawSymbol(0);
|
if (systemSettings.temperatureInF)
|
||||||
else
|
OLED::drawSymbol(0);
|
||||||
OLED::drawSymbol(1);
|
else
|
||||||
|
#endif
|
||||||
|
OLED::drawSymbol(1);
|
||||||
} else {
|
} else {
|
||||||
//Otherwise fall back to chars
|
//Otherwise fall back to chars
|
||||||
if (systemSettings.temperatureInF)
|
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||||
OLED::print(SymbolDegF);
|
if (systemSettings.temperatureInF)
|
||||||
else
|
OLED::print(SymbolDegF);
|
||||||
|
else
|
||||||
|
#endif
|
||||||
OLED::print(SymbolDegC);
|
OLED::print(SymbolDegC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -320,12 +326,16 @@ case BUTTON_B_LONG:
|
|||||||
- PRESS_ACCEL_INTERVAL_MIN;
|
- PRESS_ACCEL_INTERVAL_MIN;
|
||||||
}
|
}
|
||||||
// constrain between 50-450 C
|
// constrain between 50-450 C
|
||||||
|
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||||
if (systemSettings.temperatureInF) {
|
if (systemSettings.temperatureInF) {
|
||||||
if (systemSettings.SolderingTemp > 850)
|
if (systemSettings.SolderingTemp > 850)
|
||||||
systemSettings.SolderingTemp = 850;
|
systemSettings.SolderingTemp = 850;
|
||||||
if (systemSettings.SolderingTemp < 120)
|
if (systemSettings.SolderingTemp < 120)
|
||||||
systemSettings.SolderingTemp = 120;
|
systemSettings.SolderingTemp = 120;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
if (systemSettings.SolderingTemp > 450)
|
if (systemSettings.SolderingTemp > 450)
|
||||||
systemSettings.SolderingTemp = 450;
|
systemSettings.SolderingTemp = 450;
|
||||||
if (systemSettings.SolderingTemp < 50)
|
if (systemSettings.SolderingTemp < 50)
|
||||||
@@ -348,10 +358,14 @@ case BUTTON_B_LONG:
|
|||||||
|
|
||||||
OLED::print(SymbolSpace);
|
OLED::print(SymbolSpace);
|
||||||
OLED::printNumber(systemSettings.SolderingTemp, 3);
|
OLED::printNumber(systemSettings.SolderingTemp, 3);
|
||||||
|
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||||
if (systemSettings.temperatureInF)
|
if (systemSettings.temperatureInF)
|
||||||
OLED::drawSymbol(0);
|
OLED::drawSymbol(0);
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
OLED::drawSymbol(1);
|
OLED::drawSymbol(1);
|
||||||
|
}
|
||||||
OLED::print(SymbolSpace);
|
OLED::print(SymbolSpace);
|
||||||
#ifdef MODEL_TS80
|
#ifdef MODEL_TS80
|
||||||
if (!OLED::getRotation()) {
|
if (!OLED::getRotation()) {
|
||||||
@@ -382,20 +396,27 @@ static int gui_SolderingSleepingMode(bool stayOff) {
|
|||||||
if (checkVoltageForExit())
|
if (checkVoltageForExit())
|
||||||
return 1; // return non-zero on error
|
return 1; // return non-zero on error
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||||
if (systemSettings.temperatureInF) {
|
if (systemSettings.temperatureInF) {
|
||||||
currentTempTargetDegC = stayOff ? 0 : TipThermoModel::convertFtoC(
|
currentTempTargetDegC = stayOff ? 0 : TipThermoModel::convertFtoC(
|
||||||
min(systemSettings.SleepTemp,
|
min(systemSettings.SleepTemp,
|
||||||
systemSettings.SolderingTemp));
|
systemSettings.SolderingTemp));
|
||||||
} else {
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
currentTempTargetDegC = stayOff ? 0 : min(systemSettings.SleepTemp,
|
currentTempTargetDegC = stayOff ? 0 : min(systemSettings.SleepTemp,
|
||||||
systemSettings.SolderingTemp);
|
systemSettings.SolderingTemp);
|
||||||
}
|
}
|
||||||
// draw the lcd
|
// draw the lcd
|
||||||
uint16_t tipTemp;
|
uint16_t tipTemp;
|
||||||
|
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||||
if (systemSettings.temperatureInF)
|
if (systemSettings.temperatureInF)
|
||||||
tipTemp = TipThermoModel::getTipInF();
|
tipTemp = TipThermoModel::getTipInF();
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
tipTemp = TipThermoModel::getTipInC();
|
tipTemp = TipThermoModel::getTipInC();
|
||||||
|
}
|
||||||
|
|
||||||
OLED::clearScreen();
|
OLED::clearScreen();
|
||||||
OLED::setCursor(0, 0);
|
OLED::setCursor(0, 0);
|
||||||
@@ -405,10 +426,14 @@ static int gui_SolderingSleepingMode(bool stayOff) {
|
|||||||
OLED::setCursor(0, 8);
|
OLED::setCursor(0, 8);
|
||||||
OLED::print(SleepingTipAdvancedString);
|
OLED::print(SleepingTipAdvancedString);
|
||||||
OLED::printNumber(tipTemp, 3);
|
OLED::printNumber(tipTemp, 3);
|
||||||
|
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||||
if (systemSettings.temperatureInF)
|
if (systemSettings.temperatureInF)
|
||||||
OLED::print(SymbolDegF);
|
OLED::print(SymbolDegF);
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
OLED::print(SymbolDegC);
|
OLED::print(SymbolDegC);
|
||||||
|
}
|
||||||
|
|
||||||
OLED::print(SymbolSpace);
|
OLED::print(SymbolSpace);
|
||||||
printVoltage();
|
printVoltage();
|
||||||
@@ -417,10 +442,14 @@ static int gui_SolderingSleepingMode(bool stayOff) {
|
|||||||
OLED::setFont(0);
|
OLED::setFont(0);
|
||||||
OLED::print(SleepingSimpleString);
|
OLED::print(SleepingSimpleString);
|
||||||
OLED::printNumber(tipTemp, 3);
|
OLED::printNumber(tipTemp, 3);
|
||||||
|
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||||
if (systemSettings.temperatureInF)
|
if (systemSettings.temperatureInF)
|
||||||
OLED::drawSymbol(0);
|
OLED::drawSymbol(0);
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
OLED::drawSymbol(1);
|
OLED::drawSymbol(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (systemSettings.ShutdownTime) // only allow shutdown exit if time > 0
|
if (systemSettings.ShutdownTime) // only allow shutdown exit if time > 0
|
||||||
if (lastMovementTime)
|
if (lastMovementTime)
|
||||||
@@ -578,18 +607,25 @@ static void gui_solderingMode(uint8_t jumpToSleep) {
|
|||||||
|
|
||||||
// Update the setpoints for the temperature
|
// Update the setpoints for the temperature
|
||||||
if (boostModeOn) {
|
if (boostModeOn) {
|
||||||
|
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||||
if (systemSettings.temperatureInF)
|
if (systemSettings.temperatureInF)
|
||||||
currentTempTargetDegC = TipThermoModel::convertFtoC(
|
currentTempTargetDegC = TipThermoModel::convertFtoC(
|
||||||
systemSettings.BoostTemp);
|
systemSettings.BoostTemp);
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
currentTempTargetDegC = (systemSettings.BoostTemp);
|
currentTempTargetDegC = (systemSettings.BoostTemp);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||||
if (systemSettings.temperatureInF)
|
if (systemSettings.temperatureInF)
|
||||||
currentTempTargetDegC = TipThermoModel::convertFtoC(
|
currentTempTargetDegC = TipThermoModel::convertFtoC(
|
||||||
systemSettings.SolderingTemp);
|
systemSettings.SolderingTemp);
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
currentTempTargetDegC = (systemSettings.SolderingTemp);
|
currentTempTargetDegC = (systemSettings.SolderingTemp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MODEL_TS100
|
#ifdef MODEL_TS100
|
||||||
|
|||||||
@@ -95,7 +95,9 @@ void resetSettings() {
|
|||||||
systemSettings.BoostTemp = BOOST_TEMP; // default to 400C
|
systemSettings.BoostTemp = BOOST_TEMP; // default to 400C
|
||||||
systemSettings.autoStartMode = AUTO_START_MODE; // Auto start off for safety
|
systemSettings.autoStartMode = AUTO_START_MODE; // Auto start off for safety
|
||||||
systemSettings.coolingTempBlink = COOLING_TEMP_BLINK; // Blink the temperature on the cooling screen when its > 50C
|
systemSettings.coolingTempBlink = COOLING_TEMP_BLINK; // Blink the temperature on the cooling screen when its > 50C
|
||||||
|
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||||
systemSettings.temperatureInF = TEMPERATURE_INF; // default to 0
|
systemSettings.temperatureInF = TEMPERATURE_INF; // default to 0
|
||||||
|
#endif
|
||||||
systemSettings.descriptionScrollSpeed = DESCRIPTION_SCROLL_SPEED; // default to slow
|
systemSettings.descriptionScrollSpeed = DESCRIPTION_SCROLL_SPEED; // default to slow
|
||||||
systemSettings.powerLimitEnable = POWER_LIMIT_ENABLE; // Default to no power limit
|
systemSettings.powerLimitEnable = POWER_LIMIT_ENABLE; // Default to no power limit
|
||||||
systemSettings.CalibrationOffset = CALIBRATION_OFFSET; // the adc offset in uV
|
systemSettings.CalibrationOffset = CALIBRATION_OFFSET; // the adc offset in uV
|
||||||
|
|||||||
@@ -52,9 +52,11 @@ uint32_t TipThermoModel::convertTipRawADCTouV(uint16_t rawADC) {
|
|||||||
uint32_t TipThermoModel::convertTipRawADCToDegC(uint16_t rawADC) {
|
uint32_t TipThermoModel::convertTipRawADCToDegC(uint16_t rawADC) {
|
||||||
return convertuVToDegC(convertTipRawADCTouV(rawADC));
|
return convertuVToDegC(convertTipRawADCTouV(rawADC));
|
||||||
}
|
}
|
||||||
|
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||||
uint32_t TipThermoModel::convertTipRawADCToDegF(uint16_t rawADC) {
|
uint32_t TipThermoModel::convertTipRawADCToDegF(uint16_t rawADC) {
|
||||||
return convertuVToDegF(convertTipRawADCTouV(rawADC));
|
return convertuVToDegF(convertTipRawADCTouV(rawADC));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//Table that is designed to be walked to find the best sample for the lookup
|
//Table that is designed to be walked to find the best sample for the lookup
|
||||||
|
|
||||||
@@ -76,6 +78,7 @@ uint32_t TipThermoModel::convertuVToDegC(uint32_t tipuVDelta) {
|
|||||||
return tipuVDelta;
|
return tipuVDelta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||||
uint32_t TipThermoModel::convertuVToDegF(uint32_t tipuVDelta) {
|
uint32_t TipThermoModel::convertuVToDegF(uint32_t tipuVDelta) {
|
||||||
tipuVDelta *= TIP_GAIN;
|
tipuVDelta *= TIP_GAIN;
|
||||||
tipuVDelta /= 1000;
|
tipuVDelta /= 1000;
|
||||||
@@ -94,6 +97,7 @@ uint32_t TipThermoModel::convertFtoC(uint32_t degF) {
|
|||||||
return 0;
|
return 0;
|
||||||
return ((degF - 32) * 5) / 9;
|
return ((degF - 32) * 5) / 9;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
uint32_t TipThermoModel::getTipInC(bool sampleNow) {
|
uint32_t TipThermoModel::getTipInC(bool sampleNow) {
|
||||||
uint32_t currentTipTempInC = TipThermoModel::convertTipRawADCToDegC(
|
uint32_t currentTipTempInC = TipThermoModel::convertTipRawADCToDegC(
|
||||||
@@ -101,13 +105,14 @@ uint32_t TipThermoModel::getTipInC(bool sampleNow) {
|
|||||||
currentTipTempInC += getHandleTemperature() / 10; //Add handle offset
|
currentTipTempInC += getHandleTemperature() / 10; //Add handle offset
|
||||||
return currentTipTempInC;
|
return currentTipTempInC;
|
||||||
}
|
}
|
||||||
|
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||||
uint32_t TipThermoModel::getTipInF(bool sampleNow) {
|
uint32_t TipThermoModel::getTipInF(bool sampleNow) {
|
||||||
uint32_t currentTipTempInF = TipThermoModel::convertTipRawADCToDegF(
|
uint32_t currentTipTempInF = TipThermoModel::convertTipRawADCToDegF(
|
||||||
getTipRawTemp(sampleNow));
|
getTipRawTemp(sampleNow));
|
||||||
currentTipTempInF += convertCtoF(getHandleTemperature() / 10); //Add handle offset
|
currentTipTempInF += convertCtoF(getHandleTemperature() / 10); //Add handle offset
|
||||||
return currentTipTempInF;
|
return currentTipTempInF;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
uint32_t TipThermoModel::getTipMaxInC() {
|
uint32_t TipThermoModel::getTipMaxInC() {
|
||||||
uint32_t maximumTipTemp = TipThermoModel::convertTipRawADCToDegC(
|
uint32_t maximumTipTemp = TipThermoModel::convertTipRawADCToDegC(
|
||||||
|
|||||||
@@ -9,25 +9,34 @@
|
|||||||
#define SRC_TIPTHERMOMODEL_H_
|
#define SRC_TIPTHERMOMODEL_H_
|
||||||
#include "stdint.h"
|
#include "stdint.h"
|
||||||
#include "hardware.h"
|
#include "hardware.h"
|
||||||
|
#include "unit.h"
|
||||||
class TipThermoModel {
|
class TipThermoModel {
|
||||||
public:
|
public:
|
||||||
//These are the main two functions
|
//These are the main two functions
|
||||||
static uint32_t getTipInC(bool sampleNow = false);
|
static uint32_t getTipInC(bool sampleNow = false);
|
||||||
|
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||||
static uint32_t getTipInF(bool sampleNow = false);
|
static uint32_t getTipInF(bool sampleNow = false);
|
||||||
|
#endif
|
||||||
|
|
||||||
//Calculates the maximum temperature can can be read by the ADC range
|
//Calculates the maximum temperature can can be read by the ADC range
|
||||||
static uint32_t getTipMaxInC();
|
static uint32_t getTipMaxInC();
|
||||||
|
|
||||||
static uint32_t convertTipRawADCToDegC(uint16_t rawADC);
|
static uint32_t convertTipRawADCToDegC(uint16_t rawADC);
|
||||||
|
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||||
static uint32_t convertTipRawADCToDegF(uint16_t rawADC);
|
static uint32_t convertTipRawADCToDegF(uint16_t rawADC);
|
||||||
|
#endif
|
||||||
//Returns the uV of the tip reading before the op-amp compensating for pullups
|
//Returns the uV of the tip reading before the op-amp compensating for pullups
|
||||||
static uint32_t convertTipRawADCTouV(uint16_t rawADC);
|
static uint32_t convertTipRawADCTouV(uint16_t rawADC);
|
||||||
|
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||||
static uint32_t convertCtoF(uint32_t degC);
|
static uint32_t convertCtoF(uint32_t degC);
|
||||||
static uint32_t convertFtoC(uint32_t degF);
|
static uint32_t convertFtoC(uint32_t degF);
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static uint32_t convertuVToDegC(uint32_t tipuVDelta);
|
static uint32_t convertuVToDegC(uint32_t tipuVDelta);
|
||||||
|
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||||
static uint32_t convertuVToDegF(uint32_t tipuVDelta);
|
static uint32_t convertuVToDegF(uint32_t tipuVDelta);
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SRC_TIPTHERMOMODEL_H_ */
|
#endif /* SRC_TIPTHERMOMODEL_H_ */
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -11,6 +11,7 @@
|
|||||||
#include "main.hpp"
|
#include "main.hpp"
|
||||||
#include "TipThermoModel.h"
|
#include "TipThermoModel.h"
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
|
#include "unit.h"
|
||||||
#include "../../configuration.h"
|
#include "../../configuration.h"
|
||||||
|
|
||||||
extern uint32_t lastButtonTime;
|
extern uint32_t lastButtonTime;
|
||||||
@@ -31,8 +32,10 @@ static void settings_setShutdownTime(void);
|
|||||||
static void settings_displayShutdownTime(void);
|
static void settings_displayShutdownTime(void);
|
||||||
static void settings_setSensitivity(void);
|
static void settings_setSensitivity(void);
|
||||||
static void settings_displaySensitivity(void);
|
static void settings_displaySensitivity(void);
|
||||||
|
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||||
static void settings_setTempF(void);
|
static void settings_setTempF(void);
|
||||||
static void settings_displayTempF(void);
|
static void settings_displayTempF(void);
|
||||||
|
#endif
|
||||||
static void settings_setAdvancedSolderingScreens(void);
|
static void settings_setAdvancedSolderingScreens(void);
|
||||||
static void settings_displayAdvancedSolderingScreens(void);
|
static void settings_displayAdvancedSolderingScreens(void);
|
||||||
static void settings_setAdvancedIDLEScreens(void);
|
static void settings_setAdvancedIDLEScreens(void);
|
||||||
@@ -168,8 +171,10 @@ const menuitem UIMenu[] = {
|
|||||||
* Cooldown blink
|
* Cooldown blink
|
||||||
* Reverse Temp change buttons + -
|
* Reverse Temp change buttons + -
|
||||||
*/
|
*/
|
||||||
|
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||||
{ (const char*) SettingsDescriptions[5], { settings_setTempF }, {
|
{ (const char*) SettingsDescriptions[5], { settings_setTempF }, {
|
||||||
settings_displayTempF } }, /* Temperature units*/
|
settings_displayTempF } }, /* Temperature units*/
|
||||||
|
#endif
|
||||||
{ (const char*) SettingsDescriptions[7], { settings_setDisplayRotation }, {
|
{ (const char*) SettingsDescriptions[7], { settings_setDisplayRotation }, {
|
||||||
settings_displayDisplayRotation } }, /*Display Rotation*/
|
settings_displayDisplayRotation } }, /*Display Rotation*/
|
||||||
{ (const char*) SettingsDescriptions[11], { settings_setCoolingBlinkEnabled }, {
|
{ (const char*) SettingsDescriptions[11], { settings_setCoolingBlinkEnabled }, {
|
||||||
@@ -354,11 +359,15 @@ static void settings_displayInputPRange(void) {
|
|||||||
#endif
|
#endif
|
||||||
static void settings_setSleepTemp(void) {
|
static void settings_setSleepTemp(void) {
|
||||||
// If in C, 10 deg, if in F 20 deg
|
// If in C, 10 deg, if in F 20 deg
|
||||||
|
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||||
if (systemSettings.temperatureInF) {
|
if (systemSettings.temperatureInF) {
|
||||||
systemSettings.SleepTemp += 20;
|
systemSettings.SleepTemp += 20;
|
||||||
if (systemSettings.SleepTemp > 580)
|
if (systemSettings.SleepTemp > 580)
|
||||||
systemSettings.SleepTemp = 120;
|
systemSettings.SleepTemp = 120;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
systemSettings.SleepTemp += 10;
|
systemSettings.SleepTemp += 10;
|
||||||
if (systemSettings.SleepTemp > 300)
|
if (systemSettings.SleepTemp > 300)
|
||||||
systemSettings.SleepTemp = 50;
|
systemSettings.SleepTemp = 50;
|
||||||
@@ -411,7 +420,7 @@ static void settings_displayShutdownTime(void) {
|
|||||||
OLED::print(SymbolMinutes);
|
OLED::print(SymbolMinutes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||||
static void settings_setTempF(void) {
|
static void settings_setTempF(void) {
|
||||||
systemSettings.temperatureInF = !systemSettings.temperatureInF;
|
systemSettings.temperatureInF = !systemSettings.temperatureInF;
|
||||||
if (systemSettings.temperatureInF) {
|
if (systemSettings.temperatureInF) {
|
||||||
@@ -443,6 +452,7 @@ static void settings_displayTempF(void) {
|
|||||||
|
|
||||||
OLED::print((systemSettings.temperatureInF) ? SymbolDegF : SymbolDegC);
|
OLED::print((systemSettings.temperatureInF) ? SymbolDegF : SymbolDegC);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void settings_setSensitivity(void) {
|
static void settings_setSensitivity(void) {
|
||||||
systemSettings.sensitivity++;
|
systemSettings.sensitivity++;
|
||||||
@@ -557,12 +567,15 @@ static void settings_displayBoostModeEnabled(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void settings_setBoostTemp(void) {
|
static void settings_setBoostTemp(void) {
|
||||||
|
#ifdef ENABLED_FAHRENHEIT_SUPPORT
|
||||||
if (systemSettings.temperatureInF) {
|
if (systemSettings.temperatureInF) {
|
||||||
systemSettings.BoostTemp += 20; // Go up 20F at a time
|
systemSettings.BoostTemp += 20; // Go up 20F at a time
|
||||||
if (systemSettings.BoostTemp > 850) {
|
if (systemSettings.BoostTemp > 850) {
|
||||||
systemSettings.BoostTemp = 480; // loop back at 250
|
systemSettings.BoostTemp = 480; // loop back at 250
|
||||||
}
|
}
|
||||||
} else {
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
systemSettings.BoostTemp += 10; // Go up 10C at a time
|
systemSettings.BoostTemp += 10; // Go up 10C at a time
|
||||||
if (systemSettings.BoostTemp > 450) {
|
if (systemSettings.BoostTemp > 450) {
|
||||||
systemSettings.BoostTemp = 250; // loop back at 250
|
systemSettings.BoostTemp = 250; // loop back at 250
|
||||||
|
|||||||
Reference in New Issue
Block a user