Font bounds check, trying to get Russian working
This commit is contained in:
@@ -8,6 +8,7 @@ This firmware is not complete, it is missing some features such as :
|
|||||||
* Motion sensitivity needs more polish for sensitivity levels
|
* Motion sensitivity needs more polish for sensitivity levels
|
||||||
* Auto tuning PID?
|
* Auto tuning PID?
|
||||||
* Input voltage calibration
|
* Input voltage calibration
|
||||||
|
* Russian font has issues atm
|
||||||
|
|
||||||
While it most likely will work, It is not meant for production use just yet!
|
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).
|
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 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 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.*
|
Please calibrate your irons voltage reading when you are using a lithium battery after any firmware upgrades.*
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ private:
|
|||||||
bool inLeftHandedMode; // Whether the screen is in left or not (used for offsets in GRAM)
|
bool inLeftHandedMode; // Whether the screen is in left or not (used for offsets in GRAM)
|
||||||
bool displayOnOffState; // If the display is on or not
|
bool displayOnOffState; // If the display is on or not
|
||||||
uint8_t fontWidth, fontHeight;
|
uint8_t fontWidth, fontHeight;
|
||||||
|
uint16_t fontTableLength;
|
||||||
int16_t cursor_x, cursor_y;
|
int16_t cursor_x, cursor_y;
|
||||||
uint8_t displayOffset;
|
uint8_t displayOffset;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -124,6 +124,8 @@ void OLED::drawChar(char c, char PrecursorCommand) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
charPointer = ((uint8_t*) currentFont) + ((fontWidth * (fontHeight / 8)) * index);
|
charPointer = ((uint8_t*) currentFont) + ((fontWidth * (fontHeight / 8)) * index);
|
||||||
|
if ((charPointer - currentFont) > fontTableLength)
|
||||||
|
return;
|
||||||
if (cursor_x >= 0 && cursor_x < 96)
|
if (cursor_x >= 0 && cursor_x < 96)
|
||||||
drawArea(cursor_x, cursor_y, fontWidth, fontHeight, charPointer);
|
drawArea(cursor_x, cursor_y, fontWidth, fontHeight, charPointer);
|
||||||
cursor_x += fontWidth;
|
cursor_x += fontWidth;
|
||||||
@@ -180,14 +182,17 @@ void OLED::setFont(uint8_t fontNumber) {
|
|||||||
currentFont = ASCII6x8;
|
currentFont = ASCII6x8;
|
||||||
fontHeight = 8;
|
fontHeight = 8;
|
||||||
fontWidth = 6;
|
fontWidth = 6;
|
||||||
|
fontTableLength = sizeof(ASCII6x8);
|
||||||
} else if (fontNumber == 2) {
|
} else if (fontNumber == 2) {
|
||||||
currentFont = ExtraFontChars;
|
currentFont = ExtraFontChars;
|
||||||
fontHeight = 16;
|
fontHeight = 16;
|
||||||
fontWidth = 12;
|
fontWidth = 12;
|
||||||
|
fontTableLength = sizeof(ExtraFontChars);
|
||||||
} else {
|
} else {
|
||||||
currentFont = FONT_12;
|
currentFont = FONT_12;
|
||||||
fontHeight = 16;
|
fontHeight = 16;
|
||||||
fontWidth = 12;
|
fontWidth = 12;
|
||||||
|
fontTableLength = sizeof(FONT_12);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -220,23 +220,18 @@ const char SettingTempFChar = 'F';
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef LANG_RU
|
#ifdef LANG_RU
|
||||||
const char* SettingsLongNames[13] =
|
const char* SettingsLongNames[13] = {
|
||||||
{
|
|
||||||
//These are all the help text for all the settings./
|
//These are all the help text for all the settings./
|
||||||
"Источник питания. Установка напряжения отключения. <DC 10V> <S 3.3 V на батарею>",
|
"ЀИстЀочник питания. Установка напряжения отключения. <DC 10V> <S 3.3 V на батарею>", "Температура Сна <С>",
|
||||||
"Температура Сна <С>",
|
"Переход в режим Сна <Минуты>", "Переходит в режим ожидания <Минуты>",
|
||||||
"Переход в режим Сна <Минуты>",
|
|
||||||
"Переходит в режим ожидания <Минуты>",
|
|
||||||
"Акселерометр <0. Выкл. 1. мин. чувствительный 9. макс. чувствительный>",
|
"Акселерометр <0. Выкл. 1. мин. чувствительный 9. макс. чувствительный>",
|
||||||
"В чем измерять температуру",
|
"Display detailed information in a smaller font.", //
|
||||||
"Шаг измерения температуры",
|
|
||||||
"Скорость обновления дисплея температуры",
|
|
||||||
"Ориентация Дисплея <A. Автоматический L. Левая Рука R. Правая Рука>",
|
"Ориентация Дисплея <A. Автоматический L. Левая Рука R. Правая Рука>",
|
||||||
"Активация кнопки A для Турбо режима до 450С при пайке ",
|
"Активация кнопки A для Турбо режима до 450С при пайке ", "Установка температуры для Турбо режима",
|
||||||
"Установка температуры для Турбо режима",
|
|
||||||
"Изменяет стрелки на дисплей питания при пайке",
|
"Изменяет стрелки на дисплей питания при пайке",
|
||||||
"Автоматический запуск паяльника при включении питания. T=Нагрев, S=Режим Сна,F=Выкл.",
|
"Автоматический запуск паяльника при включении питания. 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* SettingsCalibrationWarning = "Please ensure the tip is at room temperature before continuing!";
|
||||||
|
|
||||||
|
|||||||
@@ -272,15 +272,16 @@ static void gui_settingsMenu() {
|
|||||||
//draw string starting from descriptionOffset
|
//draw string starting from descriptionOffset
|
||||||
|
|
||||||
int16_t maxOffset = strlen(settingsMenu[currentScreen].description);
|
int16_t maxOffset = strlen(settingsMenu[currentScreen].description);
|
||||||
if (!descriptionStart)
|
if (descriptionStart == 0)
|
||||||
descriptionStart = HAL_GetTick();
|
descriptionStart = HAL_GetTick();
|
||||||
int16_t descriptionOffset = ((HAL_GetTick() - descriptionStart) / 150) % maxOffset;
|
int16_t descriptionOffset = ((HAL_GetTick() - descriptionStart) / 150) % maxOffset;
|
||||||
lcd.setCursor(12 * (7 - descriptionOffset), 0);
|
lcd.setCursor(12 * (7 - descriptionOffset), 0);
|
||||||
lcd.print(settingsMenu[currentScreen].description);
|
lcd.print(settingsMenu[currentScreen].description);
|
||||||
}
|
}
|
||||||
ButtonState buttons = getButtonState();
|
ButtonState buttons = getButtonState();
|
||||||
if (descriptionStart)
|
if (descriptionStart | (HAL_GetTick() - descriptionStart < 500))
|
||||||
buttons = BUTTON_NONE;
|
buttons = BUTTON_NONE;
|
||||||
|
else {
|
||||||
switch (buttons) {
|
switch (buttons) {
|
||||||
case BUTTON_BOTH:
|
case BUTTON_BOTH:
|
||||||
earlyExit = true; //will make us exit next loop
|
earlyExit = true; //will make us exit next loop
|
||||||
@@ -307,7 +308,7 @@ static void gui_settingsMenu() {
|
|||||||
case BUTTON_NONE:
|
case BUTTON_NONE:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
lcd.refresh(); //update the LCD
|
lcd.refresh(); //update the LCD
|
||||||
osDelay(20); //pause for a sec
|
osDelay(20); //pause for a sec
|
||||||
HAL_IWDG_Refresh(&hiwdg);
|
HAL_IWDG_Refresh(&hiwdg);
|
||||||
|
|||||||
Reference in New Issue
Block a user