DeviceID (#1314)
* Ability to print hex * Add device ID getter * Refactor debug menu * No longer need patch * Update make_translation.py * Fix typo * Fix hex drawing
This commit is contained in:
@@ -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