mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Merge branch 'dev' of https://github.com/Ralim/IronOS into magic
This commit is contained in:
@@ -4,6 +4,15 @@
|
||||
#include "OLED.hpp"
|
||||
#include "cmsis_os.h"
|
||||
#define LOGO_PAGE_LENGTH 1024
|
||||
|
||||
void delay() {
|
||||
if (getSettingValue(SettingsOptions::LOGOTime) == 5) {
|
||||
waitForButtonPress();
|
||||
} else {
|
||||
waitForButtonPressOrTimeout(TICKS_SECOND * getSettingValue(SettingsOptions::LOGOTime));
|
||||
}
|
||||
}
|
||||
|
||||
void BootLogo::handleShowingLogo(const uint8_t *ptrLogoArea) {
|
||||
// Read the first few bytes and figure out what format we are looking at
|
||||
if (OLD_LOGO_HEADER_VALUE == *(reinterpret_cast<const uint32_t *>(ptrLogoArea))) {
|
||||
@@ -21,7 +30,7 @@ void BootLogo::showOldFormat(const uint8_t *ptrLogoArea) {
|
||||
OLED::refresh();
|
||||
|
||||
// Delay here until button is pressed or its been the amount of seconds set by the user
|
||||
waitForButtonPressOrTimeout(TICKS_SECOND * getSettingValue(SettingsOptions::LOGOTime));
|
||||
delay();
|
||||
}
|
||||
|
||||
void BootLogo::showNewFormat(const uint8_t *ptrLogoArea) {
|
||||
@@ -46,9 +55,9 @@ void BootLogo::showNewFormat(const uint8_t *ptrLogoArea) {
|
||||
osDelay(interFrameDelay * 5);
|
||||
}
|
||||
// 1024 less the header type byte and the inter-frame-delay
|
||||
if (getSettingValue(SettingsOptions::LOGOTime) < 5 && (position == 1022 || len == 0)) {
|
||||
if (getSettingValue(SettingsOptions::LOGOTime) > 0 && (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));
|
||||
delay();
|
||||
return;
|
||||
}
|
||||
} while (buttons == BUTTON_NONE);
|
||||
|
||||
@@ -423,6 +423,13 @@ inline void stripLeaderZeros(char *buffer, uint8_t places) {
|
||||
}
|
||||
}
|
||||
}
|
||||
void OLED::drawHex(uint32_t x, FontStyle fontStyle) {
|
||||
// print number to hex
|
||||
for (uint_fast8_t i = 0; i < 8; i++) {
|
||||
uint16_t value = (x >> (4 * (7 - i))) & 0b1111;
|
||||
drawChar(value + 2, fontStyle);
|
||||
}
|
||||
}
|
||||
// maximum places is 5
|
||||
void OLED::printNumber(uint16_t number, uint8_t places, FontStyle fontStyle, bool noLeaderZeros) {
|
||||
char buffer[7] = {0};
|
||||
|
||||
@@ -89,6 +89,7 @@ public:
|
||||
// Draws a checkbox
|
||||
static void drawCheckbox(bool state) { drawSymbol((state) ? 16 : 17); }
|
||||
static void debugNumber(int32_t val, FontStyle fontStyle);
|
||||
static void drawHex(uint32_t x, FontStyle fontStyle);
|
||||
static void drawSymbol(uint8_t symbolID); // Used for drawing symbols of a predictable width
|
||||
static void drawArea(int16_t x, int8_t y, uint8_t wide, uint8_t height, const uint8_t *ptr); // Draw an area, but y must be aligned on 0/8 offset
|
||||
static void drawAreaSwapped(int16_t x, int8_t y, uint8_t wide, uint8_t height, const uint8_t *ptr); // Draw an area, but y must be aligned on 0/8 offset
|
||||
@@ -104,8 +105,8 @@ public:
|
||||
private:
|
||||
static void drawChar(uint16_t charCode, FontStyle fontStyle); // Draw a character to the current cursor location
|
||||
static void setFramebuffer(uint8_t *buffer);
|
||||
static uint8_t * firstStripPtr; // Pointers to the strips to allow for buffer having extra content
|
||||
static uint8_t * secondStripPtr; // Pointers to the strips
|
||||
static uint8_t *firstStripPtr; // Pointers to the strips to allow for buffer having extra content
|
||||
static uint8_t *secondStripPtr; // Pointers to the strips
|
||||
static bool inLeftHandedMode; // Whether the screen is in left or not (used for offsets in GRAM)
|
||||
static bool initDone;
|
||||
static DisplayState displayState;
|
||||
|
||||
Reference in New Issue
Block a user