Move build info to long hold B

This commit is contained in:
Ben V. Brown
2017-09-28 12:38:24 +10:00
parent 43c5ca855c
commit 0bdf570edc
7 changed files with 107 additions and 46 deletions

View File

@@ -1,2 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=utf8
encoding/<project>=UTF-8

View File

@@ -42,5 +42,5 @@ void saveSettings();
void restoreSettings();
uint8_t lookupVoltageLevel(uint8_t level);
void resetSettings();
void showBootLogoIfavailable();
bool showBootLogoIfavailable();
#endif /* SETTINGS_H_ */

View File

@@ -93,8 +93,6 @@ void OLED::refresh() {
void OLED::drawChar(char c, char PrecursorCommand) {
//prints a char to the screen
if (c == '\n')
cursor_y += fontHeight;
if (c < ' ')
return;
//We are left with
@@ -115,19 +113,18 @@ void OLED::drawChar(char c, char PrecursorCommand) {
//Latin stats at 96
c -= 0x80;
if (PrecursorCommand == 0xC3)
index = (96 + 32) + (c);
index = (128) + (c);
else if (PrecursorCommand == 0xC2)
index = (96) + (c);
else if (PrecursorCommand == 0xD0)
index = (208) + (c);
index = (192) + (c);
else if (PrecursorCommand == 0xD1)
index = (272) + (c);
index = (256) + (c);
else
return;
index -=0x10;//offset removal
}
charPointer = ((uint8_t*) currentFont) + ((fontWidth * (fontHeight / 8)) * index);
if (cursor_x >= 0)
if (cursor_x >= 0 && cursor_x < 96)
drawArea(cursor_x, cursor_y, fontWidth, fontHeight, charPointer);
cursor_x += fontWidth;
}

View File

@@ -5,6 +5,10 @@
* Author: Ben V. Brown
*/
#include "Translation.h"
#define LANG_RU
#define LANG
#ifndef LANG
#define LANG_EN
#define LANG
@@ -215,6 +219,42 @@ const char SettingTempCChar = 'C';
const char SettingTempFChar = 'F';
#endif
#ifdef LANG_RU
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=Выкл.",
"Мигает температура на экране охлаждения, пока жало остается горячим."};
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 SettingTrueChar = 'T';
const char SettingFalseChar = 'F';
const char SettingSleepChar = 'S';
const char SettingFastChar = 'F';
const char SettingMediumChar = 'M';
const char SettingSlowChar = 'S';
const char SettingRightChar = 'R';
const char SettingLeftChar = 'L';
const char SettingAutoChar = 'A';
const char SettingTempCChar = 'C';
const char SettingTempFChar = 'F';
#endif
const char* SettingsShortNames[13] = { /**/
"PWRSC ", // Power Source (DC or batt)
"STMP ", // Sleep Temperature

View File

@@ -43,7 +43,7 @@ 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[4], { settings_setAdvancedScreens }, { settings_displayAdvancedScreens } },/* Advanced screens*/
{ (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 } }, /**/

View File

@@ -41,18 +41,8 @@ int main(void) {
lcd.initialize(); //start up the LCD
lcd.setFont(0); //default to bigger font
accel.initalize(); //this sets up the I2C registers and loads up the default settings
lcd.clearScreen(); //Ensure the buffer starts clean
lcd.setCursor(0, 0); //Position the cursor at the 0,0 (top left)
lcd.setFont(1); //small font
lcd.print((char*) "V2.00"); //Print version number
lcd.setCursor(0, 8); //second line
lcd.print(__DATE__); //print the compile date
lcd.refresh();
HAL_IWDG_Refresh(&hiwdg);
HAL_Delay(500);
restoreSettings(); //load the settings from flash
showBootLogoIfavailable();
setCalibrationOffset(systemSettings.CalibrationOffset);
HAL_IWDG_Refresh(&hiwdg);
/* Create the thread(s) */
@@ -146,11 +136,31 @@ ButtonState getButtonState() {
static void waitForButtonPress() {
//we are just lazy and sleep until user confirms button press
//This also eats the button press event!
ButtonState buttons = getButtonState();
while (buttons) {
buttons = getButtonState();
osDelay(100);
HAL_IWDG_Refresh(&hiwdg);
lcd.refresh();
}
while (!buttons) {
buttons = getButtonState();
osDelay(100);
HAL_IWDG_Refresh(&hiwdg);
lcd.refresh();
}
}
static void waitForButtonPressOrTimeout(uint32_t timeout) {
timeout += HAL_GetTick();
//Make timeout our exit value
for (;;) {
ButtonState buttons = getButtonState();
if (buttons)
return;
osDelay(100);
if (HAL_GetTick() > timeout)
return;
osDelay(50);
HAL_IWDG_Refresh(&hiwdg);
}
@@ -251,6 +261,7 @@ static void gui_settingsMenu() {
bool earlyExit = false;
uint32_t descriptionStart = 0;
while ((settingsMenu[currentScreen].description != NULL) && earlyExit == false) {
lcd.setFont(0);
lcd.clearScreen();
lcd.setCursor(0, 0);
if (HAL_GetTick() - lastButtonTime < 4000) {
@@ -259,7 +270,7 @@ static void gui_settingsMenu() {
} else {
//Draw description
//draw string starting from descriptionOffset
lcd.setFont(0);
int16_t maxOffset = strlen(settingsMenu[currentScreen].description);
if (!descriptionStart)
descriptionStart = HAL_GetTick();
@@ -573,15 +584,16 @@ void startGUITask(void const * argument) {
gui_solderingMode();
}
HAL_IWDG_Refresh(&hiwdg);
osDelay(1000);
if (showBootLogoIfavailable())
waitForButtonPressOrTimeout(1000);
HAL_IWDG_Refresh(&hiwdg);
/*for (;;) {
/*
for (;;) {
HAL_IWDG_Refresh(&hiwdg);
lcd.clearScreen();
lcd.setCursor(0, 0);
lcd.setFont(1);
lcd.printNumber(lastMovementTime, 5);
lcd.setFont(0);
lcd.print("");
lcd.refresh();
osDelay(100);
HAL_IWDG_Refresh(&hiwdg);
@@ -597,8 +609,19 @@ void startGUITask(void const * argument) {
case BUTTON_BOTH:
//Not used yet
break;
//Long presses are ignored for now
case BUTTON_B_LONG:
//Show the version information
{
lcd.clearScreen(); //Ensure the buffer starts clean
lcd.setCursor(0, 0); //Position the cursor at the 0,0 (top left)
lcd.setFont(1); //small font
lcd.print((char*) "V2.00"); //Print version number
lcd.setCursor(0, 8); //second line
lcd.print(__DATE__); //print the compile date
lcd.refresh();
waitForButtonPress();
}
break;
case BUTTON_F_LONG:
gui_solderingTempAdjust();
@@ -855,9 +878,9 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
#define FLASH_LOGOADDR (0x8000000|0xB800) /*second last page of flash set aside for logo image*/
void showBootLogoIfavailable() {
//check if the header is there (0xAA,0x55,0xF0,0x0D)
//If so display logo
bool showBootLogoIfavailable() {
//check if the header is there (0xAA,0x55,0xF0,0x0D)
//If so display logo
uint16_t temp[98];
for (uint8_t i = 0; i < (98); i++) {
@@ -871,15 +894,16 @@ void showBootLogoIfavailable() {
}
if (temp8[0] != 0xAA)
return;
return false;
if (temp8[1] != 0x55)
return;
return false;
if (temp8[2] != 0xF0)
return;
return false;
if (temp8[3] != 0x0D)
return;
return false;
lcd.drawArea(0, 0, 96, 16, (uint8_t*) (temp8 + 4));
lcd.refresh();
return true;
}