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