Show power source type on detailed screen in soldering mode (#1708) (#1709)

* Show power source type on detailed screen in soldering mode (#1708)

* Update according to code review
This commit is contained in:
Ivan Zorin
2023-06-18 14:38:26 +03:00
committed by GitHub
parent 4d7e4f41e3
commit a1b9e40f67
7 changed files with 55 additions and 43 deletions

View File

@@ -404,14 +404,14 @@ void OLED::setInverseDisplay(bool inverse) {
I2C_CLASS::I2C_RegisterWrite(DEVICEADDR_OLED, 0x80, normalInverseCmd);
}
// print a string to the current cursor location
void OLED::print(const char *const str, FontStyle fontStyle) {
// print a string to the current cursor location, len chars MAX
void OLED::print(const char *const str, FontStyle fontStyle, uint8_t len) {
const uint8_t *next = reinterpret_cast<const uint8_t *>(str);
if (next[0] == 0x01) {
fontStyle = FontStyle::LARGE;
next++;
}
while (next[0]) {
while (next[0] && len--) {
uint16_t index;
if (next[0] <= 0xF0) {
index = next[0];

View File

@@ -105,7 +105,7 @@ public:
static void setBrightness(uint8_t contrast);
static void setInverseDisplay(bool inverted);
static int16_t getCursorX() { return cursor_x; }
static void print(const char *string, FontStyle fontStyle); // Draw a string to the current location, with selected font
static void print(const char *string, FontStyle fontStyle, uint8_t length = 255); // Draw a string to the current location, with selected font; optionally - with MAX length only
static void printWholeScreen(const char *string);
// Set the cursor location by pixels
static void setCursor(int16_t x, int16_t y) {