mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-26 20:26:32 +00:00
Fix DisplayRotate
* Fix DisplayRotate * Increase SSD1306 row count to 16 * Remove redundant Tasmota function from Adafruit ILI9341 library
This commit is contained in:
parent
b830e64d02
commit
8ac213e99d
@ -387,27 +387,15 @@ void Adafruit_ILI9341::begin(uint32_t freq)
|
|||||||
|
|
||||||
/*********************************************************************************************/
|
/*********************************************************************************************/
|
||||||
|
|
||||||
void Adafruit_ILI9341::setScrollStart(uint16_t start)
|
|
||||||
{
|
|
||||||
startWrite();
|
|
||||||
writeCommand(0x37);
|
|
||||||
spiWrite(start>>8);
|
|
||||||
spiWrite(start);
|
|
||||||
endWrite();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Adafruit_ILI9341::setScrollMargins(uint16_t top, uint16_t bottom)
|
void Adafruit_ILI9341::setScrollMargins(uint16_t top, uint16_t bottom)
|
||||||
{
|
{
|
||||||
uint16_t height = _height - (top + bottom);
|
uint16_t height = _height - (top + bottom);
|
||||||
|
|
||||||
startWrite();
|
startWrite();
|
||||||
writeCommand(0x33);
|
writeCommand(0x33);
|
||||||
spiWrite(top>>8);
|
SPI_WRITE16(top);
|
||||||
spiWrite(top);
|
SPI_WRITE16(height);
|
||||||
spiWrite(height>>8);
|
SPI_WRITE16(bottom);
|
||||||
spiWrite(height);
|
|
||||||
spiWrite(bottom>>8);
|
|
||||||
spiWrite(bottom);
|
|
||||||
endWrite();
|
endWrite();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,7 +133,6 @@ class Adafruit_ILI9341 : public Adafruit_GFX {
|
|||||||
void begin(uint32_t freq = 0, SPIClass &spi=SPI);
|
void begin(uint32_t freq = 0, SPIClass &spi=SPI);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void setScrollStart(uint16_t start);
|
|
||||||
void setScrollMargins(uint16_t top, uint16_t bottom);
|
void setScrollMargins(uint16_t top, uint16_t bottom);
|
||||||
|
|
||||||
void setRotation(uint8_t r);
|
void setRotation(uint8_t r);
|
||||||
|
@ -21,11 +21,10 @@
|
|||||||
#ifdef USE_DISPLAY
|
#ifdef USE_DISPLAY
|
||||||
|
|
||||||
#define DISPLAY_MAX_DRIVERS 16 // Max number of display drivers/models supported by xdsp_interface.ino
|
#define DISPLAY_MAX_DRIVERS 16 // Max number of display drivers/models supported by xdsp_interface.ino
|
||||||
|
#define DISPLAY_MAX_COLS 40 // Max number of columns to display
|
||||||
|
#define DISPLAY_MAX_ROWS 16 // Max number of lines to display for LCD and Oled using local screen buffer
|
||||||
|
|
||||||
#define DISPLAY_SCREEN_COLS 40 // Max number of columns to display
|
#define DISPLAY_LOG_COLS DISPLAY_MAX_COLS +1 // Number of characters in display log buffer line +1
|
||||||
#define DISPLAY_SCREEN_ROWS 8 // Max number of lines to display for LCD and Oled using local screen buffer
|
|
||||||
|
|
||||||
#define DISPLAY_LOG_COLS DISPLAY_SCREEN_COLS +1 // Number of characters in display log buffer line +1
|
|
||||||
#define DISPLAY_LOG_ROWS 32 // Number of lines in display log buffer
|
#define DISPLAY_LOG_ROWS 32 // Number of lines in display log buffer
|
||||||
|
|
||||||
#define D_CMND_DISPLAY "Display"
|
#define D_CMND_DISPLAY "Display"
|
||||||
@ -817,6 +816,7 @@ boolean DisplayCommand()
|
|||||||
else if (CMND_DISP_ROTATE == command_code) {
|
else if (CMND_DISP_ROTATE == command_code) {
|
||||||
if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload < 4)) {
|
if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload < 4)) {
|
||||||
Settings.display_rotate = XdrvMailbox.payload;
|
Settings.display_rotate = XdrvMailbox.payload;
|
||||||
|
DisplayInit(DISPLAY_INIT_MODE);
|
||||||
}
|
}
|
||||||
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_DISPLAY_COMMAND_NVALUE, command, Settings.display_rotate);
|
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_DISPLAY_COMMAND_NVALUE, command, Settings.display_rotate);
|
||||||
}
|
}
|
||||||
@ -825,7 +825,6 @@ boolean DisplayCommand()
|
|||||||
if (disp_device && XdrvMailbox.data_len > 0) {
|
if (disp_device && XdrvMailbox.data_len > 0) {
|
||||||
#ifndef USE_DISPLAY_MODES1TO5
|
#ifndef USE_DISPLAY_MODES1TO5
|
||||||
DisplayText();
|
DisplayText();
|
||||||
|
|
||||||
#else
|
#else
|
||||||
if (!Settings.display_mode) {
|
if (!Settings.display_mode) {
|
||||||
DisplayText();
|
DisplayText();
|
||||||
@ -854,13 +853,13 @@ boolean DisplayCommand()
|
|||||||
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_DISPLAY_COMMAND_NVALUE, command, Settings.display_refresh);
|
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_DISPLAY_COMMAND_NVALUE, command, Settings.display_refresh);
|
||||||
}
|
}
|
||||||
else if ((CMND_DISP_COLS == command_code) && (XdrvMailbox.index > 0) && (XdrvMailbox.index <= 2)) {
|
else if ((CMND_DISP_COLS == command_code) && (XdrvMailbox.index > 0) && (XdrvMailbox.index <= 2)) {
|
||||||
if ((XdrvMailbox.payload > 0) && (XdrvMailbox.payload <= DISPLAY_SCREEN_COLS)) {
|
if ((XdrvMailbox.payload > 0) && (XdrvMailbox.payload <= DISPLAY_MAX_COLS)) {
|
||||||
Settings.display_cols[XdrvMailbox.index -1] = XdrvMailbox.payload;
|
Settings.display_cols[XdrvMailbox.index -1] = XdrvMailbox.payload;
|
||||||
}
|
}
|
||||||
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_DISPLAY_COMMAND_INDEX_NVALUE, command, XdrvMailbox.index, Settings.display_cols[XdrvMailbox.index -1]);
|
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_DISPLAY_COMMAND_INDEX_NVALUE, command, XdrvMailbox.index, Settings.display_cols[XdrvMailbox.index -1]);
|
||||||
}
|
}
|
||||||
else if (CMND_DISP_ROWS == command_code) {
|
else if (CMND_DISP_ROWS == command_code) {
|
||||||
if ((XdrvMailbox.payload > 0) && (XdrvMailbox.payload <= DISPLAY_SCREEN_ROWS)) {
|
if ((XdrvMailbox.payload > 0) && (XdrvMailbox.payload <= DISPLAY_MAX_ROWS)) {
|
||||||
Settings.display_rows = XdrvMailbox.payload;
|
Settings.display_rows = XdrvMailbox.payload;
|
||||||
}
|
}
|
||||||
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_DISPLAY_COMMAND_NVALUE, command, Settings.display_rows);
|
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_DISPLAY_COMMAND_NVALUE, command, Settings.display_rows);
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#define OLED_ADDRESS2 0x3D // Oled 128x64 I2C address
|
#define OLED_ADDRESS2 0x3D // Oled 128x64 I2C address
|
||||||
|
|
||||||
#define OLED_BUFFER_COLS 40 // Max number of columns in display shadow buffer
|
#define OLED_BUFFER_COLS 40 // Max number of columns in display shadow buffer
|
||||||
#define OLED_BUFFER_ROWS 8 // Max number of lines in display shadow buffer
|
#define OLED_BUFFER_ROWS 16 // Max number of lines in display shadow buffer
|
||||||
|
|
||||||
#define OLED_FONT_WIDTH 6
|
#define OLED_FONT_WIDTH 6
|
||||||
#define OLED_FONT_HEIGTH 8
|
#define OLED_FONT_HEIGTH 8
|
||||||
|
@ -133,7 +133,8 @@ void Ili9341PrintLogLine()
|
|||||||
byte size = Settings.display_size;
|
byte size = Settings.display_size;
|
||||||
tft->setTextSize(size);
|
tft->setTextSize(size);
|
||||||
uint16_t theight = size * TFT_FONT_HEIGTH;
|
uint16_t theight = size * TFT_FONT_HEIGTH;
|
||||||
tft->fillRect(0, tft_scroll, tft->width(), theight, ILI9341_BLACK);
|
|
||||||
|
tft->fillRect(0, tft_scroll, tft->width(), theight, ILI9341_BLACK); // Erase line
|
||||||
|
|
||||||
char *pch = strchr(disp_log_buffer[disp_log_buffer_ptr],'~'); // = 0x7E (~) Replace degrees character (276 octal)
|
char *pch = strchr(disp_log_buffer[disp_log_buffer_ptr],'~'); // = 0x7E (~) Replace degrees character (276 octal)
|
||||||
if (pch != NULL) {
|
if (pch != NULL) {
|
||||||
@ -148,7 +149,7 @@ void Ili9341PrintLogLine()
|
|||||||
if (tft_scroll >= (tft->height() - TFT_BOTTOM)) {
|
if (tft_scroll >= (tft->height() - TFT_BOTTOM)) {
|
||||||
tft_scroll = TFT_TOP;
|
tft_scroll = TFT_TOP;
|
||||||
}
|
}
|
||||||
tft->setScrollStart(tft_scroll);
|
tft->scrollTo(tft_scroll);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ili9341PrintLog()
|
void Ili9341PrintLog()
|
||||||
@ -181,6 +182,7 @@ void Ili9341Refresh() // Every second
|
|||||||
tft->print(tftdt);
|
tft->print(tftdt);
|
||||||
|
|
||||||
switch (Settings.display_mode) {
|
switch (Settings.display_mode) {
|
||||||
|
case 1: // Text
|
||||||
case 2: // Local
|
case 2: // Local
|
||||||
case 3: // Local
|
case 3: // Local
|
||||||
case 4: // Mqtt
|
case 4: // Mqtt
|
||||||
|
Loading…
x
Reference in New Issue
Block a user