1
0
forked from me/IronOS

Bootup logo settings (#1241)

Adds ability to adjust the time shown for the bootup logo.
This commit is contained in:
discip
2022-04-02 03:39:14 +02:00
committed by GitHub
parent 62dd2abf12
commit 0b8192b690
42 changed files with 750 additions and 1013 deletions

View File

@@ -1321,10 +1321,10 @@ HAL_StatusTypeDef HAL_TIM_PWM_Start(TIM_HandleTypeDef *htim, uint32_t Channel) {
/* Enable the Capture compare channel */
TIM_CCxChannelCmd(htim->Instance, Channel, TIM_CCx_ENABLE);
if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) {
/* Enable the main output */
__HAL_TIM_MOE_ENABLE(htim);
}
// if (IS_TIM_BREAK_INSTANCE(htim->Instance) != RESET) {
// /* Enable the main output */
// __HAL_TIM_MOE_ENABLE(htim);
// }
/* Enable the Peripheral, except in trigger mode where enable is automatically done with trigger */
if (IS_TIM_SLAVE_INSTANCE(htim->Instance)) {
@@ -3450,39 +3450,6 @@ void HAL_TIM_IRQHandler(TIM_HandleTypeDef *htim) {
htim->PeriodElapsedCallback(htim);
#else
HAL_TIM_PeriodElapsedCallback(htim);
#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
}
}
/* TIM Break input event */
if (__HAL_TIM_GET_FLAG(htim, TIM_FLAG_BREAK) != RESET) {
if (__HAL_TIM_GET_IT_SOURCE(htim, TIM_IT_BREAK) != RESET) {
__HAL_TIM_CLEAR_IT(htim, TIM_IT_BREAK);
#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
htim->BreakCallback(htim);
#else
HAL_TIMEx_BreakCallback(htim);
#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
}
}
/* TIM Trigger detection event */
if (__HAL_TIM_GET_FLAG(htim, TIM_FLAG_TRIGGER) != RESET) {
if (__HAL_TIM_GET_IT_SOURCE(htim, TIM_IT_TRIGGER) != RESET) {
__HAL_TIM_CLEAR_IT(htim, TIM_IT_TRIGGER);
#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
htim->TriggerCallback(htim);
#else
HAL_TIM_TriggerCallback(htim);
#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
}
}
/* TIM commutation event */
if (__HAL_TIM_GET_FLAG(htim, TIM_FLAG_COM) != RESET) {
if (__HAL_TIM_GET_IT_SOURCE(htim, TIM_IT_COM) != RESET) {
__HAL_TIM_CLEAR_IT(htim, TIM_FLAG_COM);
#if (USE_HAL_TIM_REGISTER_CALLBACKS == 1)
htim->CommutationCallback(htim);
#else
HAL_TIMEx_CommutCallback(htim);
#endif /* USE_HAL_TIM_REGISTER_CALLBACKS */
}
}

View File

@@ -20,11 +20,14 @@ void BootLogo::showOldFormat(const uint8_t *ptrLogoArea) {
OLED::drawAreaSwapped(0, 0, 96, 16, (uint8_t *)(ptrLogoArea + 4));
OLED::refresh();
// Delay here until button is pressed or its been 4 seconds
waitForButtonPressOrTimeout(TICKS_SECOND * 4);
// Delay here until button is pressed or its been the amount of seconds set by the user
waitForButtonPressOrTimeout(TICKS_SECOND * getSettingValue(SettingsOptions::LOGOTime));
}
void BootLogo::showNewFormat(const uint8_t *ptrLogoArea) {
if (getSettingValue(SettingsOptions::LOGOTime) == 0) {
return;
}
// New logo format (a) fixes long standing byte swap quirk and (b) supports animation
uint8_t interFrameDelay = ptrLogoArea[0];
OLED::clearScreen();
@@ -39,24 +42,16 @@ void BootLogo::showNewFormat(const uint8_t *ptrLogoArea) {
position += len;
buttons = getButtonState();
// Button pressed
if (buttons != BUTTON_NONE) {
return;
}
if (interFrameDelay) {
osDelay(interFrameDelay * 5);
} else {
// Delay here until button is pressed or its been 4 seconds
waitForButtonPressOrTimeout(TICKS_SECOND * 4);
}
// 1024 less the header type byte and the inter-frame-delay
if (getSettingValue(SettingsOptions::LOGOTime) < 5 && (position == 1022 || len == 0)) {
// Delay here until button is pressed or its been the amount of seconds set by the user
waitForButtonPressOrTimeout(TICKS_SECOND * getSettingValue(SettingsOptions::LOGOTime));
return;
}
// If this was an early exit; bail now
if (len == 0) {
return;
}
} while (position < 1022); // 1024 less the header type byte and the inter-frame-delay
} while (buttons == BUTTON_NONE);
}
int BootLogo::showNewFrame(const uint8_t *ptrLogoArea) {
uint8_t length = ptrLogoArea[0];
@@ -81,4 +76,4 @@ int BootLogo::showNewFrame(const uint8_t *ptrLogoArea) {
OLED::refresh();
return (length * 2) + 1;
}
}

View File

@@ -190,6 +190,12 @@ const uint8_t invertDisplayIcon[] = {
0xFE, 0x01, 0x79, 0x25, 0x79, 0x01, 0xFE, 0x00, 0x20, 0x20, 0x20, 0x20, 0xDF, 0x07, 0x8F, 0xDF, 0xFF, 0x01, 0xFE, 0x86, 0xDA, 0x86, 0xFE, 0x01,
0x7F, 0x80, 0xA4, 0xBE, 0xA0, 0x80, 0x7F, 0x00, 0x04, 0x0E, 0x1F, 0x04, 0xFB, 0xFB, 0xFB, 0xFB, 0xFF, 0x80, 0x7F, 0x5B, 0x41, 0x5F, 0x7F, 0x80};
const uint8_t infinityIcon[] = {
// width = 24
// height = 16
0x00, 0xc0, 0x70, 0x18, 0x0c, 0x0c, 0x0c, 0x0c, 0x18, 0x10, 0x20, 0x80, 0xc0, 0x60, 0x30, 0x18, 0x0c, 0x0c, 0x0c, 0x0c, 0x18, 0x70, 0xc0, 0x00,
0x00, 0x01, 0x07, 0x0c, 0x18, 0x18, 0x18, 0x18, 0x0c, 0x06, 0x03, 0x01, 0x00, 0x02, 0x04, 0x0c, 0x18, 0x18, 0x18, 0x18, 0x0c, 0x07, 0x01, 0x00};
/*
* 16x16 icons
* 32 * 3 = Frame size * Frame count

View File

@@ -49,9 +49,10 @@ enum SettingsOptions {
PDNegTimeout = 32, // PD timeout in 100ms steps
OLEDInversion = 33, // Invert the colours on the display
OLEDBrightness = 34, // Brightness for the OLED display
LOGOTime = 35, // Duration the logo will be displayed for
//
SettingsOptionsLength = 35, //
SettingsOptionsLength = 36, //
};
typedef enum {

View File

@@ -63,6 +63,7 @@ enum class SettingsItemIndex : uint8_t {
LanguageSwitch,
Brightness,
ColourInversion,
LOGOTime,
NUM_ITEMS,
};

View File

@@ -84,6 +84,7 @@ static const SettingConstants settingsConstants[(int)SettingsOptions::SettingsOp
{0, 50, 1, 20}, // PDNegTimeout
{0, 1, 1, 0}, // OLEDInversion
{0, 99, 11, 33}, // OLEDBrightness
{0, 5, 1, 1}, // LOGOTime
};
static_assert((sizeof(settingsConstants) / sizeof(SettingConstants)) == ((int)SettingsOptions::SettingsOptionsLength));

View File

@@ -69,6 +69,7 @@ static bool settings_showPowerPulseOptions(void);
static void settings_displayPowerPulseDuration(void);
static void settings_displayBrightnessLevel(void);
static void settings_displayInvertColor(void);
static void settings_displayLogoTime(void);
#ifdef HALL_SENSOR
static void settings_displayHallEffect(void);
@@ -223,6 +224,7 @@ const menuitem UIMenu[] = {
* -Animation Loop
* OLED Brightnes
* Invert Screen
* Logo Timeout
* Detailed IDLE
* Detailed Soldering
*/
@@ -239,6 +241,7 @@ const menuitem UIMenu[] = {
{SETTINGS_DESC(SettingsItemIndex::AnimLoop), nullptr, settings_displayAnimationLoop, settings_displayAnimationOptions, SettingsOptions::AnimationLoop}, /*Animation Loop switch */
{SETTINGS_DESC(SettingsItemIndex::Brightness), nullptr, settings_displayBrightnessLevel, nullptr, SettingsOptions::OLEDBrightness}, /*Brightness Level*/
{SETTINGS_DESC(SettingsItemIndex::ColourInversion), nullptr, settings_displayInvertColor, nullptr, SettingsOptions::OLEDInversion}, /*Invert screen colour*/
{SETTINGS_DESC(SettingsItemIndex::LOGOTime), nullptr, settings_displayLogoTime, nullptr, SettingsOptions::LOGOTime}, /*Set logo duration*/
{SETTINGS_DESC(SettingsItemIndex::AdvancedIdle), nullptr, settings_displayAdvancedIDLEScreens, nullptr, SettingsOptions::DetailedIDLE}, /*Advanced idle screen*/
{SETTINGS_DESC(SettingsItemIndex::AdvancedSoldering), nullptr, settings_displayAdvancedSolderingScreens, nullptr, SettingsOptions::DetailedSoldering}, /*Advanced soldering screen*/
{0, nullptr, nullptr, nullptr, SettingsOptions::SettingsOptionsLength} // end of menu marker. DO NOT REMOVE
@@ -326,8 +329,8 @@ static void settings_displayInputVRange(void) {
static bool settings_showInputVOptions(void) { return getSettingValue(SettingsOptions::MinDCVoltageCells) > 0; }
static void settings_displayInputMinVRange(void) {
printShortDescription(SettingsItemIndex::MinVolCell, 4);
OLED::printNumber(getSettingValue(SettingsOptions::MinVoltageCells) / 10, 2, FontStyle::LARGE);
printShortDescription(SettingsItemIndex::MinVolCell, 5);
OLED::printNumber(getSettingValue(SettingsOptions::MinVoltageCells) / 10, 1, FontStyle::LARGE);
OLED::print(SymbolDot, FontStyle::LARGE);
OLED::printNumber(getSettingValue(SettingsOptions::MinVoltageCells) % 10, 1, FontStyle::LARGE);
}
@@ -449,7 +452,6 @@ static bool settings_setTempF(void) {
static void settings_displayTempF(void) {
printShortDescription(SettingsItemIndex::TemperatureUnit, 7);
OLED::print((getSettingValue(SettingsOptions::TemperatureInF)) ? SymbolDegF : SymbolDegC, FontStyle::LARGE);
}
@@ -460,7 +462,6 @@ static void settings_displayAdvancedSolderingScreens(void) {
static void settings_displayAdvancedIDLEScreens(void) {
printShortDescription(SettingsItemIndex::AdvancedIdle, 7);
OLED::drawCheckbox(getSettingValue(SettingsOptions::DetailedIDLE));
}
@@ -755,9 +756,9 @@ static void settings_displayPowerPulseDuration(void) {
static void settings_displayBrightnessLevel(void) {
OLED::drawArea(0, 0, 16, 16, brightnessIcon);
OLED::setCursor(5 * FONT_12_WIDTH - 2, 0);
OLED::setCursor(6 * FONT_12_WIDTH - 2, 0);
// printShortDescription(SettingsItemIndex::Brightness, 7);
OLED::printNumber((getSettingValue(SettingsOptions::OLEDBrightness) / 11 + 1), 3, FontStyle::LARGE);
OLED::printNumber((getSettingValue(SettingsOptions::OLEDBrightness) / 11 + 1), 2, FontStyle::LARGE);
// While not optimal to apply this here, it is _very_ convienient
OLED::setBrightness(getSettingValue(SettingsOptions::OLEDBrightness));
}
@@ -766,12 +767,23 @@ static void settings_displayInvertColor(void) {
OLED::drawArea(0, 0, 24, 16, invertDisplayIcon);
OLED::setCursor(7 * FONT_12_WIDTH - 2, 0);
// printShortDescription(SettingsItemIndex::ColourInversion, 7);
OLED::drawCheckbox(getSettingValue(SettingsOptions::OLEDInversion));
// While not optimal to apply this here, it is _very_ convienient
OLED::setInverseDisplay(getSettingValue(SettingsOptions::OLEDInversion));
}
static void settings_displayLogoTime(void) {
printShortDescription(SettingsItemIndex::LOGOTime, 5);
if (getSettingValue(SettingsOptions::LOGOTime) == 0) {
OLED::print(translatedString(Tr->OffString), FontStyle::LARGE);
} else if (getSettingValue(SettingsOptions::LOGOTime) == 5) {
OLED::drawArea(OLED_WIDTH - 24 - 2, 0, 24, 16, infinityIcon);
} else {
OLED::printNumber(getSettingValue(SettingsOptions::LOGOTime), 2, FontStyle::LARGE);
OLED::print(SymbolSeconds, FontStyle::LARGE);
}
}
#ifdef HALL_SENSOR
static void settings_displayHallEffect(void) {
printShortDescription(SettingsItemIndex::HallEffSensitivity, 7);