1
0
forked from me/IronOS

Font bounds check, trying to get Russian working

This commit is contained in:
Ben V. Brown
2017-09-28 15:23:57 +10:00
parent 0bdf570edc
commit a0e99374b5
5 changed files with 63 additions and 60 deletions

View File

@@ -8,6 +8,7 @@ This firmware is not complete, it is missing some features such as :
* Motion sensitivity needs more polish for sensitivity levels
* Auto tuning PID?
* Input voltage calibration
* Russian font has issues atm
While it most likely will work, It is not meant for production use just yet!
@@ -20,7 +21,7 @@ This project is concidered feature complete for use as a soldering iron, *so ple
A short(ish) video that goes through every single menu option in the firmware is available [over here](https://www.youtube.com/watch?v=WlnpboYfxNk).
This video was created on an earlier 1.x version of the firmware, so alot has changed and a new video will be coming soon for the 2.x fork.
*This firmware does **NOT** support the usb port while running for changing settings. This is done through the onscreen menu only. Logos are editing using the tool or python script and uploaded in DFU mode.*
*This firmware does **NOT** support the usb port while running for changing settings. This is done through the onscreen menu only. Logos are edited using the tool or python script and uploaded in DFU mode.*
*Please note that when running the iron off a Lithium battery pack, the Iron is only rated to 24V input. So using a fully charged 6S battery *slightly* exceeds this rating, and is done so at your own risk.
Please calibrate your irons voltage reading when you are using a lithium battery after any firmware upgrades.*

View File

@@ -54,6 +54,7 @@ private:
bool inLeftHandedMode; // Whether the screen is in left or not (used for offsets in GRAM)
bool displayOnOffState; // If the display is on or not
uint8_t fontWidth, fontHeight;
uint16_t fontTableLength;
int16_t cursor_x, cursor_y;
uint8_t displayOffset;
};

View File

@@ -124,6 +124,8 @@ void OLED::drawChar(char c, char PrecursorCommand) {
return;
}
charPointer = ((uint8_t*) currentFont) + ((fontWidth * (fontHeight / 8)) * index);
if ((charPointer - currentFont) > fontTableLength)
return;
if (cursor_x >= 0 && cursor_x < 96)
drawArea(cursor_x, cursor_y, fontWidth, fontHeight, charPointer);
cursor_x += fontWidth;
@@ -180,14 +182,17 @@ void OLED::setFont(uint8_t fontNumber) {
currentFont = ASCII6x8;
fontHeight = 8;
fontWidth = 6;
fontTableLength = sizeof(ASCII6x8);
} else if (fontNumber == 2) {
currentFont = ExtraFontChars;
fontHeight = 16;
fontWidth = 12;
fontTableLength = sizeof(ExtraFontChars);
} else {
currentFont = FONT_12;
fontHeight = 16;
fontWidth = 12;
fontTableLength = sizeof(FONT_12);
}
}

View File

@@ -19,21 +19,21 @@
#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", };
/*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* SettingsCalibrationWarning = "Please ensure the tip is at room temperature before continuing!";
const char* UVLOWarningString = "LOW VOLT"; //Fixed width 8 chars
@@ -220,28 +220,23 @@ const char SettingTempFChar = 'F';
#endif
#ifdef LANG_RU
const char* SettingsLongNames[13] =
{
const char* SettingsLongNames[13] = {
//These are all the help text for all the settings./
"Источник питания. Установка напряжения отключения. <DC 10V> <S 3.3 V на батарею>",
"Температура Сна <С>",
"Переход в режим Сна <Минуты>",
"Переходит в режим ожидания <Минуты>",
"Акселерометр <0. Выкл. 1. мин. чувствительный 9. макс. чувствительный>",
"В чем измерять температуру",
"Шаг измерения температуры",
"Скорость обновления дисплея температуры",
"Ориентация Дисплея <A. Автоматический L. Левая Рука R. Правая Рука>",
"Активация кнопки A для Турбо режима до 450С при пайке ",
"Установка температуры для Турбо режима",
"Изменяет стрелки на дисплей питания при пайке",
"Автоматический запуск паяльника при включении питания. T=Нагрев, S=Режим Сна,F=Выкл.",
"Мигает температура на экране охлаждения, пока жало остается горячим."};
"ЀИстЀочник питания. Установка напряжения отключения. <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* UVLOWarningString = "Low Volt"; //Fixed width 8 chars
const char* CoolingPromptString = "Выкл. "; //Fixed width 5 chars
const char SettingTrueChar = 'T';
const char SettingFalseChar = 'F';
const char SettingSleepChar = 'S';

View File

@@ -272,42 +272,43 @@ static void gui_settingsMenu() {
//draw string starting from descriptionOffset
int16_t maxOffset = strlen(settingsMenu[currentScreen].description);
if (!descriptionStart)
if (descriptionStart == 0)
descriptionStart = HAL_GetTick();
int16_t descriptionOffset = ((HAL_GetTick() - descriptionStart) / 150) % maxOffset;
lcd.setCursor(12 * (7 - descriptionOffset), 0);
lcd.print(settingsMenu[currentScreen].description);
}
ButtonState buttons = getButtonState();
if (descriptionStart)
if (descriptionStart | (HAL_GetTick() - descriptionStart < 500))
buttons = BUTTON_NONE;
switch (buttons) {
case BUTTON_BOTH:
earlyExit = true; //will make us exit next loop
break;
case BUTTON_F_SHORT:
//increment
settingsMenu[currentScreen].incrementHandler.func();
break;
case BUTTON_B_SHORT:
currentScreen++;
break;
case BUTTON_F_LONG:
if (HAL_GetTick() - autoRepeatTimer > 200) {
else {
switch (buttons) {
case BUTTON_BOTH:
earlyExit = true; //will make us exit next loop
break;
case BUTTON_F_SHORT:
//increment
settingsMenu[currentScreen].incrementHandler.func();
autoRepeatTimer = HAL_GetTick();
}
break;
case BUTTON_B_LONG:
if (HAL_GetTick() - autoRepeatTimer > 200) {
break;
case BUTTON_B_SHORT:
currentScreen++;
autoRepeatTimer = HAL_GetTick();
}
break;
case BUTTON_NONE:
break;
break;
case BUTTON_F_LONG:
if (HAL_GetTick() - autoRepeatTimer > 200) {
settingsMenu[currentScreen].incrementHandler.func();
autoRepeatTimer = HAL_GetTick();
}
break;
case BUTTON_B_LONG:
if (HAL_GetTick() - autoRepeatTimer > 200) {
currentScreen++;
autoRepeatTimer = HAL_GetTick();
}
break;
case BUTTON_NONE:
break;
}
}
lcd.refresh(); //update the LCD
osDelay(20); //pause for a sec
HAL_IWDG_Refresh(&hiwdg);