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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,21 +19,21 @@
|
|||||||
#endif
|
#endif
|
||||||
#ifdef LANG_EN
|
#ifdef LANG_EN
|
||||||
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.*/
|
||||||
/*No requirements on spacing or length*/
|
/*No requirements on spacing or length*/
|
||||||
"Power source. Sets cutoff voltage. <DC 10V> <S 3.3V per cell>", //
|
"Power source. Sets cutoff voltage. <DC 10V> <S 3.3V per cell>", //
|
||||||
"Sleep Temperature <C>", //
|
"Sleep Temperature <C>",//
|
||||||
"Sleep Timeout <Minutes>", //
|
"Sleep Timeout <Minutes>",//
|
||||||
"Shutdown Timeout <Minutes>", //
|
"Shutdown Timeout <Minutes>",//
|
||||||
"Motion Sensitivity <0.Off 1.least sensitive 9.most sensitive>", //
|
"Motion Sensitivity <0.Off 1.least sensitive 9.most sensitive>",//
|
||||||
"Display detailed information in a smaller font.", //
|
"Display detailed information in a smaller font.",//
|
||||||
"Display Orientation <A. Automatic L. Left Handed R. Right Handed>", //
|
"Display Orientation <A. Automatic L. Left Handed R. Right Handed>",//
|
||||||
"Enable front key enters boost mode 450C mode when soldering", //
|
"Enable front key enters boost mode 450C mode when soldering",//
|
||||||
"Temperature when in \"boost\" mode", //
|
"Temperature when in \"boost\" mode",//
|
||||||
"Automatically starts the iron into soldering on power up. T=Soldering, S= Sleep mode,F=Off", //
|
"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.", //
|
"Blink the temperature on the cooling screen while the tip is still hot.",//
|
||||||
"Calibrate tip offset.", //s
|
"Calibrate tip offset.",//s
|
||||||
"Reset all settings", };
|
"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!";
|
||||||
const char* UVLOWarningString = "LOW VOLT"; //Fixed width 8 chars
|
const char* UVLOWarningString = "LOW VOLT"; //Fixed width 8 chars
|
||||||
@@ -220,28 +220,23 @@ 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. макс. чувствительный>",
|
||||||
"Переходит в режим ожидания <Минуты>",
|
"Display detailed information in a smaller font.", //
|
||||||
"Акселерометр <0. Выкл. 1. мин. чувствительный 9. макс. чувствительный>",
|
"Ориентация Дисплея <A. Автоматический L. Левая Рука R. Правая Рука>",
|
||||||
"В чем измерять температуру",
|
"Активация кнопки A для Турбо режима до 450С при пайке ", "Установка температуры для Турбо режима",
|
||||||
"Шаг измерения температуры",
|
"Изменяет стрелки на дисплей питания при пайке",
|
||||||
"Скорость обновления дисплея температуры",
|
"Автоматический запуск паяльника при включении питания. T=Нагрев, S=Режим Сна,F=Выкл.",
|
||||||
"Ориентация Дисплея <A. Автоматический L. Левая Рука R. Правая Рука>",
|
"Мигает температура на экране охлаждения, пока жало остается горячим.", "Calibrate tip offset.", //s
|
||||||
"Активация кнопки A для Турбо режима до 450С при пайке ",
|
"Reset all settings", };
|
||||||
"Установка температуры для Турбо режима",
|
|
||||||
"Изменяет стрелки на дисплей питания при пайке",
|
|
||||||
"Автоматический запуск паяльника при включении питания. T=Нагрев, S=Режим Сна,F=Выкл.",
|
|
||||||
"Мигает температура на экране охлаждения, пока жало остается горячим."};
|
|
||||||
|
|
||||||
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!";
|
||||||
|
|
||||||
const char* UVLOWarningString = "Low Volt";//Fixed width 8 chars
|
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 SettingTrueChar = 'T';
|
||||||
const char SettingFalseChar = 'F';
|
const char SettingFalseChar = 'F';
|
||||||
const char SettingSleepChar = 'S';
|
const char SettingSleepChar = 'S';
|
||||||
|
|||||||
@@ -272,42 +272,43 @@ 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;
|
||||||
switch (buttons) {
|
else {
|
||||||
case BUTTON_BOTH:
|
switch (buttons) {
|
||||||
earlyExit = true; //will make us exit next loop
|
case BUTTON_BOTH:
|
||||||
break;
|
earlyExit = true; //will make us exit next loop
|
||||||
case BUTTON_F_SHORT:
|
break;
|
||||||
//increment
|
case BUTTON_F_SHORT:
|
||||||
settingsMenu[currentScreen].incrementHandler.func();
|
//increment
|
||||||
break;
|
|
||||||
case BUTTON_B_SHORT:
|
|
||||||
currentScreen++;
|
|
||||||
break;
|
|
||||||
case BUTTON_F_LONG:
|
|
||||||
if (HAL_GetTick() - autoRepeatTimer > 200) {
|
|
||||||
settingsMenu[currentScreen].incrementHandler.func();
|
settingsMenu[currentScreen].incrementHandler.func();
|
||||||
autoRepeatTimer = HAL_GetTick();
|
break;
|
||||||
}
|
case BUTTON_B_SHORT:
|
||||||
break;
|
|
||||||
case BUTTON_B_LONG:
|
|
||||||
if (HAL_GetTick() - autoRepeatTimer > 200) {
|
|
||||||
currentScreen++;
|
currentScreen++;
|
||||||
autoRepeatTimer = HAL_GetTick();
|
break;
|
||||||
}
|
case BUTTON_F_LONG:
|
||||||
break;
|
if (HAL_GetTick() - autoRepeatTimer > 200) {
|
||||||
case BUTTON_NONE:
|
settingsMenu[currentScreen].incrementHandler.func();
|
||||||
break;
|
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
|
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