Add display features

* Add command DisplayWidth to set pixel width on supported devices
 * Add command DisplayHeight to set pixel height on supported devices
 * Add Oled reset GPIO option "OLED reset"
This commit is contained in:
Theo Arends 2019-07-23 14:05:42 +02:00
parent 3c62507f38
commit 546653a8f2
32 changed files with 110 additions and 30 deletions

View File

@ -25,8 +25,8 @@
#define _Adafruit_SSD1306_H_
// ONE of the following three lines must be #defined:
#define SSD1306_128_64 ///< DEPRECTAED: old way to specify 128x64 screen
//#define SSD1306_128_32 ///< DEPRECATED: old way to specify 128x32 screen
//#define SSD1306_128_64 ///< DEPRECTAED: old way to specify 128x64 screen
#define SSD1306_128_32 ///< DEPRECATED: old way to specify 128x32 screen
//#define SSD1306_96_16 ///< DEPRECATED: old way to specify 96x16 screen
// This establishes the screen dimensions in old Adafruit_SSD1306 sketches
// (NEW CODE SHOULD IGNORE THIS, USE THE CONSTRUCTORS THAT ACCEPT WIDTH
@ -108,7 +108,7 @@
#define SSD1306_LCDHEIGHT 16 ///< DEPRECATED: height w/SSD1306_96_16 defined
#endif
/*!
/*!
@brief Class that stores state and functions for interacting with
SSD1306 OLED displays.
*/

View File

@ -1,12 +1,15 @@
/*********************************************************************************************\
* 6.6.0.2 20190714
* Add command SetOption67 0/1 to disable or enable a buzzer as used in iFan03
* Add command DisplayWidth to set pixel width on supported devices
* Add command DisplayHeight to set pixel height on supported devices
* Add support for Sonoff iFan03 as module 71 (#5988)
* Add support for a buzzer
* Add command SetOption67 0/1 to disable or enable a buzzer as used in iFan03
* Add support for IRSend long press ('repeat' feature from IRRemoteESP8266) (#6074)
* Add support for IRHVAC Midea/Komeco protocol (#3227)
* Add support for more IRSend protocols enabled in my_user_config.h
* Add support for IRSend Pioneer protocol (#6100)
* Add Oled reset GPIO option "OLED reset"
*
* 6.6.0.1 20190708
* Fix Domoticz battery level set to 100 if define USE_ADC_VCC is not used (#6033)

View File

@ -587,6 +587,7 @@
#define D_SENSOR_HRE_DATA "HRE Data"
#define D_SENSOR_ADE7953_IRQ "ADE7953 IRQ"
#define D_SENSOR_BUZZER "Buzzer"
#define D_SENSOR_OLED_RESET "OLED Reset"
// Units
#define D_UNIT_AMPERE "A"

View File

@ -526,7 +526,7 @@
#define D_SENSOR_SAIR_TX "SAir Tx"
#define D_SENSOR_SPI_CS "SPI CS"
#define D_SENSOR_SPI_DC "SPI DC"
#define D_SENSOR_BACKLIGHT "BkLight"
#define D_SENSOR_BACKLIGHT "Backlight"
#define D_SENSOR_PMS5003 "PMS5003"
#define D_SENSOR_SDS0X1_RX "SDS0X1 Rx"
#define D_SENSOR_SDS0X1_TX "SDS0X1 Tx"
@ -586,6 +586,7 @@
#define D_SENSOR_HRE_DATA "HRE Data"
#define D_SENSOR_ADE7953_IRQ "ADE7953 IRQ"
#define D_SENSOR_BUZZER "Buzzer"
#define D_SENSOR_OLED_RESET "OLED Reset"
// Units
#define D_UNIT_AMPERE "A"

View File

@ -526,7 +526,7 @@
#define D_SENSOR_SAIR_TX "SAir Tx"
#define D_SENSOR_SPI_CS "SPI CS"
#define D_SENSOR_SPI_DC "SPI DC"
#define D_SENSOR_BACKLIGHT "BkLight"
#define D_SENSOR_BACKLIGHT "Backlight"
#define D_SENSOR_PMS5003 "PMS5003"
#define D_SENSOR_SDS0X1_RX "SDS0X1 Rx"
#define D_SENSOR_SDS0X1_TX "SDS0X1 Tx"
@ -586,6 +586,7 @@
#define D_SENSOR_HRE_DATA "HRE Data"
#define D_SENSOR_ADE7953_IRQ "ADE7953 IRQ"
#define D_SENSOR_BUZZER "Buzzer"
#define D_SENSOR_OLED_RESET "OLED Reset"
// Units
#define D_UNIT_AMPERE "A"

View File

@ -526,7 +526,7 @@
#define D_SENSOR_SAIR_TX "SAir Tx"
#define D_SENSOR_SPI_CS "SPI CS"
#define D_SENSOR_SPI_DC "SPI DC"
#define D_SENSOR_BACKLIGHT "BkLight"
#define D_SENSOR_BACKLIGHT "Backlight"
#define D_SENSOR_PMS5003 "PMS5003"
#define D_SENSOR_SDS0X1_RX "SDS0X1 Rx"
#define D_SENSOR_SDS0X1_TX "SDS0X1 Tx"
@ -586,6 +586,7 @@
#define D_SENSOR_HRE_DATA "HRE Data"
#define D_SENSOR_ADE7953_IRQ "ADE7953 IRQ"
#define D_SENSOR_BUZZER "Buzzer"
#define D_SENSOR_OLED_RESET "OLED Reset"
// Units
#define D_UNIT_AMPERE "A"

View File

@ -526,7 +526,7 @@
#define D_SENSOR_SAIR_TX "SAir Tx"
#define D_SENSOR_SPI_CS "SPI CS"
#define D_SENSOR_SPI_DC "SPI DC"
#define D_SENSOR_BACKLIGHT "BkLight"
#define D_SENSOR_BACKLIGHT "Backlight"
#define D_SENSOR_PMS5003 "PMS5003"
#define D_SENSOR_SDS0X1_RX "SDS0X1 Rx"
#define D_SENSOR_SDS0X1_TX "SDS0X1 Tx"
@ -586,6 +586,7 @@
#define D_SENSOR_HRE_DATA "HRE Data"
#define D_SENSOR_ADE7953_IRQ "ADE7953 IRQ"
#define D_SENSOR_BUZZER "Buzzer"
#define D_SENSOR_OLED_RESET "OLED Reset"
// Units
#define D_UNIT_AMPERE "A"

View File

@ -526,7 +526,7 @@
#define D_SENSOR_SAIR_TX "SAir Tx"
#define D_SENSOR_SPI_CS "SPI CS"
#define D_SENSOR_SPI_DC "SPI DC"
#define D_SENSOR_BACKLIGHT "BkLight"
#define D_SENSOR_BACKLIGHT "Backlight"
#define D_SENSOR_PMS5003 "PMS5003"
#define D_SENSOR_SDS0X1_RX "SDS0X1 Rx"
#define D_SENSOR_SDS0X1_TX "SDS0X1 Tx"
@ -586,6 +586,7 @@
#define D_SENSOR_HRE_DATA "HRE Data"
#define D_SENSOR_ADE7953_IRQ "ADE7953 IRQ"
#define D_SENSOR_BUZZER "Buzzer"
#define D_SENSOR_OLED_RESET "OLED Reset"
// Units
#define D_UNIT_AMPERE "A"

View File

@ -586,6 +586,7 @@
#define D_SENSOR_HRE_DATA "HRE Data"
#define D_SENSOR_ADE7953_IRQ "ADE7953 IRQ"
#define D_SENSOR_BUZZER "Buzzer"
#define D_SENSOR_OLED_RESET "OLED Reset"
// Units
#define D_UNIT_AMPERE "A"

View File

@ -526,7 +526,7 @@
#define D_SENSOR_SAIR_TX "SAir Tx"
#define D_SENSOR_SPI_CS "SPI CS"
#define D_SENSOR_SPI_DC "SPI DC"
#define D_SENSOR_BACKLIGHT "BkLight"
#define D_SENSOR_BACKLIGHT "Backlight"
#define D_SENSOR_PMS5003 "PMS5003"
#define D_SENSOR_SDS0X1_RX "SDS0X1 Rx"
#define D_SENSOR_SDS0X1_TX "SDS0X1 Tx"
@ -586,6 +586,7 @@
#define D_SENSOR_HRE_DATA "HRE Data"
#define D_SENSOR_ADE7953_IRQ "ADE7953 IRQ"
#define D_SENSOR_BUZZER "Buzzer"
#define D_SENSOR_OLED_RESET "OLED Reset"
// Units
#define D_UNIT_AMPERE "A"

View File

@ -586,6 +586,7 @@
#define D_SENSOR_HRE_DATA "HRE Data"
#define D_SENSOR_ADE7953_IRQ "ADE7953 IRQ"
#define D_SENSOR_BUZZER "Buzzer"
#define D_SENSOR_OLED_RESET "OLED Reset"
// Units
#define D_UNIT_AMPERE "A"

View File

@ -526,7 +526,7 @@
#define D_SENSOR_SAIR_TX "SAir Tx"
#define D_SENSOR_SPI_CS "SPI CS"
#define D_SENSOR_SPI_DC "SPI DC"
#define D_SENSOR_BACKLIGHT "BkLight"
#define D_SENSOR_BACKLIGHT "Backlight"
#define D_SENSOR_PMS5003 "PMS5003"
#define D_SENSOR_SDS0X1_RX "SDS0X1 Rx"
#define D_SENSOR_SDS0X1_TX "SDS0X1 Tx"
@ -586,6 +586,7 @@
#define D_SENSOR_HRE_DATA "HRE Data"
#define D_SENSOR_ADE7953_IRQ "ADE7953 IRQ"
#define D_SENSOR_BUZZER "Buzzer"
#define D_SENSOR_OLED_RESET "OLED Reset"
// Units
#define D_UNIT_AMPERE "A"

View File

@ -526,7 +526,7 @@
#define D_SENSOR_SAIR_TX "SAir Tx"
#define D_SENSOR_SPI_CS "SPI CS"
#define D_SENSOR_SPI_DC "SPI DC"
#define D_SENSOR_BACKLIGHT "BkLight"
#define D_SENSOR_BACKLIGHT "Backlight"
#define D_SENSOR_PMS5003 "PMS5003"
#define D_SENSOR_SDS0X1_RX "SDS0X1 Rx"
#define D_SENSOR_SDS0X1_TX "SDS0X1 Tx"
@ -586,6 +586,7 @@
#define D_SENSOR_HRE_DATA "HRE Data"
#define D_SENSOR_ADE7953_IRQ "ADE7953 IRQ"
#define D_SENSOR_BUZZER "Buzzer"
#define D_SENSOR_OLED_RESET "OLED Reset"
// Units
#define D_UNIT_AMPERE "A"

View File

@ -526,7 +526,7 @@
#define D_SENSOR_SAIR_TX "SAir Tx"
#define D_SENSOR_SPI_CS "SPI CS"
#define D_SENSOR_SPI_DC "SPI DC"
#define D_SENSOR_BACKLIGHT "BkLight"
#define D_SENSOR_BACKLIGHT "Backlight"
#define D_SENSOR_PMS5003 "PMS5003"
#define D_SENSOR_SDS0X1_RX "SDS0X1 Rx"
#define D_SENSOR_SDS0X1_TX "SDS0X1 Tx"
@ -586,6 +586,7 @@
#define D_SENSOR_HRE_DATA "HRE Data"
#define D_SENSOR_ADE7953_IRQ "ADE7953 IRQ"
#define D_SENSOR_BUZZER "Zoemer"
#define D_SENSOR_OLED_RESET "OLED Reset"
// Units
#define D_UNIT_AMPERE "A"

View File

@ -526,7 +526,7 @@
#define D_SENSOR_SAIR_TX "SAir Tx"
#define D_SENSOR_SPI_CS "SPI CS"
#define D_SENSOR_SPI_DC "SPI DC"
#define D_SENSOR_BACKLIGHT "BkLight"
#define D_SENSOR_BACKLIGHT "Backlight"
#define D_SENSOR_PMS5003 "PMS5003"
#define D_SENSOR_SDS0X1_RX "SDS0X1 Rx"
#define D_SENSOR_SDS0X1_TX "SDS0X1 Tx"
@ -586,6 +586,7 @@
#define D_SENSOR_HRE_DATA "HRE Data"
#define D_SENSOR_ADE7953_IRQ "ADE7953 IRQ"
#define D_SENSOR_BUZZER "Buzzer"
#define D_SENSOR_OLED_RESET "OLED Reset"
// Units
#define D_UNIT_AMPERE "A"

View File

@ -586,6 +586,7 @@
#define D_SENSOR_HRE_DATA "HRE Data"
#define D_SENSOR_ADE7953_IRQ "ADE7953 IRQ"
#define D_SENSOR_BUZZER "Buzzer"
#define D_SENSOR_OLED_RESET "OLED Reset"
// Units
#define D_UNIT_AMPERE "A"

View File

@ -586,6 +586,7 @@
#define D_SENSOR_HRE_DATA "HRE Data"
#define D_SENSOR_ADE7953_IRQ "ADE7953 IRQ"
#define D_SENSOR_BUZZER "Buzzer"
#define D_SENSOR_OLED_RESET "OLED Reset"
// Units
#define D_UNIT_AMPERE "A"

View File

@ -526,7 +526,7 @@
#define D_SENSOR_SAIR_TX "SAir Tx"
#define D_SENSOR_SPI_CS "SPI CS"
#define D_SENSOR_SPI_DC "SPI DC"
#define D_SENSOR_BACKLIGHT "BkLight"
#define D_SENSOR_BACKLIGHT "Backlight"
#define D_SENSOR_PMS5003 "PMS5003"
#define D_SENSOR_SDS0X1_RX "SDS0X1 Rx"
#define D_SENSOR_SDS0X1_TX "SDS0X1 Tx"
@ -586,6 +586,7 @@
#define D_SENSOR_HRE_DATA "HRE Data"
#define D_SENSOR_ADE7953_IRQ "ADE7953 IRQ"
#define D_SENSOR_BUZZER "Buzzer"
#define D_SENSOR_OLED_RESET "OLED Reset"
// Units
#define D_UNIT_AMPERE "А"

View File

@ -526,7 +526,7 @@
#define D_SENSOR_SAIR_TX "SAir Tx"
#define D_SENSOR_SPI_CS "SPI CS"
#define D_SENSOR_SPI_DC "SPI DC"
#define D_SENSOR_BACKLIGHT "BkLight"
#define D_SENSOR_BACKLIGHT "Backlight"
#define D_SENSOR_PMS5003 "PMS5003"
#define D_SENSOR_SDS0X1_RX "SDS0X1 Rx"
#define D_SENSOR_SDS0X1_TX "SDS0X1 Tx"
@ -586,6 +586,7 @@
#define D_SENSOR_HRE_DATA "HRE Data"
#define D_SENSOR_ADE7953_IRQ "ADE7953 IRQ"
#define D_SENSOR_BUZZER "Buzzer"
#define D_SENSOR_OLED_RESET "OLED Reset"
// Units
#define D_UNIT_AMPERE "A"

View File

@ -526,7 +526,7 @@
#define D_SENSOR_SAIR_TX "SAir Tx"
#define D_SENSOR_SPI_CS "SPI CS"
#define D_SENSOR_SPI_DC "SPI DC"
#define D_SENSOR_BACKLIGHT "BkLight"
#define D_SENSOR_BACKLIGHT "Backlight"
#define D_SENSOR_PMS5003 "PMS5003"
#define D_SENSOR_SDS0X1_RX "SDS0X1 Rx"
#define D_SENSOR_SDS0X1_TX "SDS0X1 Tx"
@ -586,6 +586,7 @@
#define D_SENSOR_HRE_DATA "HRE Data"
#define D_SENSOR_ADE7953_IRQ "ADE7953 IRQ"
#define D_SENSOR_BUZZER "Buzzer"
#define D_SENSOR_OLED_RESET "OLED Reset"
// Units
#define D_UNIT_AMPERE "A"

View File

@ -526,7 +526,7 @@
#define D_SENSOR_SAIR_TX "SAir Tx"
#define D_SENSOR_SPI_CS "SPI CS"
#define D_SENSOR_SPI_DC "SPI DC"
#define D_SENSOR_BACKLIGHT "BkLight"
#define D_SENSOR_BACKLIGHT "Backlight"
#define D_SENSOR_PMS5003 "PMS5003"
#define D_SENSOR_SDS0X1_RX "SDS0X1 Rx"
#define D_SENSOR_SDS0X1_TX "SDS0X1 Tx"
@ -586,6 +586,7 @@
#define D_SENSOR_HRE_DATA "HRE Data"
#define D_SENSOR_ADE7953_IRQ "ADE7953 IRQ"
#define D_SENSOR_BUZZER "Buzzer"
#define D_SENSOR_OLED_RESET "OLED Reset"
// Units
#define D_UNIT_AMPERE "A"

View File

@ -526,7 +526,7 @@
#define D_SENSOR_SAIR_TX "SAir Tx"
#define D_SENSOR_SPI_CS "SPI CS"
#define D_SENSOR_SPI_DC "SPI DC"
#define D_SENSOR_BACKLIGHT "BkLight"
#define D_SENSOR_BACKLIGHT "Backlight"
#define D_SENSOR_PMS5003 "PMS5003"
#define D_SENSOR_SDS0X1_RX "SDS0X1 Rx"
#define D_SENSOR_SDS0X1_TX "SDS0X1 Tx"
@ -586,6 +586,7 @@
#define D_SENSOR_HRE_DATA "HRE Data"
#define D_SENSOR_ADE7953_IRQ "ADE7953 IRQ"
#define D_SENSOR_BUZZER "Buzzer"
#define D_SENSOR_OLED_RESET "OLED Reset"
// Units
#define D_UNIT_AMPERE "А"

View File

@ -526,7 +526,7 @@
#define D_SENSOR_SAIR_TX "SAir Tx"
#define D_SENSOR_SPI_CS "SPI CS"
#define D_SENSOR_SPI_DC "SPI DC"
#define D_SENSOR_BACKLIGHT "BkLight"
#define D_SENSOR_BACKLIGHT "Backlight"
#define D_SENSOR_PMS5003 "PMS5003"
#define D_SENSOR_SDS0X1_RX "SDS0X1 Rx"
#define D_SENSOR_SDS0X1_TX "SDS0X1 Tx"
@ -586,6 +586,7 @@
#define D_SENSOR_HRE_DATA "HRE Data"
#define D_SENSOR_ADE7953_IRQ "ADE7953 IRQ"
#define D_SENSOR_BUZZER "Buzzer"
#define D_SENSOR_OLED_RESET "OLED Reset"
// Units
#define D_UNIT_AMPERE "安"

View File

@ -526,7 +526,7 @@
#define D_SENSOR_SAIR_TX "SAir Tx"
#define D_SENSOR_SPI_CS "SPI CS"
#define D_SENSOR_SPI_DC "SPI DC"
#define D_SENSOR_BACKLIGHT "BkLight"
#define D_SENSOR_BACKLIGHT "Backlight"
#define D_SENSOR_PMS5003 "PMS5003"
#define D_SENSOR_SDS0X1_RX "SDS0X1 Rx"
#define D_SENSOR_SDS0X1_TX "SDS0X1 Tx"
@ -586,6 +586,7 @@
#define D_SENSOR_HRE_DATA "HRE Data"
#define D_SENSOR_ADE7953_IRQ "ADE7953 IRQ"
#define D_SENSOR_BUZZER "Buzzer"
#define D_SENSOR_OLED_RESET "OLED Reset"
// Units
#define D_UNIT_AMPERE "安"

View File

@ -334,8 +334,10 @@ struct SYSCFG {
mytmplt user_template; // 720 29 bytes
uint8_t novasds_period; // 73D
uint8_t web_color[18][3]; // 73E
uint16_t display_width; // 774
uint16_t display_height; // 776
uint8_t free_774[32]; // 774
uint8_t free_778[28]; // 778
// uint32_t drivers[3]; // 794 - 6.5.0.12 replaced by below three entries
uint32_t adc_param1; // 794

View File

@ -186,6 +186,7 @@ enum UserSelectablePins {
GPIO_ARIRFSEL, // Arilux RF Receive input selected
GPIO_BUZZER, // Buzzer
GPIO_BUZZER_INV, // Inverted buzzer
GPIO_OLED_RESET, // OLED Display Reset
GPIO_SENSOR_END };
// Programmer selectable GPIO functionality
@ -254,6 +255,7 @@ const char kSensorNames[] PROGMEM =
D_SENSOR_LED_LINK "|" D_SENSOR_LED_LINK "i|"
D_SENSOR_ARIRFSEL "|"
D_SENSOR_BUZZER "|" D_SENSOR_BUZZER "i|"
D_SENSOR_OLED_RESET "|"
;
// User selectable ADC0 functionality
@ -499,6 +501,7 @@ const uint8_t kGpioNiceList[] PROGMEM = {
#endif
#ifdef USE_DISPLAY
GPIO_BACKLIGHT, // Display backlight control
GPIO_OLED_RESET, // OLED Display Reset
#endif
#ifdef USE_DHT
GPIO_DHT11, // DHT11

View File

@ -40,6 +40,8 @@ const uint8_t DISPLAY_LOG_ROWS = 32; // Number of lines in display log
#define D_CMND_DISP_FONT "Font"
#define D_CMND_DISP_ROTATE "Rotate"
#define D_CMND_DISP_TEXT "Text"
#define D_CMND_DISP_WIDTH "Width"
#define D_CMND_DISP_HEIGHT "Height"
enum XdspFunctions { FUNC_DISPLAY_INIT_DRIVER, FUNC_DISPLAY_INIT, FUNC_DISPLAY_EVERY_50_MSECOND, FUNC_DISPLAY_EVERY_SECOND,
FUNC_DISPLAY_MODEL, FUNC_DISPLAY_MODE, FUNC_DISPLAY_POWER,
@ -51,11 +53,11 @@ enum XdspFunctions { FUNC_DISPLAY_INIT_DRIVER, FUNC_DISPLAY_INIT, FUNC_DISPLAY_E
enum DisplayInitModes { DISPLAY_INIT_MODE, DISPLAY_INIT_PARTIAL, DISPLAY_INIT_FULL };
enum DisplayCommands { CMND_DISPLAY, CMND_DISP_MODEL, CMND_DISP_MODE, CMND_DISP_REFRESH, CMND_DISP_DIMMER, CMND_DISP_COLS, CMND_DISP_ROWS,
CMND_DISP_SIZE, CMND_DISP_FONT, CMND_DISP_ROTATE, CMND_DISP_TEXT, CMND_DISP_ADDRESS };
enum DisplayCommands { CMND_DISPLAY, CMND_DISP_MODEL, CMND_DISP_WIDTH, CMND_DISP_HEIGHT, CMND_DISP_MODE, CMND_DISP_REFRESH, CMND_DISP_DIMMER,
CMND_DISP_COLS, CMND_DISP_ROWS, CMND_DISP_SIZE, CMND_DISP_FONT, CMND_DISP_ROTATE, CMND_DISP_TEXT, CMND_DISP_ADDRESS };
const char kDisplayCommands[] PROGMEM =
"|" D_CMND_DISP_MODEL "|" D_CMND_DISP_MODE "|" D_CMND_DISP_REFRESH "|" D_CMND_DISP_DIMMER "|" D_CMND_DISP_COLS "|" D_CMND_DISP_ROWS "|"
D_CMND_DISP_SIZE "|" D_CMND_DISP_FONT "|" D_CMND_DISP_ROTATE "|" D_CMND_DISP_TEXT "|" D_CMND_DISP_ADDRESS ;
"|" D_CMND_DISP_MODEL "|" D_CMND_DISP_MODE "|" D_CMND_DISP_WIDTH "|" D_CMND_DISP_HEIGHT "|" D_CMND_DISP_REFRESH "|" D_CMND_DISP_DIMMER "|"
D_CMND_DISP_COLS "|" D_CMND_DISP_ROWS "|" D_CMND_DISP_SIZE "|" D_CMND_DISP_FONT "|" D_CMND_DISP_ROTATE "|" D_CMND_DISP_TEXT "|" D_CMND_DISP_ADDRESS ;
const char S_JSON_DISPLAY_COMMAND_VALUE[] PROGMEM = "{\"" D_CMND_DISPLAY "%s\":\"%s\"}";
const char S_JSON_DISPLAY_COMMAND_NVALUE[] PROGMEM = "{\"" D_CMND_DISPLAY "%s\":%d}";
@ -919,9 +921,11 @@ bool DisplayCommand(void)
serviced = false; // Unknown command
}
else if (CMND_DISPLAY == command_code) {
Response_P(PSTR("{\"" D_CMND_DISPLAY "\":{\"" D_CMND_DISP_MODEL "\":%d,\"" D_CMND_DISP_MODE "\":%d,\"" D_CMND_DISP_DIMMER "\":%d,\""
D_CMND_DISP_SIZE "\":%d,\"" D_CMND_DISP_FONT "\":%d,\"" D_CMND_DISP_ROTATE "\":%d,\"" D_CMND_DISP_REFRESH "\":%d,\"" D_CMND_DISP_COLS "\":[%d,%d],\"" D_CMND_DISP_ROWS "\":%d}}"),
Settings.display_model, Settings.display_mode, Settings.display_dimmer, Settings.display_size, Settings.display_font, Settings.display_rotate, Settings.display_refresh,
Response_P(PSTR("{\"" D_CMND_DISPLAY "\":{\"" D_CMND_DISP_MODEL "\":%d,\"" D_CMND_DISP_WIDTH "\":%d,\"" D_CMND_DISP_HEIGHT "\":%d,\"" D_CMND_DISP_MODE "\":%d,\""
D_CMND_DISP_DIMMER "\":%d,\"" D_CMND_DISP_SIZE "\":%d,\"" D_CMND_DISP_FONT "\":%d,\"" D_CMND_DISP_ROTATE "\":%d,\"" D_CMND_DISP_REFRESH "\":%d,\""
D_CMND_DISP_COLS "\":[%d,%d],\"" D_CMND_DISP_ROWS "\":%d}}"),
Settings.display_model, Settings.display_width, Settings.display_height, Settings.display_mode,
Settings.display_dimmer, Settings.display_size, Settings.display_font, Settings.display_rotate, Settings.display_refresh,
Settings.display_cols[0], Settings.display_cols[1], Settings.display_rows);
}
else if (CMND_DISP_MODEL == command_code) {
@ -936,6 +940,24 @@ bool DisplayCommand(void)
}
Response_P(S_JSON_DISPLAY_COMMAND_NVALUE, command, Settings.display_model);
}
else if (CMND_DISP_WIDTH == command_code) {
if (XdrvMailbox.payload > 0) {
if (XdrvMailbox.payload != Settings.display_width) {
Settings.display_width = XdrvMailbox.payload;
restart_flag = 2; // Restart to re-init width
}
}
Response_P(S_JSON_DISPLAY_COMMAND_NVALUE, command, Settings.display_width);
}
else if (CMND_DISP_HEIGHT == command_code) {
if (XdrvMailbox.payload > 0) {
if (XdrvMailbox.payload != Settings.display_height) {
Settings.display_height = XdrvMailbox.payload;
restart_flag = 2; // Restart to re-init height
}
}
Response_P(S_JSON_DISPLAY_COMMAND_NVALUE, command, Settings.display_height);
}
else if (CMND_DISP_MODE == command_code) {
#ifdef USE_DISPLAY_MODES1TO5
/* Matrix LCD / Oled TFT

View File

@ -68,6 +68,8 @@ void LcdInitDriver(void)
}
if (XDSP_01 == Settings.display_model) {
Settings.display_width = Settings.display_cols[0];
Settings.display_height = Settings.display_rows;
lcd = new LiquidCrystal_I2C(Settings.display_address[0], Settings.display_cols[0], Settings.display_rows);
#ifdef USE_DISPLAY_MODES1TO5

View File

@ -86,7 +86,17 @@ void Ssd1306InitDriver(void)
}
if (XDSP_02 == Settings.display_model) {
oled = new Adafruit_SSD1306();
if ((Settings.display_width != 96) || (Settings.display_width != 128)) {
Settings.display_width = 128;
}
if ((Settings.display_height != 16) || (Settings.display_height != 32) || (Settings.display_height != 64)) {
Settings.display_height = 64;
}
int8_t reset_pin = -1;
if (pin[GPIO_OLED_RESET] < 99) {
reset_pin = pin[GPIO_OLED_RESET];
}
oled = new Adafruit_SSD1306(Settings.display_width, Settings.display_height, &Wire, reset_pin);
oled->begin(SSD1306_SWITCHCAPVCC, Settings.display_address[0]);
#ifdef USE_DISPLAY_MODES1TO5

View File

@ -214,6 +214,9 @@ void MatrixInitDriver(void)
}
}
Settings.display_width = mtx_matrices * 8;
Settings.display_height = 8;
MatrixInitMode();
}
}

View File

@ -84,6 +84,12 @@ void Ili9341InitDriver(void)
}
if (XDSP_04 == Settings.display_model) {
if (Settings.display_width != ILI9341_TFTWIDTH) {
Settings.display_width = ILI9341_TFTWIDTH;
}
if (Settings.display_height != ILI9341_TFTHEIGHT) {
Settings.display_height = ILI9341_TFTHEIGHT;
}
tft = new Adafruit_ILI9341(pin[GPIO_SPI_CS], pin[GPIO_SPI_DC]);
tft->begin();

View File

@ -118,6 +118,13 @@ void EpdInitDriver(void)
}
if (XDSP_05 == Settings.display_model) {
if (Settings.display_width != EPD_WIDTH) {
Settings.display_width = EPD_WIDTH;
}
if (Settings.display_height != EPD_HEIGHT) {
Settings.display_height = EPD_HEIGHT;
}
if ((pin[GPIO_SPI_CS] < 99) && (pin[GPIO_SPI_CLK] < 99) && (pin[GPIO_SPI_MOSI] < 99)) {
epd.cs_pin = pin[GPIO_SPI_CS];
epd.sclk_pin = pin[GPIO_SPI_CLK]; // 14