From 40052a343ffe94ad1ac4f077700acdb42eadb941 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Tue, 25 Sep 2018 15:35:49 +0200 Subject: [PATCH] Add image sonoff-display Add define USE_DISPLAYS for selecting image sonoff-display --- platformio.ini | 15 +++++++++++++++ sonoff/_changelog.ino | 1 + sonoff/sonoff_post.h | 26 +++++++++++++++++++++++++- sonoff/user_config.h | 3 ++- 4 files changed, 43 insertions(+), 2 deletions(-) diff --git a/platformio.ini b/platformio.ini index d333fd187..c01485f5a 100644 --- a/platformio.ini +++ b/platformio.ini @@ -16,6 +16,7 @@ env_default = sonoff ;env_default = sonoff-classic ;env_default = sonoff-knx ;env_default = sonoff-sensors +;env_default = sonoff-display ;env_default = sonoff-BG ;env_default = sonoff-BR ;env_default = sonoff-CN @@ -167,6 +168,20 @@ upload_resetmethod = ${common.upload_resetmethod} upload_speed = ${common.upload_speed} extra_scripts = ${common.extra_scripts} +[env:sonoff-display] +platform = ${common.platform} +framework = ${common.framework} +board = ${common.board} +board_build.flash_mode = ${common.board_build.flash_mode} +board_build.f_cpu = ${common.board_build.f_cpu} +build_unflags = ${common.build_unflags} +build_flags = ${common.build_flags} -DUSE_DISPLAYS +monitor_speed = ${common.monitor_speed} +upload_port = ${common.upload_port} +upload_resetmethod = ${common.upload_resetmethod} +upload_speed = ${common.upload_speed} +extra_scripts = ${common.extra_scripts} + [env:sonoff-BG] platform = ${common.platform} framework = ${common.framework} diff --git a/sonoff/_changelog.ino b/sonoff/_changelog.ino index 333a524a6..f2525b2a7 100644 --- a/sonoff/_changelog.ino +++ b/sonoff/_changelog.ino @@ -2,6 +2,7 @@ * Remove restart after ntpserver change and force NTP re-sync (#3890) * Release full Shelly2 support * Released tools/decode-config.py by Norbert Richter to decode configuration data. See file for information + * Add define USE_DISPLAYS for selecting image sonoff-display * * 6.2.1.6 20180922 * Removed commands PowerCal, VoltageCal and CurrentCal as more functionality is provided by commands PowerSet, VoltageSet and CurrentSet diff --git a/sonoff/sonoff_post.h b/sonoff/sonoff_post.h index 8622d0818..423a75f3c 100755 --- a/sonoff/sonoff_post.h +++ b/sonoff/sonoff_post.h @@ -51,7 +51,7 @@ void KNX_CB_Action(message_t const &msg, void *arg); #endif #define USE_DHT // Default DHT11 sensor needs no external library -#define USE_ENERGY_SENSOR // Use energy sensors +#define USE_ENERGY_SENSOR // Use energy sensors (+14k code) #define USE_HLW8012 // Use energy sensor for Sonoff Pow and WolfBlitz #define USE_CSE7766 // Use energy sensor for Sonoff S31 and Pow R2 @@ -167,6 +167,30 @@ void KNX_CB_Action(message_t const &msg, void *arg); #undef USE_EMULATION // Disable Belkin WeMo and Hue Bridge emulation for Alexa (-16k code, -2k mem) #endif // USE_KNX_NO_EMULATION +/*********************************************************************************************\ + * [sonoff-display.bin] + * Provide an image with display drivers enabled +\*********************************************************************************************/ + +#ifdef USE_DISPLAYS + +#undef USE_ENERGY_SENSOR // Disable energy sensors (-14k code) +#undef USE_EMULATION // Disable Belkin WeMo and Hue Bridge emulation for Alexa (-16k code, -2k mem) + +#define USE_I2C // I2C using library wire (+10k code, 0k2 mem, 124 iram) + #define USE_DISPLAY // Add I2C Display Support (+2k code) + #define USE_DISPLAY_MODES1TO5 // Enable display mode 1 to 5 in addition to mode 0 + #define USE_DISPLAY_LCD // [DisplayModel 1] Enable Lcd display (I2C addresses 0x27 and 0x3F) (+6k code) + #define USE_DISPLAY_SSD1306 // [DisplayModel 2] Enable SSD1306 Oled 128x64 display (I2C addresses 0x3C and 0x3D) (+16k code) + #define USE_DISPLAY_MATRIX // [DisplayModel 3] Enable 8x8 Matrix display (I2C adresseses see below) (+11k code) + +#define USE_SPI // Hardware SPI using GPIO12(MISO), GPIO13(MOSI) and GPIO14(CLK) in addition to two user selectable GPIOs(CS and DC) + #define USE_DISPLAY_ILI9341 // [DisplayModel 4] Enable ILI9341 Tft 480x320 display (+19k code) + +#undef USE_ARILUX_RF // Remove support for Arilux RF remote controller (-0k8 code, 252 iram (non 2.3.0)) +#undef USE_RF_FLASH // Remove support for flashing the EFM8BB1 chip on the Sonoff RF Bridge. C2CK must be connected to GPIO4, C2D to GPIO5 on the PCB (-3k code) +#endif // USE_DISPLAYS + /*********************************************************************************************\ * Mandatory define for DS18x20 if changed by above image selections \*********************************************************************************************/ diff --git a/sonoff/user_config.h b/sonoff/user_config.h index b93e44211..f86350334 100644 --- a/sonoff/user_config.h +++ b/sonoff/user_config.h @@ -321,7 +321,7 @@ #endif // USE_I2C // -- SPI sensors --------------------------------- -//#define USE_SPI // SPI using library TasmotaTFT +//#define USE_SPI // Hardware SPI using GPIO12(MISO), GPIO13(MOSI) and GPIO14(CLK) in addition to two user selectable GPIOs(CS and DC) #ifdef USE_SPI #ifndef USE_DISPLAY @@ -384,6 +384,7 @@ //#define USE_CLASSIC // Create sonoff-classic with initial configuration tools WPS, SmartConfig and WifiManager //#define USE_SENSORS // Create sonoff-sensors with useful sensors enabled //#define USE_KNX_NO_EMULATION // Create sonoff-knx with KNX but without Emulation +//#define USE_DISPLAYS // Create sonoff-display with display drivers enabled //#define BE_MINIMAL // Create sonoff-minimal as intermediate firmware for OTA-MAGIC /*********************************************************************************************\