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:
@@ -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