1
0
forked from me/IronOS

Degrees D support, New idle logo

This commit is contained in:
Ben V. Brown
2017-10-01 13:30:30 +11:00
parent a0e99374b5
commit bb75817e83
10 changed files with 237 additions and 239 deletions

View File

@@ -29,6 +29,7 @@ typedef struct {
uint8_t boostModeEnabled; //Boost mode swaps BUT_A in soldering mode to temporary soldering temp over-ride
uint8_t coolingTempBlink; //Should the temperature blink on the cool down screen until its <50C
uint8_t advancedScreens; //If enabled we draw more detailed screens with smaller fonts
uint8_t temperatureInF; //Should the temp be in F or C (true is F)
uint16_t voltageDiv; //Voltage divisor factor
uint16_t BoostTemp; //Boost mode set point for the iron
int16_t CalibrationOffset; //This stores the temperature offset for this tip in the iron.

View File

@@ -8,8 +8,8 @@
#ifndef TRANSLATION_H_
#define TRANSLATION_H_
extern const char* SettingsLongNames[13];
extern const char* SettingsShortNames[13];
extern const char* SettingsLongNames[14];
extern const char* SettingsShortNames[14];
extern const char* SettingsCalibrationWarning;
extern const char* UVLOWarningString;
extern const char SettingTrueChar;

View File

@@ -36,8 +36,6 @@ extern "C" {
#define SDA_Pin GPIO_PIN_7
#define SDA_GPIO_Port GPIOB
uint16_t getHandleTemperature();
uint16_t getTipRawTemp(uint8_t instant);
uint16_t getInputVoltageX10();
@@ -46,6 +44,9 @@ uint8_t getTipPWM();
void setTipPWM(uint8_t pulse);
uint16_t ctoTipMeasurement(uint16_t temp);
uint16_t tipMeasurementToC(uint16_t raw);
uint16_t ftoTipMeasurement(uint16_t temp);
uint16_t tipMeasurementToF(uint16_t raw);
void setCalibrationOffset(int16_t offSet);
#ifdef __cplusplus
}

View File

@@ -17,7 +17,7 @@ uint8_t OLED_Setup_Array[] = { /**/
0x80, 0xD5,/*Set display clock divide ratio / osc freq*/
0x80, 0x52,/*Divide ratios*/
0x80, 0xA8,/*Set Multiplex Ratio*/
0x80, 0x0E, /*16 == max brightness,39==dimmest*/
0x80, 0x0E,/*16 == max brightness,39==dimmest*/
0x80, 0xC0,/*Set COM Scan direction*/
0x80, 0xD3,/*Set vertical Display offset*/
0x80, 0x00,/*0 Offset*/
@@ -64,6 +64,10 @@ void OLED::initialize() {
HAL_I2C_Master_Transmit(i2c, DEVICEADDR_OLED, (uint8_t*) OLED_Setup_Array, configLength, 0xFFFF);
//displayOnOff(true);
}
//Write out the buffer to the OLEd & call any rendering objects
void OLED::refresh() {
screenBuffer[0] = 0x80;
screenBuffer[1] = 0x21;
screenBuffer[2] = 0x80;
@@ -78,15 +82,8 @@ void OLED::initialize() {
screenBuffer[10] = 0x80;
screenBuffer[11] = 0x01;
screenBuffer[12] = 0x40;
screenBuffer[12] = 0x40; //start of data marker
}
//Write out the buffer to the OLEd & call any rendering objects
void OLED::refresh() {
screenBuffer[12] = 0x40; // Ensure it never gets overwritten
screenBuffer[3] = inLeftHandedMode ? 0 : 32;
screenBuffer[5] = inLeftHandedMode ? 95 : 0x7F; // It rolls over when it exceeds this number (this is last writable column)
HAL_I2C_Master_Transmit(i2c, DEVICEADDR_OLED, screenBuffer, 12 + 96 * 2 + 1, 0xFFFF);
}
@@ -104,7 +101,7 @@ void OLED::drawChar(char c, char PrecursorCommand) {
*
*/
uint16_t index = 0;
if (!PrecursorCommand)
if (PrecursorCommand == 0)
index = (c - ' ');
else {

View File

@@ -88,6 +88,7 @@ void resetSettings() {
systemSettings.autoStartMode = 0; //Auto start off for safety
systemSettings.coolingTempBlink = 0; //Blink the temperature on the cooling screen when its > 50C
systemSettings.CalibrationOffset = 10;
systemSettings.temperatureInF = 0; //default to 0
saveSettings();
}

View File

@@ -6,7 +6,7 @@
*/
#include "Translation.h"
#define LANG_RU
#define LANG_EN
#define LANG
#ifndef LANG
@@ -18,22 +18,23 @@
#error NO LANGUAGE DEFINED
#endif
#ifdef LANG_EN
const char* SettingsLongNames[13] = {
/*These are all the help text for all the settings.*/
/*No requirements on spacing or length*/
"Power source. Sets cutoff voltage. <DC 10V> <S 3.3V per cell>", //
"Sleep Temperature <C>",//
"Sleep Timeout <Minutes>",//
"Shutdown Timeout <Minutes>",//
"Motion Sensitivity <0.Off 1.least sensitive 9.most sensitive>",//
"Display detailed information in a smaller font.",//
"Display Orientation <A. Automatic L. Left Handed R. Right Handed>",//
"Enable front key enters boost mode 450C mode when soldering",//
"Temperature when in \"boost\" mode",//
"Automatically starts the iron into soldering on power up. T=Soldering, S= Sleep mode,F=Off",//
"Blink the temperature on the cooling screen while the tip is still hot.",//
"Calibrate tip offset.",//s
"Reset all settings",};
const char* SettingsLongNames[14] = {
/*These are all the help text for all the settings.*/
/*No requirements on spacing or length*/
"Power source. Sets cutoff voltage. <DC 10V> <S 3.3V per cell>", //
"Sleep Temperature <C>", //
"Sleep Timeout <Minutes>", //
"Shutdown Timeout <Minutes>", //
"Motion Sensitivity <0.Off 1.least sensitive 9.most sensitive>", //
"Temperature Unit <C=Celsius F=Fahrenheit>", //
"Display detailed information in a smaller font.", //
"Display Orientation <A. Automatic L. Left Handed R. Right Handed>", //
"Enable front key enters boost mode 450C mode when soldering", //
"Temperature when in \"boost\" mode", //
"Automatically starts the iron into soldering on power up. T=Soldering, S= Sleep mode,F=Off", //
"Blink the temperature on the cooling screen while the tip is still hot.", //
"Calibrate tip offset.", //s
"Reset all settings", };
const char* SettingsCalibrationWarning = "Please ensure the tip is at room temperature before continuing!";
const char* UVLOWarningString = "LOW VOLT"; //Fixed width 8 chars
@@ -51,7 +52,7 @@ const char SettingTempFChar = 'F';
#endif
#ifdef LANG_ES
const char* SettingsLongNames[13] = {
const char* SettingsLongNames[14] = {
/*These are all the help text for all the settings.*/
/*All must start with 6 spaces so they come on screen nicely.*/
"Fuente de energía. Ajusta el límite inferior de voltaje. <DC=10V S=3.3V por celda>", //
@@ -84,7 +85,7 @@ const char SettingTempFChar = 'F';
#endif
#ifdef LANG_DE
const char* SettingsLongNames[13] = {
const char* SettingsLongNames[14] = {
/*These are all the help text for all the settings.*/
/*All must start with 6 spaces so they come on screen nicely.*/
"Stromversorgung. Setzt Abschaltspannung <DC=10V S=3.3V pro Zelle>",
@@ -117,7 +118,7 @@ const char SettingTempFChar = 'F';
#endif
#ifdef LANG_FR
const char* SettingsLongNames[13] = {
const char* SettingsLongNames[14] = {
/*These are all the help text for all the settings.*/
/*All must start with 6 spaces so they come on screen nicely.*/
"Type d\'alimentation. Regle la tension de coupure. <DC=10V S=3.3V par cellules>",
@@ -152,7 +153,7 @@ const char SettingTempFChar = 'F';
#endif
#ifdef LANG_IT
const char* SettingsLongNames[13] = {
const char* SettingsLongNames[14] = {
/*These are all the help text for all the settings.*/
"Sorgente di alimentazione. Imposta il limite inferiore di tensione. <DC=10V S=3.3V per cella>",
"Temperatura modalità riposo <C>",
@@ -186,7 +187,7 @@ const char SettingTempFChar = 'F';
#endif
#ifdef LANG_SE
const char* SettingsLongNames[13] = {
const char* SettingsLongNames[14] = {
/*These are all the help text for all the settings.*/
"Stromforsorjning. Satt avstagningsvolt. <VX=10V S=3.3V per cell>",
"Vilolage Temperatur <C>",
@@ -220,23 +221,23 @@ const char SettingTempFChar = 'F';
#endif
#ifdef LANG_RU
const char* SettingsLongNames[13] = {
const char* SettingsLongNames[14] = {
//These are all the help text for all the settings./
"ЀИстЀочник питания. Установка напряжения отключения. <DC 10V> <S 3.3 V на батарею>", "Температура Сна <С>",
"Переход в режим Сна <Минуты>", "Переходит в режим ожидания <Минуты>",
"Акселерометр <0. Выкл. 1. мин. чувствительный 9. макс. чувствительный>",
"Display detailed information in a smaller font.", //
"Ориентация Дисплея <A. Автоматический L. Левая Рука R. Правая Рука>",
"Активация кнопки A для Турбо режима до 450С при пайке ", "Установка температуры для Турбо режима",
"Изменяет стрелки на дисплей питания при пайке",
"Автоматический запуск паяльника при включении питания. T=Нагрев, S=Режим Сна,F=Выкл.",
"Мигает температура на экране охлаждения, пока жало остается горячим.", "Calibrate tip offset.", //s
"Reset all settings", };
"Источник питания. Установка напряжения отключения. <DC 10V> <S 3.3 V на батарею>", "Температура Сна <С>",
"Переход в режим Сна <Минуты>", "Переходит в режим ожидания <Минуты>",
"Акселерометр <0. Выкл. 1. мин. чувствительный 9. макс. чувствительный>",
"Display detailed information in a smaller font.",//
"Ориентация Дисплея <A. Автоматический L. Левая Рука R. Правая Рука>",
"Активация кнопки A для Турбо режима до 450С при пайке ", "Установка температуры для Турбо режима",
"Изменяет стрелки на дисплей питания при пайке",
"Автоматический запуск паяльника при включении питания. T=Нагрев, S=Режим Сна,F=Выкл.",
"Мигает температура на экране охлаждения, пока жало остается горячим.", "Calibrate tip offset.",//s
"Reset all settings",};
const char* SettingsCalibrationWarning = "Please ensure the tip is at room temperature before continuing!";
const char* UVLOWarningString = "Low Volt"; //Fixed width 8 chars
const char* CoolingPromptString = "Выкл. "; //Fixed width 5 chars
const char* CoolingPromptString = "Выкл. ";//Fixed width 5 chars
const char SettingTrueChar = 'T';
const char SettingFalseChar = 'F';
const char SettingSleepChar = 'S';
@@ -250,12 +251,13 @@ const char SettingTempCChar = 'C';
const char SettingTempFChar = 'F';
#endif
const char* SettingsShortNames[13] = { /**/
const char* SettingsShortNames[14] = { /**/
"PWRSC ", // Power Source (DC or batt)
"STMP ", // Sleep Temperature
"STME ", // Sleep Timeout
"SHTME ", // Shutdown Temperature
"MSENSE ", // Motion sensitivity level
"TMPUNT ", //Temp in F and C
"ADVDSP ", // Advanced display mode enable
"DSPROT ", // Display rotation mode
"BOOST ", // Boost enabled

View File

@@ -19,6 +19,8 @@ static void settings_setShutdownTime(void);
static void settings_displayShutdownTime(void);
static void settings_setSensitivity(void);
static void settings_displaySensitivity(void);
static void settings_setTempF(void);
static void settings_displayTempF(void);
static void settings_setAdvancedScreens(void);
static void settings_displayAdvancedScreens(void);
static void settings_setDisplayRotation(void);
@@ -43,14 +45,15 @@ const menuitem settingsMenu[] = { /*Struct used for all settings options in the
{ (const char*) SettingsLongNames[2], { settings_setSleepTime }, { settings_displaySleepTime } }, /*Sleep Time*/
{ (const char*) SettingsLongNames[3], { settings_setShutdownTime }, { settings_displayShutdownTime } }, /*Shutdown Time*/
{ (const char*) SettingsLongNames[4], { settings_setSensitivity }, { settings_displaySensitivity } },/* Motion Sensitivity*/
{ (const char*) SettingsLongNames[5], { settings_setAdvancedScreens }, { settings_displayAdvancedScreens } },/* Advanced screens*/
{ (const char*) SettingsLongNames[6], { settings_setDisplayRotation }, { settings_displayDisplayRotation } }, /**/
{ (const char*) SettingsLongNames[7], { settings_setBoostModeEnabled }, { settings_displayBoostModeEnabled } }, /**/
{ (const char*) SettingsLongNames[8], { settings_setBoostTemp }, { settings_displayBoostTemp } }, /**/
{ (const char*) SettingsLongNames[9], { settings_setAutomaticStartMode }, { settings_displayAutomaticStartMode } },/**/
{ (const char*) SettingsLongNames[10], { settings_setCoolingBlinkEnabled }, { settings_displayCoolingBlinkEnabled } }, /**/
{ (const char*) SettingsLongNames[11], { settings_setCalibrate }, { settings_displayCalibrate } }, /**/
{ (const char*) SettingsLongNames[12], { settings_setResetSettings }, { settings_displayResetSettings } }, /**/
{ (const char*) SettingsLongNames[5], { settings_setTempF }, { settings_displayTempF } },/* Motion Sensitivity*/
{ (const char*) SettingsLongNames[6], { settings_setAdvancedScreens }, { settings_displayAdvancedScreens } },/* Advanced screens*/
{ (const char*) SettingsLongNames[7], { settings_setDisplayRotation }, { settings_displayDisplayRotation } }, /**/
{ (const char*) SettingsLongNames[8], { settings_setBoostModeEnabled }, { settings_displayBoostModeEnabled } }, /**/
{ (const char*) SettingsLongNames[9], { settings_setBoostTemp }, { settings_displayBoostTemp } }, /**/
{ (const char*) SettingsLongNames[10], { settings_setAutomaticStartMode }, { settings_displayAutomaticStartMode } },/**/
{ (const char*) SettingsLongNames[11], { settings_setCoolingBlinkEnabled }, { settings_displayCoolingBlinkEnabled } }, /**/
{ (const char*) SettingsLongNames[12], { settings_setCalibrate }, { settings_displayCalibrate } }, /**/
{ (const char*) SettingsLongNames[13], { settings_setResetSettings }, { settings_displayResetSettings } }, /**/
{ NULL, { NULL }, { NULL } } //end of menu marker. DO NOT REMOVE
};
@@ -101,6 +104,19 @@ static void settings_displayShutdownTime(void) {
lcd.print(SettingsShortNames[3]);
lcd.printNumber(systemSettings.ShutdownTime, 2);
}
static void settings_setTempF(void) {
systemSettings.temperatureInF = !systemSettings.temperatureInF;
}
static void settings_displayTempF(void) {
lcd.print(SettingsShortNames[5]);
if (systemSettings.temperatureInF)
lcd.drawChar('F');
else
lcd.drawChar('C');
}
static void settings_setSensitivity(void) {
systemSettings.sensitivity++;
systemSettings.sensitivity = systemSettings.sensitivity % 10;
@@ -114,7 +130,7 @@ static void settings_setAdvancedScreens(void) {
systemSettings.advancedScreens = !systemSettings.advancedScreens;
}
static void settings_displayAdvancedScreens(void) {
lcd.print(SettingsShortNames[5]);
lcd.print(SettingsShortNames[6]);
if (systemSettings.advancedScreens)
lcd.drawChar('T');
else
@@ -125,7 +141,7 @@ static void settings_setDisplayRotation(void) {
systemSettings.OrientationMode = systemSettings.OrientationMode % 3;
}
static void settings_displayDisplayRotation(void) {
lcd.print(SettingsShortNames[6]);
lcd.print(SettingsShortNames[7]);
switch (systemSettings.OrientationMode) {
case 0:
lcd.drawChar('R');
@@ -143,7 +159,7 @@ static void settings_setBoostModeEnabled(void) {
systemSettings.boostModeEnabled = !systemSettings.boostModeEnabled;
}
static void settings_displayBoostModeEnabled(void) {
lcd.print(SettingsShortNames[7]);
lcd.print(SettingsShortNames[8]);
if (systemSettings.boostModeEnabled)
lcd.drawChar('T');
else
@@ -155,7 +171,7 @@ static void settings_setBoostTemp(void) {
systemSettings.BoostTemp = 250; //loop back at 250
}
static void settings_displayBoostTemp(void) {
lcd.print(SettingsShortNames[8]);
lcd.print(SettingsShortNames[9]);
lcd.printNumber(systemSettings.BoostTemp, 3);
}
static void settings_setAutomaticStartMode(void) {
@@ -163,7 +179,7 @@ static void settings_setAutomaticStartMode(void) {
systemSettings.autoStartMode %= 2;
}
static void settings_displayAutomaticStartMode(void) {
lcd.print(SettingsShortNames[9]);
lcd.print(SettingsShortNames[10]);
switch (systemSettings.autoStartMode) {
case 0:
lcd.drawChar('F');
@@ -179,7 +195,7 @@ static void settings_setCoolingBlinkEnabled(void) {
systemSettings.coolingTempBlink = !systemSettings.coolingTempBlink;
}
static void settings_displayCoolingBlinkEnabled(void) {
lcd.print(SettingsShortNames[10]);
lcd.print(SettingsShortNames[11]);
if (systemSettings.coolingTempBlink)
lcd.drawChar('T');
else
@@ -189,7 +205,7 @@ static void settings_setResetSettings(void) {
settingsResetRequest = !settingsResetRequest;
}
static void settings_displayResetSettings(void) {
lcd.print(SettingsShortNames[12]);
lcd.print(SettingsShortNames[13]);
if (settingsResetRequest)
lcd.drawChar('T');
else
@@ -251,5 +267,5 @@ static void settings_setCalibrate(void) {
}
static void settings_displayCalibrate(void) {
lcd.print(SettingsShortNames[11]);
lcd.print(SettingsShortNames[12]);
}

View File

@@ -6,13 +6,11 @@
*/
//These are all the functions for interacting with the hardware
#include "hardware.h"
volatile uint16_t PWMSafetyTimer = 0;
volatile int16_t CalibrationTempOffset = 0;
void setCalibrationOffset(int16_t offSet)
{
CalibrationTempOffset=offSet;
void setCalibrationOffset(int16_t offSet) {
CalibrationTempOffset = offSet;
}
uint16_t getHandleTemperature() {
// We return the current handle temperature in X10 C
@@ -31,16 +29,26 @@ uint16_t getHandleTemperature() {
}
uint16_t tipMeasurementToC(uint16_t raw) {
return ((raw-532) / 33) + (getHandleTemperature()/10) - CalibrationTempOffset;
return ((raw - 532) / 33) + (getHandleTemperature() / 10) - CalibrationTempOffset;
//Surprisingly that appears to be a fairly good linear best fit
}
uint16_t ctoTipMeasurement(uint16_t temp) {
//We need to compensate for cold junction temp
return ((temp-(getHandleTemperature()/10) + CalibrationTempOffset) * 33)+532;
return ((temp - (getHandleTemperature() / 10) + CalibrationTempOffset) * 33) + 532;
}
uint16_t tipMeasurementToF(uint16_t raw) {
return ((((raw - 532) / 33) + (getHandleTemperature() / 10) - CalibrationTempOffset) * 9) / 5 + 32;
}
uint16_t ftoTipMeasurement(uint16_t temp) {
return (((((temp - 32) * 5) / 9) - (getHandleTemperature() / 10) + CalibrationTempOffset) * 33) + 532;
}
uint16_t getTipInstantTemperature() {
uint16_t sum = 0;
sum += HAL_ADCEx_InjectedGetValue(&hadc1, ADC_INJECTED_RANK_1);
uint16_t sum;
sum = HAL_ADCEx_InjectedGetValue(&hadc1, ADC_INJECTED_RANK_1);
sum += HAL_ADCEx_InjectedGetValue(&hadc1, ADC_INJECTED_RANK_2);
sum += HAL_ADCEx_InjectedGetValue(&hadc1, ADC_INJECTED_RANK_3);
sum += HAL_ADCEx_InjectedGetValue(&hadc1, ADC_INJECTED_RANK_4);
@@ -48,8 +56,10 @@ uint16_t getTipInstantTemperature() {
}
uint16_t getTipRawTemp(uint8_t instant) {
#define filterDepth1 2
#define filterDepth2 8
#define filterDepth1 1
/*Pre filter used before PID*/
#define filterDepth2 8
/*Post filter used for UI display*/
static uint16_t filterLayer1[filterDepth1];
static uint16_t filterLayer2[filterDepth2];
static uint8_t index = 0;
@@ -83,8 +93,7 @@ uint16_t getInputVoltageX10() {
//Ideal term is 57.69.... 58 is quite close
return getADC(1) / 58;
}
uint8_t getTipPWM()
{
uint8_t getTipPWM() {
return htim2.Instance->CCR4;
}
void setTipPWM(uint8_t pulse) {

View File

@@ -194,7 +194,24 @@ static bool checkVoltageForExit() {
}
return false;
}
static void gui_drawBatteryIcon() {
if (systemSettings.cutoutSetting) {
//User is on a lithium battery
//we need to calculate which of the 10 levels they are on
uint8_t cellCount = systemSettings.cutoutSetting + 2;
uint16_t cellV = getInputVoltageX10() / cellCount;
//Should give us approx cell voltage X10
//Range is 42 -> 33 = 9 steps therefore we will use battery 1-10
if (cellV < 33)
cellV = 33;
cellV -= 33; //Should leave us a number of 0-9
if (cellV > 9)
cellV = 9;
lcd.drawBattery(cellV + 1);
} else
lcd.drawChar(' '); //print a blank spot if there is no battery symbol
}
static void gui_solderingTempAdjust() {
uint32_t lastChange = HAL_GetTick();
currentlyActiveTemperatureTarget = 0;
@@ -221,33 +238,46 @@ static void gui_solderingTempAdjust() {
break;
case BUTTON_F_SHORT:
if (lcd.getRotation()) {
systemSettings.SolderingTemp += 10; //add 10C
if (systemSettings.SolderingTemp > 450)
systemSettings.SolderingTemp = 450;
systemSettings.SolderingTemp += 10; //add 10
} else {
systemSettings.SolderingTemp -= 10; //sub 10C
if (systemSettings.SolderingTemp <= 50)
systemSettings.SolderingTemp = 50;
systemSettings.SolderingTemp -= 10; //sub 10
}
break;
case BUTTON_B_SHORT:
if (!lcd.getRotation()) {
systemSettings.SolderingTemp += 10; //add 10C
if (systemSettings.SolderingTemp > 450)
systemSettings.SolderingTemp = 450;
systemSettings.SolderingTemp += 10; //add 10
} else {
systemSettings.SolderingTemp -= 10; //sub 10C
if (systemSettings.SolderingTemp <= 50)
systemSettings.SolderingTemp = 50;
systemSettings.SolderingTemp -= 10; //sub 10
}
break;
}
// constrain between 50-450 C
if (systemSettings.temperatureInF) {
if (systemSettings.SolderingTemp > 850)
systemSettings.SolderingTemp = 850;
} else {
if (systemSettings.SolderingTemp > 450)
systemSettings.SolderingTemp = 450;
}
if (systemSettings.temperatureInF) {
if (systemSettings.SolderingTemp < 120)
systemSettings.SolderingTemp = 120;
} else {
if (systemSettings.SolderingTemp < 50)
systemSettings.SolderingTemp = 50;
}
if (HAL_GetTick() - lastChange > 1500)
return; // exit if user just doesn't press anything for a bit
lcd.drawChar('<');
lcd.drawChar(' ');
lcd.printNumber(systemSettings.SolderingTemp, 3);
lcd.drawSymbol(1);
if (systemSettings.temperatureInF)
lcd.drawSymbol(0);
else
lcd.drawSymbol(1);
lcd.drawChar(' ');
lcd.drawChar('>');
lcd.refresh();
osDelay(10);
@@ -270,11 +300,12 @@ static void gui_settingsMenu() {
} else {
//Draw description
//draw string starting from descriptionOffset
int16_t maxOffset = strlen(settingsMenu[currentScreen].description);
if (descriptionStart == 0)
descriptionStart = HAL_GetTick();
int16_t descriptionOffset = ((HAL_GetTick() - descriptionStart) / 150) % maxOffset;
//^ Rolling offset based on time
lcd.setCursor(12 * (7 - descriptionOffset), 0);
lcd.print(settingsMenu[currentScreen].description);
}
@@ -320,7 +351,12 @@ static void gui_settingsMenu() {
}
static void gui_showTipTempWarning() {
for (;;) {
uint16_t tipTemp = tipMeasurementToC(getTipRawTemp(0));
uint16_t tipTemp;
if (systemSettings.temperatureInF)
tipTemp = tipMeasurementToF(getTipRawTemp(0));
else
tipTemp = tipMeasurementToC(getTipRawTemp(0));
lcd.clearScreen();
lcd.setCursor(0, 0);
if (systemSettings.advancedScreens) {
@@ -363,9 +399,16 @@ static int gui_SolderingSleepingMode() {
if (checkVoltageForExit())
return 1; //return non-zero on error
currentlyActiveTemperatureTarget = ctoTipMeasurement(systemSettings.SleepTemp);
if (systemSettings.temperatureInF)
currentlyActiveTemperatureTarget = ftoTipMeasurement(systemSettings.SleepTemp);
else
currentlyActiveTemperatureTarget = ctoTipMeasurement(systemSettings.SleepTemp);
//draw the lcd
uint16_t tipTemp = tipMeasurementToC(getTipRawTemp(0));
uint16_t tipTemp;
if (systemSettings.temperatureInF)
tipTemp = tipMeasurementToF(getTipRawTemp(0));
else
tipTemp = tipMeasurementToC(getTipRawTemp(0));
lcd.clearScreen();
lcd.setCursor(0, 0);
@@ -462,26 +505,16 @@ static void gui_solderingMode() {
//We switch the layout direction depending on the orientation of the lcd.
if (lcd.getRotation()) {
// battery
if (systemSettings.cutoutSetting) {
//User is on a lithium battery
//we need to calculate which of the 10 levels they are on
uint8_t cellCount = systemSettings.cutoutSetting + 2;
uint16_t cellV = getInputVoltageX10() / cellCount;
//Should give us approx cell voltage X10
//Range is 42 -> 33 = 9 steps therefore we will use battery 1-10
if (cellV < 33)
cellV = 33;
cellV -= 33; //Should leave us a number of 0-9
if (cellV > 9)
cellV = 9;
lcd.drawBattery(cellV + 1);
} else
lcd.drawChar(' '); //print a blank spot if there is no battery symbol
gui_drawBatteryIcon();
lcd.drawChar(' '); // Space out gap between battery <-> temp
lcd.printNumber(tipMeasurementToC(tipTemp), 3); //Draw current tip temp
lcd.drawSymbol(1); //deg C
if (systemSettings.temperatureInF) {
lcd.printNumber(tipMeasurementToF(tipTemp), 3); //Draw current tip temp
lcd.drawSymbol(0); //deg F
} else {
lcd.printNumber(tipMeasurementToC(tipTemp), 3); //Draw current tip temp
lcd.drawSymbol(1); //deg C
}
//We draw boost arrow if boosting, or else gap temp <-> heat indicator
if (boostModeOn)
@@ -490,16 +523,16 @@ static void gui_solderingMode() {
lcd.drawChar(' ');
// Draw heating/cooling symbols
//If tip PWM > 25% then we are 'heating'
if (getTipPWM() > 25)
//If tip PWM > 10% then we are 'heating'
if (getTipPWM() > 10)
lcd.drawSymbol(14);
else
lcd.drawSymbol(15);
} else {
// Draw heating/cooling symbols
//If tip PWM > 25% then we are 'heating'
if (getTipPWM() > 25)
//If tip PWM > 10% then we are 'heating'
if (getTipPWM() > 10)
lcd.drawSymbol(14);
else
lcd.drawSymbol(15);
@@ -509,34 +542,33 @@ static void gui_solderingMode() {
else
lcd.drawChar(' ');
lcd.printNumber(tipMeasurementToC(tipTemp), 3); //Draw current tip temp
lcd.drawSymbol(1); //deg C
if (systemSettings.temperatureInF) {
lcd.printNumber(tipMeasurementToF(tipTemp), 3); //Draw current tip temp
lcd.drawSymbol(0); //deg F
} else {
lcd.printNumber(tipMeasurementToC(tipTemp), 3); //Draw current tip temp
lcd.drawSymbol(1); //deg C
}
lcd.drawChar(' '); // Space out gap between battery <-> temp
if (systemSettings.cutoutSetting) {
//User is on a lithium battery
//we need to calculate which of the 10 levels they are on
uint8_t cellCount = systemSettings.cutoutSetting + 2;
uint16_t cellV = getInputVoltageX10() / cellCount;
//Should give us approx cell voltage X10
//Range is 42 -> 33 = 9 steps therefore we will use battery 1-10
if (cellV < 33)
cellV = 33;
cellV -= 33; //Should leave us a number of 0-9
if (cellV > 9)
cellV = 9;
lcd.drawBattery(cellV + 1);
} else
lcd.drawChar(' '); //print a blank spot if there is no battery symbol
gui_drawBatteryIcon();
}
}
//Update the setpoints for the temperature
if (boostModeOn)
currentlyActiveTemperatureTarget = ctoTipMeasurement(systemSettings.BoostTemp);
else
currentlyActiveTemperatureTarget = ctoTipMeasurement(systemSettings.SolderingTemp);
if (boostModeOn) {
if (systemSettings.temperatureInF)
currentlyActiveTemperatureTarget = ftoTipMeasurement(systemSettings.BoostTemp);
else
currentlyActiveTemperatureTarget = ctoTipMeasurement(systemSettings.BoostTemp);
} else {
if (systemSettings.temperatureInF)
currentlyActiveTemperatureTarget = ftoTipMeasurement(systemSettings.SolderingTemp);
else
currentlyActiveTemperatureTarget = ctoTipMeasurement(systemSettings.SolderingTemp);
}
//Undervoltage test
if (checkVoltageForExit()) {
@@ -676,7 +708,10 @@ void startGUITask(void const * argument) {
lcd.print("Tip Disconnected!");
} else {
lcd.print("Tip:");
lcd.printNumber(tipTemp, 3);
if (systemSettings.temperatureInF)
lcd.printNumber(tipMeasurementToF(getTipRawTemp(0)), 3);
else
lcd.printNumber(tipMeasurementToC(getTipRawTemp(0)), 3);
lcd.print(" ");
lcd.print("Set:");
lcd.printNumber(systemSettings.SolderingTemp, 3);
@@ -691,20 +726,14 @@ void startGUITask(void const * argument) {
} else {
lcd.setFont(0);
if (animationStep & 0x80) {
if (animationStep & 0x08)
lcd.drawArea(0, 0, 96, 8, Iron_RightArrow_UP);
else
lcd.drawArea(0, 0, 96, 8, Iron_RightArrow_DOWN);
if (lcd.getRotation())
lcd.drawArea(0, 0, 96, 16, idleScreenBG);
else
lcd.drawArea(0, 0, 96, 16, idleScreenBGF);
lcd.setCursor(0, 0);
gui_drawBatteryIcon();
lcd.drawArea(0, 8, 96, 8, Iron_Base);
} else {
if (animationStep & 0x08)
lcd.drawArea(0, 0, 96, 8, Iron_LeftArrow_UP);
else
lcd.drawArea(0, 0, 96, 8, Iron_LeftArrow_DOWN);
lcd.drawArea(0, 8, 96, 8, Iron_Base);
}
}
lcd.refresh();

View File

@@ -411,99 +411,41 @@ const uint8_t FontSymbols[] = {
0x00,0x00,0x00,0x00,0x80,0xC0,0xE0,0xC0,0x80,0x00,0x00,0x00,0x00,0x04,0x06,0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x06,0x04,//UP block
0x00,0x20,0x60,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0x60,0x20,0x00,0x00,0x00,0x00,0x01,0x03,0x07,0x03,0x01,0x00,0x00,0x00,//Down block
};
const uint8_t idleScreenBG[] = {
const uint8_t Iron_Base[] ={
0x00,0x20,0x60,0x60,0x60,0x60,0x60,0x60,0x90,0x90,0x90,0x90,
0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,
0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x60,0x60,0x60,
0x60,0x60,0x60,0x60,0x60,0x70,0xF8,0x88,0x84,0x82,0x82,0x83,
0x83,0x83,0x83,0x83,0x83,0x82,0x82,0x82,0x82,0x83,0x83,0x83,
0x83,0x83,0x83,0x82,0x82,0x82,0x82,0x82,0x86,0x84,0x84,0x84,
0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,
0x84,0x84,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0xFE,0x00,
//width = 96
//height = 16
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0,
0x0C, 0x02, 0x02, 0x01, 0x01, 0x01, 0x81, 0xFD, 0x81, 0x01, 0x01, 0x01, 0x1D, 0xF1, 0xF1, 0x1D, 0x01, 0x01,
0x01, 0x01, 0x02, 0x02, 0x0C, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x0C, 0x02,
0x02, 0x01, 0x01, 0x01, 0x0D, 0x1D, 0x29, 0x71, 0xA1, 0xC1, 0x01, 0x01, 0x01, 0x31, 0xC9, 0x01, 0x01, 0x01,
0x02, 0x02, 0x0C, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x18, 0x20, 0x20, 0x40, 0x40, 0x40, 0x4F, 0x4F, 0x4F, 0x40, 0x40, 0x40,
0x4E, 0x43, 0x43, 0x4E, 0x40, 0x40, 0x40, 0x40, 0x20, 0x20, 0x18, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x07, 0x18, 0x20, 0x20, 0x40, 0x40, 0x40, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x49, 0x4A,
0x4C, 0x49, 0x48, 0x48, 0x40, 0x40, 0x20, 0x20, 0x18, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
//The top pixel row for left arrow / on hint
const uint8_t Iron_LeftArrow_UP[] = {
0x00,0x7C,0x82,0x82,0x82,0x7C,0x00,0xFE,0x08,0x10,0x20,0xFE,//ON
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x88,
0x98,0xBF,0xBF,0x98,0x88,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
const uint8_t idleScreenBGF[] = {
//width = 96
//height = 16
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xF0, 0x0C, 0x02, 0x02, 0x01, 0x01, 0x01, 0xC9, 0x31, 0x01, 0x01, 0x01, 0xC1, 0xA1, 0x71, 0x29,
0x1D, 0x0D, 0x01, 0x01, 0x01, 0x02, 0x02, 0x0C, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xF0, 0x0C, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x1D, 0xF1, 0xF1, 0x1D, 0x01, 0x01, 0x01, 0x81, 0xFD, 0x81,
0x01, 0x01, 0x01, 0x02, 0x02, 0x0C, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x18, 0x20, 0x20, 0x40, 0x40, 0x48, 0x48, 0x49, 0x4C,
0x4A, 0x49, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x40, 0x40, 0x40, 0x20, 0x20, 0x18, 0x07, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x18, 0x20, 0x20, 0x40, 0x40, 0x40, 0x40, 0x4E, 0x43, 0x43, 0x4E,
0x40, 0x40, 0x40, 0x4F, 0x4F, 0x4F, 0x40, 0x40, 0x40, 0x20, 0x20, 0x18, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
const uint8_t Iron_LeftArrow_DOWN[] = {
0x00,0x7C,0x82,0x82,0x82,0x7C,0x00,0xFE,0x08,0x10,0x20,0xFE,//ON
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,
0x30,0x7E,0x7E,0x30,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
//The top pixel row for both arrows /
const uint8_t Iron_BothArrows[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x88,
0x98,0xBF,0xBF,0x98,0x88,0x00,0x00,0x00,0x00,0x88,0x98,0xBF,
0xBF,0x98,0x88,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
//The top pixel row for right arrow / settings hint
const uint8_t Iron_RightArrow_UP[] = {
0x00,0x8C,0x92,0x92,0x92,0x62,0x00,0xFE,0x92,0x92,0x92,0x82,//SE
0x00,0x02,0x02,0xFE,0x02,0x02,0x00,0x02,0x02,0xFE,0x02,0x02,//TT
0x00,0x00,0x82,0xFE,0x82,0x00,0x00,0xFE,0x08,0x10,0x20,0xFE,//IN
0x00,0x7C,0x82,0x82,0xA2,0x62,0x00,0x8C,0x92,0x92,0x92,0x62,//GS
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x88,0x98,0xBF,
0xBF,0x98,0x88,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
const uint8_t Iron_RightArrow_DOWN[] = {
0x00,0x8C,0x92,0x92,0x92,0x62,0x00,0xFE,0x92,0x92,0x92,0x82,//SE
0x00,0x02,0x02,0xFE,0x02,0x02,0x00,0x02,0x02,0xFE,0x02,0x02,//TT
0x00,0x00,0x82,0xFE,0x82,0x00,0x00,0xFE,0x08,0x10,0x20,0xFE,//IN
0x00,0x7C,0x82,0x82,0xA2,0x62,0x00,0x8C,0x92,0x92,0x92,0x62,//GS
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x30,0x7E,
0x7E,0x30,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
const uint8_t SymbolTable[]={
0x0E,0x11,0x11,0x0E,0xE0,0xF8,0x0C,0x06,0x03,0x01,0x01,0x01,0x01,0x02,0x1E,0x00,
0x00,0x00,0x00,0x00,0x0F,0x3F,0x70,0xC0,0x80,0x80,0x80,0x80,0x80,0x40,0x20,0x00, // Degrees C
0x08,0x14,0x22,0x14,0x08,0x02,0x02,0xFE,0x06,0x02,0x02,0x02,0xC2,0x02,0x06,0x1E,
0x00,0x00,0x00,0x00,0x00,0x80,0x80,0xFF,0x81,0x81,0x01,0x01,0x03,0x00,0x00,0x00, // Degrees F
0xC0,0x30,0x08,0x04,0x04,0x02,0xFA,0xAA,0xFA,0x02,0x04,0x04,0x08,0x30,0xC0,0x00,
0x07,0x18,0x20,0x40,0x58,0xA4,0xDB,0xDE,0xDB,0xA4,0x58,0x40,0x20,0x18,0x07,0x00, // Temp symbol
0x00,0xF0,0xF0,0x00,0x00,0xF0,0xF0,0xF0,0x00,0x00,0xFC,0xF8,0xF0,0xE0,0xC0,0x80, //Right Arrow
0x00,0x0F,0x0F,0x00,0x00,0x0F,0x0F,0x0F,0x00,0x00,0x3F,0x1F,0x0F,0x07,0x03,0x01,
0x80,0xC0,0xE0,0xF0,0xF8,0xFC,0x00,0x00,0xF0,0xF0,0xF0,0x00,0x00,0xF0,0xF0,0x00, //Left Arrow
0x01,0x03,0x07,0x0F,0x1F,0x3F,0x00,0x00,0x0F,0x0F,0x0F,0x00,0x00,0x0F,0x0F,0x00,
0x11,0x33,0x66,0xCC,0x98,0x30,0x60,0xC0,0xC0,0x60,0x30,0x98,0xCC,0x66,0x33,0x11,
0x01,0x03,0x06,0x0C,0x19,0x33,0x66,0xCC,0xCC,0x66,0x33,0x19,0x0C,0x06,0x03,0x01, //Down Chevron
0x80,0xC0,0x60,0x30,0x98,0xCC,0x66,0x33,0x33,0x66,0xCC,0x98,0x30,0x60,0xC0,0x80,
0x88,0xCC,0x66,0x33,0x19,0x0C,0x06,0x03,0x03,0x06,0x0C,0x19,0x33,0x66,0xCC,0x88, //Up Chevron
0x00,0x8C,0x8C,0x8C,0x8C,0x8C,0x8C,0x8C,0x8C,0x8C,0x8C,0x8C,0x8C,0x8C,0x8C,0x00, // Flat Lines
0x00,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x00,
};
const unsigned char ASCII6x8[] = {
//1*8*6 һ<><D2BB>