Merge remote-tracking branch 'origin/master' into develop
This commit is contained in:
commit
2c121b3d8e
1 changed files with 28 additions and 0 deletions
|
@ -271,6 +271,10 @@ static void rotate_90(const uint8_t *src, uint8_t *dest) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void oled_render(void) {
|
void oled_render(void) {
|
||||||
|
if (!oled_initialized) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Do we have work to do?
|
// Do we have work to do?
|
||||||
oled_dirty &= OLED_ALL_BLOCKS_MASK;
|
oled_dirty &= OLED_ALL_BLOCKS_MASK;
|
||||||
if (!oled_dirty || oled_scrolling) {
|
if (!oled_dirty || oled_scrolling) {
|
||||||
|
@ -527,6 +531,10 @@ void oled_write_raw_P(const char *data, uint16_t size) {
|
||||||
#endif // defined(__AVR__)
|
#endif // defined(__AVR__)
|
||||||
|
|
||||||
bool oled_on(void) {
|
bool oled_on(void) {
|
||||||
|
if (!oled_initialized) {
|
||||||
|
return oled_active;
|
||||||
|
}
|
||||||
|
|
||||||
#if OLED_TIMEOUT > 0
|
#if OLED_TIMEOUT > 0
|
||||||
oled_timeout = timer_read32() + OLED_TIMEOUT;
|
oled_timeout = timer_read32() + OLED_TIMEOUT;
|
||||||
#endif
|
#endif
|
||||||
|
@ -543,6 +551,10 @@ bool oled_on(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool oled_off(void) {
|
bool oled_off(void) {
|
||||||
|
if (!oled_initialized) {
|
||||||
|
return !oled_active;
|
||||||
|
}
|
||||||
|
|
||||||
static const uint8_t PROGMEM display_off[] = {I2C_CMD, DISPLAY_OFF};
|
static const uint8_t PROGMEM display_off[] = {I2C_CMD, DISPLAY_OFF};
|
||||||
if (oled_active) {
|
if (oled_active) {
|
||||||
if (I2C_TRANSMIT_P(display_off) != I2C_STATUS_SUCCESS) {
|
if (I2C_TRANSMIT_P(display_off) != I2C_STATUS_SUCCESS) {
|
||||||
|
@ -557,6 +569,10 @@ bool oled_off(void) {
|
||||||
bool is_oled_on(void) { return oled_active; }
|
bool is_oled_on(void) { return oled_active; }
|
||||||
|
|
||||||
uint8_t oled_set_brightness(uint8_t level) {
|
uint8_t oled_set_brightness(uint8_t level) {
|
||||||
|
if (!oled_initialized) {
|
||||||
|
return oled_brightness;
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t set_contrast[] = {I2C_CMD, CONTRAST, level};
|
uint8_t set_contrast[] = {I2C_CMD, CONTRAST, level};
|
||||||
if (oled_brightness != level) {
|
if (oled_brightness != level) {
|
||||||
if (I2C_TRANSMIT(set_contrast) != I2C_STATUS_SUCCESS) {
|
if (I2C_TRANSMIT(set_contrast) != I2C_STATUS_SUCCESS) {
|
||||||
|
@ -596,6 +612,10 @@ void oled_scroll_set_speed(uint8_t speed) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool oled_scroll_right(void) {
|
bool oled_scroll_right(void) {
|
||||||
|
if (!oled_initialized) {
|
||||||
|
return oled_scrolling;
|
||||||
|
}
|
||||||
|
|
||||||
// Dont enable scrolling if we need to update the display
|
// Dont enable scrolling if we need to update the display
|
||||||
// This prevents scrolling of bad data from starting the scroll too early after init
|
// This prevents scrolling of bad data from starting the scroll too early after init
|
||||||
if (!oled_dirty && !oled_scrolling) {
|
if (!oled_dirty && !oled_scrolling) {
|
||||||
|
@ -610,6 +630,10 @@ bool oled_scroll_right(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool oled_scroll_left(void) {
|
bool oled_scroll_left(void) {
|
||||||
|
if (!oled_initialized) {
|
||||||
|
return oled_scrolling;
|
||||||
|
}
|
||||||
|
|
||||||
// Dont enable scrolling if we need to update the display
|
// Dont enable scrolling if we need to update the display
|
||||||
// This prevents scrolling of bad data from starting the scroll too early after init
|
// This prevents scrolling of bad data from starting the scroll too early after init
|
||||||
if (!oled_dirty && !oled_scrolling) {
|
if (!oled_dirty && !oled_scrolling) {
|
||||||
|
@ -624,6 +648,10 @@ bool oled_scroll_left(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool oled_scroll_off(void) {
|
bool oled_scroll_off(void) {
|
||||||
|
if (!oled_initialized) {
|
||||||
|
return !oled_scrolling;
|
||||||
|
}
|
||||||
|
|
||||||
if (oled_scrolling) {
|
if (oled_scrolling) {
|
||||||
static const uint8_t PROGMEM display_scroll_off[] = {I2C_CMD, DEACTIVATE_SCROLL};
|
static const uint8_t PROGMEM display_scroll_off[] = {I2C_CMD, DEACTIVATE_SCROLL};
|
||||||
if (I2C_TRANSMIT_P(display_scroll_off) != I2C_STATUS_SUCCESS) {
|
if (I2C_TRANSMIT_P(display_scroll_off) != I2C_STATUS_SUCCESS) {
|
||||||
|
|
Loading…
Reference in a new issue