diff --git a/BUILDS.md b/BUILDS.md index 4f9aed466..4ba198ea5 100644 --- a/BUILDS.md +++ b/BUILDS.md @@ -267,7 +267,6 @@ Note: the `minimal` variant is not listed as it shouldn't be used outside of the | USE_WEBCAM | | / - | | | | | | USE_ETHERNET | | / x | | | | | | USE_I2S_AUDIO | | / - | | | | | -| USE_TTGO_WATCH | | / - | | | | | | USE_SONOFF_SPM | | / x | | | | | | USE_DISPLAY_TM1621_SONOFF | | / x | | | | | | USE_SHELLY_PRO | | / x | | | | | diff --git a/CHANGELOG.md b/CHANGELOG.md index c64bbd199..d7d9e31bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ All notable changes to this project will be documented in this file. - uDisplay Parallel display on Core3 (#21529) ### Removed +- Deprecated code from drivers, `USE_TTGO_WATCH` and `USE_M5STACK_CORE2` ## [14.0.0.3] 20240530 ### Changed diff --git a/tasmota/include/tasmota_template.h b/tasmota/include/tasmota_template.h index 8f0dbd086..78343eb5a 100644 --- a/tasmota/include/tasmota_template.h +++ b/tasmota/include/tasmota_template.h @@ -3235,8 +3235,6 @@ enum SupportedModulesESP32 { ODROID_GO, ESP32_SOLO, WT32_ETH01, - TTGO_WATCH, - M5STACK_CORE2, MAXMODULE }; // Default module settings @@ -3254,12 +3252,6 @@ const uint8_t kModuleNiceList[] PROGMEM = { #ifdef USE_WT32_ETH01 WT32_ETH01, #endif // USE_WT32_ETH01 -#ifdef USE_TTGO_WATCH -// TTGO_WATCH, // To be defined -#endif // USE_TTGO_WATCH -#ifdef USE_M5STACK_CORE2 - M5STACK_CORE2, -#endif // USE_M5STACK_CORE2 }; // !!! Update this list in the same order as kModuleNiceList !!! @@ -3277,12 +3269,6 @@ const char kModuleNames[] PROGMEM = #ifdef USE_WT32_ETH01 "WT32-Eth01|" #endif // USE_WT32_ETH01 -#ifdef USE_TTGO_WATCH -// "TTGO Watch|" // To be defined -#endif // USE_TTGO_WATCH -#ifdef USE_M5STACK_CORE2 - "M5Stack Core2|" -#endif // USE_M5STACK_CORE2 ; // !!! Update this list in the same order as SupportedModulesESP32 !!! @@ -3474,56 +3460,6 @@ const mytmplt kModules[] PROGMEM = { }, #endif // USE_WT32_ETH01 -#ifdef USE_TTGO_WATCH -// { // TTGO Watch (ESP32) - To be defined -// }, -#endif // USE_TTGO_WATCH - -#ifdef USE_M5STACK_CORE2 - { // M5STACK CORE2 - (ESP32) - AGPIO(GPIO_USER), // 0 (I)O GPIO0, SPKR_LRCK - AGPIO(GPIO_USER), // 1 IO TXD0 GPIO1, U0TXD - AGPIO(GPIO_USER), // 2 IO GPIO2, SPKR_DATA - AGPIO(GPIO_USER), // 3 IO RXD0 GPIO3, U0RXD - AGPIO(GPIO_SDCARD_CS), // 4 IO GPIO4, SPI_CS_CARD - AGPIO(GPIO_ILI9341_CS), // 5 IO GPIO5, SPI_CS_LCD - // 6 IO Remapped to 28 - // 7 IO Remapped to 29 - // 8 IO Remapped to 30 - 0, // 9 IO GPIO9, Flash D2, PSRAM_D3 - 0, // 10 IO GPIO10, Flash D3, PSRAM_D2 - // 11 IO Remapped to 31 - 0, // 12 (I)O GPIO12, SPKR_CLK - AGPIO(GPIO_USER), // 13 IO GPIO13, ADC2_CH4, TOUCH4, RTC_GPIO14, MTCK, HSPID, HS2_DATA3, SD_DATA3, EMAC_RX_ER - AGPIO(GPIO_USER), // 14 IO GPIO14, ADC2_CH6, TOUCH6, RTC_GPIO16, MTMS, HSPICLK, HS2_CLK, SD_CLK, EMAC_TXD2 - AGPIO(GPIO_ILI9341_DC), // 15 (I)O GPIO15, SPI_DC_LCD - 0, // 16 IO GPIO16, PSRAM_CS - 0, // 17 IO GPIO17, PSRAM_CLK - AGPIO(GPIO_SPI_CLK), // 18 IO GPIO18, SPI_CLK - AGPIO(GPIO_USER), // 19 IO GPIO19, VSPIQ, U0CTS, EMAC_TXD0 - 0, // 20 - 0, // 21 IO GPIO21, I2C_SDA_INTERNAL - 0, // 22 IO LED GPIO22, I2C_SCL_INTERNAL - AGPIO(GPIO_SPI_MOSI), // 23 IO GPIO23, SPI_MOSI - 0, // 24 - AGPIO(GPIO_USER), // 25 IO GPIO25, DAC_1, ADC2_CH8, RTC_GPIO6, EMAC_RXD0 - AGPIO(GPIO_USER), // 26 IO GPIO26, DAC_2, ADC2_CH9, RTC_GPIO7, EMAC_RXD1 - AGPIO(GPIO_USER), // 27 IO GPIO27, ADC2_CH7, TOUCH7, RTC_GPIO17, EMAC_RX_DV - 0, // 6 IO GPIO6, Flash CLK - 0, // 7 IO GPIO7, Flash D0 - 0, // 8 IO GPIO8, Flash D1 - 0, // 11 IO GPIO11, Flash CMD - AGPIO(GPIO_I2C_SDA), // 32 IO GPIO32, I2C_SDA - AGPIO(GPIO_I2C_SCL), // 33 IO GPIO33, I2C_SCL - AGPIO(GPIO_USER), // 34 I NO PULLUP GPIO34, ADC1_CH6, RTC_GPIO4 - AGPIO(GPIO_USER), // 35 I NO PULLUP GPIO35, ADC1_CH7, RTC_GPIO5 - AGPIO(GPIO_USER), // 36 I NO PULLUP GPIO36, SENSOR_VP, ADC_H, ADC1_CH0, RTC_GPIO0 - 0, // 37 NO PULLUP - AGPIO(GPIO_SPI_MISO), // 38 NO PULLUP GPIO38, SPI_MISO - 0, // 39 I NO PULLUP GPIO39, INT_TOUCHPAD - 0 // Flag - } -#endif // USE_M5STACK_CORE2 }; /*********************************************************************************************\ diff --git a/tasmota/tasmota_support/support_features.ino b/tasmota/tasmota_support/support_features.ino index ae9d51101..457150896 100644 --- a/tasmota/tasmota_support/support_features.ino +++ b/tasmota/tasmota_support/support_features.ino @@ -599,9 +599,9 @@ constexpr uint32_t feature[] = { #if defined(USE_I2C) && defined(USE_EZOPH) 0x10000000 | // xsns_78_ezoph.ino #endif -#if defined(ESP32) && defined(USE_TTGO_WATCH) - 0x20000000 | // xdrv_83_esp32watch.ino -#endif +// #if defined(ESP32) && defined(USE_TTGO_WATCH) +// 0x20000000 | // xdrv_83_esp32watch.ino +// #endif #if defined(ESP32) && defined(USE_ETHERNET) 0x40000000 | // xdrv_82_ethernet.ino #endif diff --git a/tasmota/tasmota_xdrv_driver/xdrv_42_3_i2s_saytime.ino b/tasmota/tasmota_xdrv_driver/xdrv_42_3_i2s_saytime.ino index f52b8bc71..839493de2 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_42_3_i2s_saytime.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_42_3_i2s_saytime.ino @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#if (defined(USE_I2S_AUDIO) || defined(USE_TTGO_WATCH) || defined(USE_M5STACK_CORE2) || defined(ESP32S3_BOX)) +#if (defined(USE_I2S_AUDIO) || defined(ESP32S3_BOX)) #ifdef USE_I2S_SAY_TIME long timezone = 2; byte daysavetime = 1; diff --git a/tasmota/tasmota_xdrv_driver/xdrv_42_6_i2s_rtttl.ino b/tasmota/tasmota_xdrv_driver/xdrv_42_6_i2s_rtttl.ino index bf4ecfdb3..e004648e0 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_42_6_i2s_rtttl.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_42_6_i2s_rtttl.ino @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#if (defined(USE_I2S_AUDIO) || defined(USE_TTGO_WATCH) || defined(USE_M5STACK_CORE2) || defined(ESP32S3_BOX)) +#if (defined(USE_I2S_AUDIO) || defined(ESP32S3_BOX)) #ifdef USE_I2S_RTTTL #include "AudioFileSourcePROGMEM.h" #include "AudioGeneratorRTTTL.h" diff --git a/tasmota/tasmota_xdrv_driver/xdrv_55_touch.ino b/tasmota/tasmota_xdrv_driver/xdrv_55_touch.ino index d0e1f5885..213c7859f 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_55_touch.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_55_touch.ino @@ -127,11 +127,6 @@ uint32_t Touch_Status(int32_t sel) { } } -#ifdef USE_M5STACK_CORE2 -uint8_t tbstate[3]; -#endif // USE_M5STACK_CORE2 - - // simple resistive touch pins // with dma it should check for active transfers // so currently dont use dma @@ -447,27 +442,6 @@ void Touch_Check(void(*rotconvert)(int16_t *x, int16_t *y)) { if (TSGlobal.touched) { was_touched = true; -#ifdef USE_TOUCH_BUTTONS -#ifdef USE_M5STACK_CORE2 - // handle 3 built in touch buttons - uint16_t xcenter = 80; -#define TDELTA 30 -#define TYPOS 275 - for (uint32_t tbut = 0; tbut < 3; tbut++) { - if (TSGlobal.touch_xp > (xcenter - TDELTA) && TSGlobal.touch_xp < (xcenter + TDELTA) && TSGlobal.touch_yp > (TYPOS - TDELTA) && TSGlobal.touch_yp < (TYPOS + TDELTA)) { - // hit a button - if (!(tbstate[tbut] & 1)) { - // pressed - tbstate[tbut] |= 1; - //AddLog(LOG_LEVEL_INFO, PSTR("tbut: %d pressed"), tbut); - Touch_MQTT(tbut, "BIB", tbstate[tbut] & 1); - } - } - xcenter += 100; - } -#endif // USE_M5STACK_CORE2 -#endif // USE_TOUCH_BUTTONS - rotconvert(&TSGlobal.touch_xp, &TSGlobal.touch_yp); AddLog(LOG_LEVEL_DEBUG_MORE, "TS : touched x=%i y=%i gest=0x%02x (raw x=%i y=%i)", TSGlobal.touch_xp, TSGlobal.touch_yp, TSGlobal.gesture, TSGlobal.raw_touch_xp, TSGlobal.raw_touch_yp); @@ -476,17 +450,6 @@ void Touch_Check(void(*rotconvert)(int16_t *x, int16_t *y)) { #endif // USE_TOUCH_BUTTONS } else { -#ifdef USE_M5STACK_CORE2 - for (uint32_t tbut = 0; tbut < 3; tbut++) { - if (tbstate[tbut] & 1) { - // released - tbstate[tbut] &= 0xfe; - Touch_MQTT(tbut, "BIB", tbstate[tbut] & 1); - //AddLog(LOG_LEVEL_INFO, PSTR("tbut: %d released"), tbut); - } - } -#endif // USE_M5STACK_CORE2 - rotconvert(&TSGlobal.touch_xp, &TSGlobal.touch_yp); // still do rot convert if not TSGlobal.touched if (was_touched) { AddLog(LOG_LEVEL_DEBUG_MORE, "TS : released x=%i y=%i (raw x=%i y=%i)", TSGlobal.touch_xp, TSGlobal.touch_yp, TSGlobal.raw_touch_xp, TSGlobal.raw_touch_yp); diff --git a/tasmota/tasmota_xdrv_driver/xdrv_83_esp32_watch.ino b/tasmota/tasmota_xdrv_driver/xdrv_83_esp32_watch.ino index 236db41f3..01ab75dd3 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_83_esp32_watch.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_83_esp32_watch.ino @@ -17,454 +17,5 @@ along with this program. If not, see . */ -#ifdef ESP32 -#ifdef USE_TTGO_WATCH - -#include -#include -#include - -#define XDRV_83 83 - -#define AXP202_INT 35 - -struct TTGO_ADC { - float vbus_v; - float vbus_c; - float batt_v; - float batt_c; - float temp; - uint16_t per; -} ttgo_adc; - -enum { - Q_EVENT_WIFI_SCAN_DONE, - Q_EVENT_WIFI_CONNECT, - Q_EVENT_BMA_INT, - Q_EVENT_AXP_INT, -} ; - -#define BMA423_INT1 39 -#define BMA423_INT2 0 - -#define WATCH_FLAG_SLEEP_MODE _BV(1) -#define WATCH_FLAG_SLEEP_EXIT _BV(2) -#define WATCH_FLAG_BMA_IRQ _BV(3) -#define WATCH_FLAG_AXP_IRQ _BV(4) - -struct TTGO_globs { - AXP20X_Class *ttgo_power = nullptr; - I2CBus *i2c = nullptr; - BMA *bma = nullptr; - QueueHandle_t g_event_queue_handle = NULL; - //EventGroupHandle_t g_event_group = NULL; - EventGroupHandle_t isr_group = NULL; - bool lenergy = false; - bool bma_double_click = false; - bool bma_click = false; - bool bma_button = false; - bool power_ok = false; -} ttgo_globs; - - -void TTGO_Init(void) { - ttgo_globs.ttgo_power = new AXP20X_Class(); - ttgo_globs.i2c = new I2CBus(); - TTGO_initPower(); - -#ifdef USE_BMA423 - ttgo_globs.bma = new BMA(*ttgo_globs.i2c); - if (ttgo_globs.bma->begin()) { - I2cSetActiveFound(BMA4_I2C_ADDR_SECONDARY, "BMA423"); - } else { - return; - } - - ttgo_globs.bma->attachInterrupt(); - pinMode(BMA423_INT1, INPUT); - attachInterrupt(BMA423_INT1, [] { - BaseType_t xHigherPriorityTaskWoken = pdFALSE; - EventBits_t bits = xEventGroupGetBitsFromISR(ttgo_globs.isr_group); - if (bits & WATCH_FLAG_SLEEP_MODE) - { - // Use an XEvent when waking from low energy sleep mode. - xEventGroupSetBitsFromISR(ttgo_globs.isr_group, WATCH_FLAG_SLEEP_EXIT | WATCH_FLAG_BMA_IRQ, &xHigherPriorityTaskWoken); - } else - { - // Use the XQueue mechanism when we are already awake. - uint8_t data = Q_EVENT_BMA_INT; - xQueueSendFromISR(ttgo_globs.g_event_queue_handle, &data, &xHigherPriorityTaskWoken); - } - - if (xHigherPriorityTaskWoken) - { - portYIELD_FROM_ISR (); - } - }, RISING); - struct bma423_axes_remap remap_data; - - remap_data.x_axis = 0; - remap_data.x_axis_sign = 1; - remap_data.y_axis = 1; - remap_data.y_axis_sign = 0; - remap_data.z_axis = 2; - remap_data.z_axis_sign = 1; - - ttgo_globs.bma->set_remap_axes(&remap_data); - // Enable the double tap wakeup. - ttgo_globs.bma->enableWakeupInterrupt(true); - ttgo_globs.bma->enableAnyNoMotionInterrupt(true); - ttgo_globs.bma->enableAccel(); -#endif // USE_BMA423 -} - -void TTGO_initPower(void) { - int ret = ttgo_globs.ttgo_power->begin(axpReadBytes, axpWriteBytes); - if (ret == AXP_FAIL) { - //DBGX("AXP Power begin failed"); - // Serial.printf("AXP202 failed\n" ); - } else { - I2cSetActiveFound(AXP202_SLAVE_ADDRESS, "AXP202"); - ttgo_globs.power_ok = true; - // Serial.printf("AXP202 OK\n" ); - - //Change the button boot time to 4 seconds - ttgo_globs.ttgo_power->setShutdownTime(AXP_POWER_OFF_TIME_4S); - // Turn off the charging instructions, there should be no - ttgo_globs.ttgo_power->setChgLEDMode(AXP20X_LED_OFF); - // Turn off external enable - ttgo_globs.ttgo_power->setPowerOutPut(AXP202_EXTEN, false); - //axp202 allows maximum charging current of 1800mA, minimum 300mA - ttgo_globs.ttgo_power->setChargeControlCur(300); - - ttgo_globs.ttgo_power->adc1Enable(AXP202_VBUS_VOL_ADC1 | AXP202_VBUS_CUR_ADC1 | AXP202_BATT_CUR_ADC1 | AXP202_BATT_VOL_ADC1, true); - - ttgo_globs.ttgo_power->adc2Enable(AXP202_TEMP_MONITORING_ADC2, true); - - ttgo_globs.ttgo_power->enableIRQ(AXP202_VBUS_REMOVED_IRQ | AXP202_VBUS_CONNECT_IRQ | AXP202_CHARGING_FINISHED_IRQ, AXP202_ON); - ttgo_globs.ttgo_power->clearIRQ(); - - ttgo_globs.ttgo_power->setPowerOutPut(AXP202_LDO2, AXP202_ON); - - ttgo_globs.isr_group = xEventGroupCreate(); - ttgo_globs.g_event_queue_handle = xQueueCreate(20, sizeof(uint8_t)); - - // Connection interrupted to the specified pin - pinMode(AXP202_INT, INPUT); - attachInterrupt(AXP202_INT, [] { - BaseType_t xHigherPriorityTaskWoken = pdFALSE; - EventBits_t bits = xEventGroupGetBitsFromISR(ttgo_globs.isr_group); - if (bits & WATCH_FLAG_SLEEP_MODE) { - // Use an XEvent when waking from low energy sleep mode. - xEventGroupSetBitsFromISR(ttgo_globs.isr_group, WATCH_FLAG_SLEEP_EXIT | WATCH_FLAG_AXP_IRQ, &xHigherPriorityTaskWoken); - } else { - // Use the XQueue mechanism when we are already awake. - uint8_t data = Q_EVENT_AXP_INT; - xQueueSendFromISR(ttgo_globs.g_event_queue_handle, &data, &xHigherPriorityTaskWoken); - } - if (xHigherPriorityTaskWoken) { - portYIELD_FROM_ISR (); - } - }, FALLING); - - } - -} - -static uint8_t axpWriteBytes(uint8_t devAddress, uint8_t regAddress, uint8_t *data, uint8_t len) { - ttgo_globs.i2c->writeBytes(devAddress, regAddress, data, len); - return 0; -} - -static uint8_t axpReadBytes(uint8_t devAddress, uint8_t regAddress, uint8_t *data, uint8_t len) { - ttgo_globs.i2c->readBytes(devAddress, regAddress, data, len); - return 0; -} - - -void TTGO_GetADC(void) { - ttgo_adc.vbus_v = ttgo_globs.ttgo_power->getVbusVoltage(); - ttgo_adc.vbus_c = ttgo_globs.ttgo_power->getVbusCurrent(); - ttgo_adc.batt_v = ttgo_globs.ttgo_power->getBattVoltage(); - ttgo_adc.per = ttgo_globs.ttgo_power->getBattPercentage(); - ttgo_adc.batt_c = ttgo_globs.ttgo_power->getBattDischargeCurrent(); - ttgo_adc.temp = ttgo_globs.ttgo_power->getTemp(); -} - -#ifdef USE_WEBSERVER -const char HTTP_TTGO[] PROGMEM = - "{s}TTGO " "VBUS Voltage" "{m}%s mV" "{e}" - "{s}TTGO " "VBUS Current" "{m}%s mA" "{e}" - "{s}TTGO " "BATT Voltage" "{m}%s mV" "{e}" - "{s}TTGO " "BATT Current" "{m}%s mA" "{e}" - "{s}TTGO " "BATT Percentage" "{m}%d %%" "{e}" - "{s}TTGO " "Temperature" "{m}%s C" "{e}"; -#ifdef USE_BMA423 -const char HTTP_TTGO_BMA[] PROGMEM = - "{s}TTGO " "BMA x" "{m}%d mg" "{e}" - "{s}TTGO " "BMA y" "{m}%d mg" "{e}" - "{s}TTGO " "BMA z" "{m}%d mg" "{e}"; -#endif // USE_BMA423 -#endif // USE_WEBSERVER - - -void TTGO_WebShow(uint32_t json) { - - if (ttgo_globs.power_ok == false) return; - - TTGO_GetADC(); - - char vstring[32]; - char cstring[32]; - char bvstring[32]; - char bcstring[32]; - char tstring[32]; - dtostrfd(ttgo_adc.vbus_v,2,vstring); - dtostrfd(ttgo_adc.vbus_c,2,cstring); - dtostrfd(ttgo_adc.batt_v,2,bvstring); - dtostrfd(ttgo_adc.batt_c,2,bcstring); - dtostrfd(ttgo_adc.temp,2,tstring); - -#ifdef USE_BMA423 - Accel acc; - bool res = ttgo_globs.bma->getAccel(acc); -#endif // USE_BMA423 - - if (json) { - ResponseAppend_P(PSTR(",\"TTGO_WATCH\":{\"VBV\":%s,\"VBC\":%s,\"BV\":%s,\"BC\":%s,\"BP\":%d,\"CT\":%s"), - vstring, cstring, bvstring, bcstring, ttgo_adc.per, tstring); -#ifdef USE_BMA423 - ResponseAppend_P(PSTR(",\"BMAX\":%d,\"BMAY\":%d,\"BMAZ\":%d"),acc.x,acc.y,acc.z); -#endif - ResponseJsonEnd(); -#ifdef USE_WEBSERVER - } else { - WSContentSend_PD(HTTP_TTGO,vstring,cstring,bvstring,bcstring,ttgo_adc.per,tstring); -#ifdef USE_BMA423 - WSContentSend_PD(HTTP_TTGO_BMA,acc.x,acc.y,acc.z); -#endif // USE_BMA423 -#endif // USE_WEBSERVER - } -} - - -void TTGO_enableLDO3(bool en = true) { - if (!ttgo_globs.ttgo_power) return; - ttgo_globs.ttgo_power->setLDO3Mode(1); - ttgo_globs.ttgo_power->setPowerOutPut(AXP202_LDO3, en); -} - -void TTGO_audio_power(bool power) { // Not every watch has audio - TTGO_enableLDO3(power); -} - -const char TTGO_Commands[] PROGMEM = "TTGO|" - "LSLP"; - -void (* const TTTGO_Command[])(void) PROGMEM = { - &TTGO_LightSleep}; - -void TTGO_LightSleep(void) { -int32_t ttgo_sleeptime; - - // switch device off - if ((abs(XdrvMailbox.payload) >= 10) && (abs(XdrvMailbox.payload) <= 3600*24)) { - ttgo_sleeptime = XdrvMailbox.payload; - } else { - ttgo_sleeptime = 0; - } - - ResponseCmndNumber(ttgo_sleeptime); - - TTGO_Sleep(ttgo_sleeptime); - -} - -void TTGO_Sleep(int32_t stime) { -int32_t ttgo_sleeptime; - - ttgo_sleeptime = stime; - -#ifdef USE_DISPLAY - DisplayOnOff(0); -#endif - if (ttgo_sleeptime>=0) { - // ligh sleep mode - WifiShutdown(); - SettingsSaveAll(); - RtcSettingsSave(); - ttgo_globs.lenergy = true; - setCpuFrequencyMhz(10); - xEventGroupSetBits(ttgo_globs.isr_group, WATCH_FLAG_SLEEP_MODE); - gpio_wakeup_enable ((gpio_num_t)AXP202_INT, GPIO_INTR_LOW_LEVEL); - gpio_wakeup_enable ((gpio_num_t)BMA423_INT1, GPIO_INTR_HIGH_LEVEL); - esp_sleep_enable_gpio_wakeup(); - if (ttgo_sleeptime) { - esp_sleep_enable_timer_wakeup(ttgo_sleeptime * 1000000); - } - esp_light_sleep_start(); - } else { - ttgo_globs.ttgo_power->setPowerOutPut(0xFF, false); - Settings->deepsleep = -ttgo_sleeptime; -#ifdef USE_DEEPSLEEP - RtcSettings.nextwakeup = 0; - deepsleep_flag = (0 == XdrvMailbox.payload) ? 0 : DEEPSLEEP_START_COUNTDOWN; - if (deepsleep_flag) { - if (!Settings->tele_period) { - Settings->tele_period = TELE_PERIOD; // Need teleperiod to go back to sleep - } - } -#endif - return; - } - - if (ttgo_sleeptime) { - ttgo_globs.lenergy = false; - setCpuFrequencyMhz(240); -#ifdef USE_DISPLAY - DisplayOnOff(1); -#endif - } else { - while (ttgo_globs.lenergy == true) { - TTGO_loop(0); - OsWatchLoop(); - } - } -} - - -void TTGO_loop(uint32_t flg) { -bool rlst; -uint8_t data; - - if (!flg) { -// An XEvent signifies that there has been a wakeup interrupt, bring the CPU out of low energy mode - EventBits_t bits = xEventGroupGetBits(ttgo_globs.isr_group); - if (bits & WATCH_FLAG_SLEEP_EXIT) { - if (ttgo_globs.lenergy) { - ttgo_globs.lenergy = false; - setCpuFrequencyMhz(240); -#ifdef USE_DISPLAY - DisplayOnOff(1); -#endif - } - -#ifdef USE_BMA423 - if (bits & WATCH_FLAG_BMA_IRQ) { - do { - rlst = ttgo_globs.bma->readInterrupt(); - } while (!rlst); - xEventGroupClearBits(ttgo_globs.isr_group, WATCH_FLAG_BMA_IRQ); - } -#endif - - if (bits & WATCH_FLAG_AXP_IRQ) { - ttgo_globs.ttgo_power->readIRQ(); - ttgo_globs.ttgo_power->clearIRQ(); - xEventGroupClearBits(ttgo_globs.isr_group, WATCH_FLAG_AXP_IRQ); - } - xEventGroupClearBits(ttgo_globs.isr_group, WATCH_FLAG_SLEEP_EXIT); - xEventGroupClearBits(ttgo_globs.isr_group, WATCH_FLAG_SLEEP_MODE); - } - } else { - //! Normal polling - if (xQueueReceive(ttgo_globs.g_event_queue_handle, &data, 5 / portTICK_RATE_MS) == pdPASS) { - switch (data) { -#ifdef USE_BMA423 - case Q_EVENT_BMA_INT: - // DSERIAL(println, "Q_EVENT_BMA_IRQ"); - do { - rlst = ttgo_globs.bma->readInterrupt(); - } while (!rlst); - - if (ttgo_globs.bma->isDoubleClick()) { - ttgo_globs.bma_double_click = true; - //AddLog(LOG_LEVEL_INFO, PSTR("double click")); - } - if (ttgo_globs.bma->isAnyNoMotion()) { - ttgo_globs.bma_click = true; - //AddLog(LOG_LEVEL_INFO, PSTR("click")); - } - - //! setp counter - if (ttgo_globs.bma->isStepCounter()) { - //updateStepCounter(ttgo_globs.bma->getCounter()); - } - break; -#endif - case Q_EVENT_AXP_INT: - // DSERIAL(println, "Q_EVENT_AXP_INT"); - ttgo_globs.ttgo_power->readIRQ(); - if (ttgo_globs.ttgo_power->isVbusPlugInIRQ()) { - //batState = LV_ICON_CHARGE; - //updateBatteryIcon(LV_ICON_CHARGE); - } - if (ttgo_globs.ttgo_power->isVbusRemoveIRQ()) { - //batState = LV_ICON_CALCULATION; - //updateBatteryIcon(LV_ICON_CALCULATION); - } - if (ttgo_globs.ttgo_power->isChargingDoneIRQ()) { - //batState = LV_ICON_CALCULATION; - //updateBatteryIcon(LV_ICON_CALCULATION); - } - if (ttgo_globs.ttgo_power->isPEKShortPressIRQ()) { - ttgo_globs.bma_button = true; - //AddLog(LOG_LEVEL_INFO, PSTR("button press")); - } - ttgo_globs.ttgo_power->clearIRQ(); - break; - default: - break; - } - } - } -} - -bool TTGO_doubleclick(void) { - bool retval = ttgo_globs.bma_double_click; - ttgo_globs.bma_double_click = false; - return retval; -} - -bool TTGO_button(void) { - bool retval = ttgo_globs.bma_button; - ttgo_globs.bma_button = false; - return retval; -} - -/*********************************************************************************************\ - * Interface -\*********************************************************************************************/ - -bool Xdrv83(uint32_t function) { - bool result = false; - - switch (function) { - - case FUNC_WEB_SENSOR: -#ifdef USE_WEBSERVER - TTGO_WebShow(0); -#endif - break; - case FUNC_JSON_APPEND: - TTGO_WebShow(1); - break; - case FUNC_COMMAND: - result = DecodeCommand(TTGO_Commands, TTTGO_Command); - break; - case FUNC_INIT: - TTGO_Init(); - break; - case FUNC_LOOP: - TTGO_loop(1); - break; - case FUNC_ACTIVE: - result = true; - break; - - } - return result; -} - -#endif // USE_TTGO_WATCH -#endif // ESP32 +// REMOVED +// DEPRECATED - USE UNIVERSAL DISPLAY INSTEAD, https://tasmota.github.io/docs/Universal-Display-Driver/#migrating-to-udisplay diff --git a/tasmota/tasmota_xdsp_display/xdsp_02_ssd1306.ino b/tasmota/tasmota_xdsp_display/xdsp_02_ssd1306.ino index 029fa4268..c22a20d02 100644 --- a/tasmota/tasmota_xdsp_display/xdsp_02_ssd1306.ino +++ b/tasmota/tasmota_xdsp_display/xdsp_02_ssd1306.ino @@ -19,180 +19,3 @@ // REMOVED // DEPRECATED - USE UNIVERSAL DISPLAY INSTEAD, https://tasmota.github.io/docs/Universal-Display-Driver/#migrating-to-udisplay - -// #ifdef USE_I2C -// #ifdef USE_DISPLAY -// #ifdef USE_DISPLAY_SSD1306 - -// #define XDSP_02 2 -// #define XI2C_04 4 // See I2CDEVICES.md - -// #define OLED_RESET 4 - -// #define SPRINT(A) char str[32];sprintf(str,"val: %d ",A);Serial.println((char*)str); - -// #define OLED_ADDRESS1 0x3C // Oled 128x32 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_ROWS 16 // Max number of lines in display shadow buffer - -// #define OLED_FONT_WIDTH 6 -// #define OLED_FONT_HEIGTH 8 - -// #include -// #include -// #include - -// Adafruit_SSD1306 *oled1306; - -// extern uint8_t *buffer; - -// /*********************************************************************************************/ - -// void SSD1306InitDriver(void) { -// if (!TasmotaGlobal.i2c_enabled) { return; } - -// if (!Settings->display_model) { -// if (I2cSetDevice(OLED_ADDRESS1)) { -// Settings->display_address[0] = OLED_ADDRESS1; -// Settings->display_model = XDSP_02; -// } -// else if (I2cSetDevice(OLED_ADDRESS2)) { -// Settings->display_address[0] = OLED_ADDRESS2; -// Settings->display_model = XDSP_02; -// } -// } - -// if (XDSP_02 == Settings->display_model) { -// I2cSetActiveFound(Settings->display_address[0], "SSD1306"); - -// if ((Settings->display_width != 72) && (Settings->display_width != 64) && (Settings->display_width != 96) && (Settings->display_width != 128)) { -// Settings->display_width = 128; -// } -// if ((Settings->display_height != 40) && (Settings->display_height != 16) && (Settings->display_height != 32) && (Settings->display_height != 48) && (Settings->display_height != 64)) { -// Settings->display_height = 64; -// } - -// // init renderer -// // oled1306 = new Adafruit_SSD1306(SSD1306_LCDWIDTH,SSD1306_LCDHEIGHT); -// oled1306 = new Adafruit_SSD1306(Settings->display_width, Settings->display_height, &Wire, Pin(GPIO_OLED_RESET)); -// oled1306->begin(SSD1306_SWITCHCAPVCC, Settings->display_address[0], Pin(GPIO_OLED_RESET) >= 0); -// renderer = oled1306; -// renderer->DisplayInit(DISPLAY_INIT_MODE, Settings->display_size, Settings->display_rotate, Settings->display_font); -// renderer->setTextColor(1,0); - -// #ifdef SHOW_SPLASH -// if (!Settings->flag5.display_no_splash) { -// renderer->setTextFont(0); -// renderer->setTextSize(2); -// renderer->setCursor(20,20); -// renderer->println(F("SSD1306")); -// renderer->Updateframe(); -// renderer->DisplayOnff(1); -// } -// #endif - -// AddLog(LOG_LEVEL_INFO, PSTR("DSP: SSD1306")); -// } -// } - -// /*********************************************************************************************/ -// #ifdef USE_DISPLAY_MODES1TO5 - -// void Ssd1306PrintLog(void) -// { -// disp_refresh--; -// if (!disp_refresh) { -// disp_refresh = Settings->display_refresh; -// if (!disp_screen_buffer_cols) { DisplayAllocScreenBuffer(); } - -// char* txt = DisplayLogBuffer('\370'); -// if (txt != NULL) { -// uint8_t last_row = Settings->display_rows -1; - -// renderer->clearDisplay(); -// renderer->setTextSize(Settings->display_size); -// renderer->setCursor(0,0); -// for (byte i = 0; i < last_row; i++) { -// strlcpy(disp_screen_buffer[i], disp_screen_buffer[i +1], disp_screen_buffer_cols); -// renderer->println(disp_screen_buffer[i]); -// } -// strlcpy(disp_screen_buffer[last_row], txt, disp_screen_buffer_cols); -// DisplayFillScreen(last_row); - -// AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "[%s]"), disp_screen_buffer[last_row]); - -// renderer->println(disp_screen_buffer[last_row]); -// renderer->Updateframe(); -// } -// } -// } - -// void Ssd1306Time(void) -// { -// char line[12]; - -// renderer->clearDisplay(); -// renderer->setTextSize(Settings->display_size); -// renderer->setTextFont(Settings->display_font); -// renderer->setCursor(0, 0); -// snprintf_P(line, sizeof(line), PSTR(" %02d" D_HOUR_MINUTE_SEPARATOR "%02d" D_MINUTE_SECOND_SEPARATOR "%02d"), RtcTime.hour, RtcTime.minute, RtcTime.second); // [ 12:34:56 ] -// renderer->println(line); -// renderer->println(); -// snprintf_P(line, sizeof(line), PSTR("%02d" D_MONTH_DAY_SEPARATOR "%02d" D_YEAR_MONTH_SEPARATOR "%04d"), RtcTime.day_of_month, RtcTime.month, RtcTime.year); // [01-02-2018] -// renderer->println(line); -// renderer->Updateframe(); -// } - -// void Ssd1306Refresh(void) // Every second -// { -// if (!renderer) return; - -// if (Settings->display_mode) { // Mode 0 is User text -// switch (Settings->display_mode) { -// case 1: // Time -// Ssd1306Time(); -// break; -// case 2: // Local -// case 3: // Local -// case 4: // Mqtt -// case 5: // Mqtt -// Ssd1306PrintLog(); -// break; -// } -// } -// } - -// #endif // USE_DISPLAY_MODES1TO5 - -// /*********************************************************************************************\ -// * Interface -// \*********************************************************************************************/ - -// bool Xdsp02(uint32_t function) { -// if (!I2cEnabled(XI2C_04)) { return false; } - -// bool result = false; - -// if (FUNC_DISPLAY_INIT_DRIVER == function) { -// SSD1306InitDriver(); -// } -// else if (XDSP_02 == Settings->display_model) { -// switch (function) { -// #ifdef USE_DISPLAY_MODES1TO5 -// case FUNC_DISPLAY_EVERY_SECOND: -// Ssd1306Refresh(); -// break; -// #endif // USE_DISPLAY_MODES1TO5 -// case FUNC_DISPLAY_MODEL: -// result = true; -// break; -// } -// } -// return result; -// } - -// #endif // USE_DISPLAY_SSD1306 -// #endif // USE_DISPLAY -// #endif // USE_I2C diff --git a/tasmota/tasmota_xdsp_display/xdsp_04_ili9341.ino b/tasmota/tasmota_xdsp_display/xdsp_04_ili9341.ino index 2265dc2df..4fbf36541 100644 --- a/tasmota/tasmota_xdsp_display/xdsp_04_ili9341.ino +++ b/tasmota/tasmota_xdsp_display/xdsp_04_ili9341.ino @@ -19,398 +19,3 @@ // REMOVED // DEPRECATED - USE UNIVERSAL DISPLAY INSTEAD, https://tasmota.github.io/docs/Universal-Display-Driver/#migrating-to-udisplay - -// #ifdef USE_SPI -// #ifdef USE_DISPLAY -// #ifdef USE_DISPLAY_ILI9341 - -// #define XDSP_04 4 - -// enum IliModes { ILIMODE_9341 = 1, ILIMODE_9342, ILIMODE_MAX }; - -// #include - -// extern uint8_t color_type; -// ILI9341_2 *ili9341_2; - -// #if defined(USE_FT5206) -// #include -// uint8_t ili9342_ctouch_counter = 0; -// #elif defined(USE_XPT2046) -// #include -// uint8_t ili9342_ctouch_counter = 0; -// #endif // USE_FT5206 - -// bool tft_init_done = false; - -// void Core2DisplayPower(uint8_t on); -// void Core2DisplayDim(uint8_t dim); - -// //Settings->display_options.type = ILIMODE_9341; - -// /*********************************************************************************************/ - -// void ILI9341_InitDriver() -// { - -// // There are displays without CS -// if (PinUsed(GPIO_ILI9341_CS) || PinUsed(GPIO_ILI9341_DC) && -// (TasmotaGlobal.spi_enabled || TasmotaGlobal.soft_spi_enabled)) { - -// Settings->display_model = XDSP_04; - -// if (Settings->display_width != ILI9341_TFTWIDTH) { -// Settings->display_width = ILI9341_TFTWIDTH; -// } -// if (Settings->display_height != ILI9341_TFTHEIGHT) { -// Settings->display_height = ILI9341_TFTHEIGHT; -// } - -// if (!Settings->display_options.type || (Settings->display_options.type >= ILIMODE_MAX)) { -// Settings->display_options.type = ILIMODE_9341; -// } - -// // default colors -// fg_color = ILI9341_WHITE; -// bg_color = ILI9341_BLACK; - -// // check for special case with 2 SPI busses (ESP32 bitcoin) -// if (TasmotaGlobal.soft_spi_enabled) { -// // Init renderer, may use hardware spi, however we use SSPI defintion because SD card uses SPI definition (2 spi busses) -// if (PinUsed(GPIO_SSPI_MOSI) && PinUsed(GPIO_SSPI_MISO) && PinUsed(GPIO_SSPI_SCLK)) { -// ili9341_2 = new ILI9341_2(Pin(GPIO_ILI9341_CS), Pin(GPIO_SSPI_MOSI), Pin(GPIO_SSPI_MISO), Pin(GPIO_SSPI_SCLK), Pin(GPIO_OLED_RESET), Pin(GPIO_ILI9341_DC), Pin(GPIO_BACKLIGHT), 2, Settings->display_options.type & 3); -// } -// } else if (TasmotaGlobal.spi_enabled) { -// if (PinUsed(GPIO_ILI9341_DC)) { -// ili9341_2 = new ILI9341_2(Pin(GPIO_ILI9341_CS), Pin(GPIO_SPI_MOSI), Pin(GPIO_SPI_MISO), Pin(GPIO_SPI_CLK), Pin(GPIO_OLED_RESET), Pin(GPIO_ILI9341_DC), Pin(GPIO_BACKLIGHT), 1, Settings->display_options.type & 3); -// } -// } - -// if (ili9341_2 == nullptr) { -// AddLog(LOG_LEVEL_INFO, PSTR("DSP: ILI934x invalid GPIOs")); -// return; -// } - -// ili9341_2->init(Settings->display_width, Settings->display_height); -// renderer = ili9341_2; - -// #ifdef USE_M5STACK_CORE2 -// renderer->SetPwrCB(Core2DisplayPower); -// renderer->SetDimCB(Core2DisplayDim); -// #endif - -// renderer->DisplayInit(DISPLAY_INIT_MODE, Settings->display_size, Settings->display_rotate, Settings->display_font); -// renderer->dim(GetDisplayDimmer16()); - -// #ifdef SHOW_SPLASH -// if (!Settings->flag5.display_no_splash) { -// // Welcome text -// renderer->setTextFont(2); -// renderer->setTextSize(1); -// renderer->setTextColor(ILI9341_WHITE, ILI9341_BLACK); -// renderer->DrawStringAt(50, (Settings->display_height/2)-12, (Settings->display_options.type & 3)==ILIMODE_9341?"ILI9341 TFT!":"ILI9342 TFT!", ILI9341_WHITE, 0); -// delay(1000); -// } -// #endif // SHOW_SPLASH - -// color_type = COLOR_COLOR; - -// #ifdef USE_DISPLAY_MODES1TO5 -// if (Settings->display_rotate) { -// DisplayAllocScreenBuffer(); -// } -// Ili9341InitMode(); -// #endif // USE_DISPLAY_MODES1TO5 - -// #ifdef ESP32 -// #ifdef USE_FT5206 -// // start digitizer with fixed adress and pins for esp32 -// #undef SDA_2 -// #define SDA_2 21 -// #undef SCL_2 -// #define SCL_2 22 -// Wire1.begin(SDA_2, SCL_2, (uint32_t)400000); -// FT5206_Touch_Init(Wire1); -// #endif // USE_FT5206 -// #endif // ESP32 - -// #ifdef USE_XPT2046 -// XPT2046_Touch_Init(Pin(GPIO_XPT2046_CS),-1,0); -// #endif - -// tft_init_done = true; -// AddLog(LOG_LEVEL_INFO, PSTR("DSP: ILI9341")); -// } -// } - -// #if defined(USE_FT5206) || defined(USE_XPT2046) -// #ifdef USE_TOUCH_BUTTONS - -// #ifdef USE_FT5206 -// void FT5206_TS_RotConvert(int16_t *x, int16_t *y) { - -// int16_t temp; -// if (renderer) { -// uint8_t rot = renderer->getRotation(); -// switch (rot) { -// case 0: -// break; -// case 1: -// temp = *y; -// *y = renderer->height() - *x; -// *x = temp; -// break; -// case 2: -// *x = renderer->width() - *x; -// *y = renderer->height() - *y; -// break; -// case 3: -// temp = *y; -// *y = *x; -// *x = renderer->width() - temp; -// break; -// } -// } -// } -// #endif // USE_FT5206 - -// #ifdef USE_XPT2046 -// void XPT2046_TS_RotConvert(int16_t *x, int16_t *y) { - -// int16_t temp; -// if (renderer) { -// uint8_t rot = renderer->getRotation(); -// // AddLog(LOG_LEVEL_DEBUG_MORE, PSTR(" TS: before convert x:%d / y:%d screen r:%d / w:%d / h:%d"), *x, *y,rot,renderer->width(),renderer->height()); -// temp = map(*x,XPT2046_MINX,XPT2046_MAXX, renderer->height(), 0); -// *x = map(*y,XPT2046_MINY,XPT2046_MAXY, renderer->width(), 0); -// *y = temp; -// switch (rot) { -// case 0: -// break; -// case 1: -// temp = *y; -// *y = renderer->width() - *x; -// *x = temp; -// break; -// case 2: -// *x = renderer->width() - *x; -// *y = renderer->height() - *y; -// break; -// case 3: -// temp = *y; -// *y = *x; -// *x = renderer->height() - temp; -// break; -// } -// AddLog(LOG_LEVEL_DEBUG_MORE, PSTR(" TS: after convert x:%d / y:%d screen r:%d / w:%d / h:%d"), *x, *y,rot,renderer->width(),renderer->height()); -// } -// } -// #endif - -// // check digitizer hit -// void ili9342_CheckTouch() { -// ili9342_ctouch_counter++; -// if (2 == ili9342_ctouch_counter) { -// // every 100 ms should be enough -// ili9342_ctouch_counter = 0; -// #ifdef USE_FT5206 -// if (FT5206_found) { -// Touch_Check(FT5206_TS_RotConvert); -// } -// #endif // USE_FT5206 -// #ifdef USE_XPT2046 -// if (XPT2046_found) { -// Touch_Check(XPT2046_TS_RotConvert); -// } -// #endif // USE_XPT2046 -// } -// } -// #endif // USE_TOUCH_BUTTONS -// #endif // USE_FT5206 - - - -// #ifdef USE_DISPLAY_MODES1TO5 - -// #define TFT_TOP 16 -// #define TFT_BOTTOM 16 -// #define TFT_FONT_WIDTH 6 -// #define TFT_FONT_HEIGTH 8 // Adafruit minimal font heigth pixels - -// uint16_t tft_top = TFT_TOP; -// uint16_t tft_bottom = TFT_BOTTOM; -// uint16_t tft_scroll = TFT_TOP; -// uint16_t tft_cols = 0; - -// bool Ili9341Header(void) { -// if (Settings->display_cols[0] != tft_cols) { -// tft_cols = Settings->display_cols[0]; -// if (tft_cols > 17) { -// tft_top = TFT_TOP; -// tft_bottom = TFT_BOTTOM; -// } else { -// tft_top = 0; -// tft_bottom = 0; -// } -// tft_scroll = tft_top; -// renderer->setScrollMargins(tft_top, tft_bottom); -// } -// return (tft_cols > 17); -// } - -// void Ili9341InitMode(void) { -// // renderer->setRotation(Settings->display_rotate); // 0 -// #ifdef USE_DISPLAY_ILI9341 -// // renderer->invertDisplay(0); -// #endif -// renderer->fillScreen(ILI9341_BLACK); -// renderer->setTextWrap(false); // Allow text to run off edges -// renderer->cp437(true); -// if (!Settings->display_mode) { -// renderer->setCursor(0, 0); -// renderer->setTextColor(ILI9341_WHITE, ILI9341_BLACK); -// renderer->setTextSize(1); -// } else { -// Ili9341Header(); -// renderer->setCursor(0, 0); -// renderer->setTextColor(ILI9341_YELLOW, ILI9341_BLACK); -// renderer->setTextSize(2); -// // tft->println("HEADER"); -// } -// } - -// void Ili9341PrintLog(void) { -// disp_refresh--; -// if (!disp_refresh) { -// disp_refresh = Settings->display_refresh; -// if (Settings->display_rotate) { -// if (!disp_screen_buffer_cols) { DisplayAllocScreenBuffer(); } -// } - -// char* txt = DisplayLogBuffer('\370'); -// if (txt != nullptr) { -// uint8_t size = Settings->display_size; -// uint16_t theight = size * TFT_FONT_HEIGTH; - -// renderer->setTextSize(size); -// renderer->setTextColor(ILI9341_CYAN, ILI9341_BLACK); // Add background color to solve flicker -// if (!Settings->display_rotate) { // Use hardware scroll -// renderer->setCursor(0, tft_scroll); -// renderer->fillRect(0, tft_scroll, renderer->width(), theight, ILI9341_BLACK); // Erase line -// renderer->print(txt); -// tft_scroll += theight; -// if (tft_scroll >= (renderer->height() - tft_bottom)) { -// tft_scroll = tft_top; -// } -// renderer->scrollTo(tft_scroll); -// } else { -// uint8_t last_row = Settings->display_rows -1; - -// tft_scroll = (tft_top) ? theight : 0; // Start below header -// renderer->setCursor(0, tft_scroll); -// for (uint32_t i = 0; i < last_row; i++) { -// strlcpy(disp_screen_buffer[i], disp_screen_buffer[i +1], disp_screen_buffer_cols); -// // tft->fillRect(0, tft_scroll, tft->width(), theight, ILI9341_BLACK); // Erase line -// renderer->print(disp_screen_buffer[i]); -// tft_scroll += theight; -// renderer->setCursor(0, tft_scroll); -// delay(1); // Fix background runs heap usage due to long runtime of this loop (up to 1 second) -// } -// strlcpy(disp_screen_buffer[last_row], txt, disp_screen_buffer_cols); -// DisplayFillScreen(last_row); -// renderer->print(disp_screen_buffer[last_row]); -// } -// AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_APPLICATION "[%s]"), txt); -// } -// } -// } - -// void ILI9341_Refresh(void) { // Every second -// if (Settings->display_mode) { // Mode 0 is User text -// // 24-04-2017 13:45:43 = 19 + 1 ('\0') = 20 -// // 24-04-2017 13:45 = 16 + 1 ('\0') = 17 - -// if (Ili9341Header()) { -// char tftdt[Settings->display_cols[0] +1]; -// char date4[11]; // 24-04-2017 -// uint8_t time_size = (Settings->display_cols[0] >= 20) ? 9 : 6; // 13:45:43 or 13:45 -// char spaces[Settings->display_cols[0] - (8 + time_size)]; -// char time[time_size]; // 13:45:43 - -// renderer->setTextSize(Settings->display_size); -// renderer->setTextColor(ILI9341_YELLOW, ILI9341_RED); // Add background color to solve flicker -// renderer->setCursor(0, 0); - -// snprintf_P(date4, sizeof(date4), PSTR("%02d" D_MONTH_DAY_SEPARATOR "%02d" D_YEAR_MONTH_SEPARATOR "%04d"), RtcTime.day_of_month, RtcTime.month, RtcTime.year); -// memset(spaces, 0x20, sizeof(spaces)); -// spaces[sizeof(spaces) -1] = '\0'; -// snprintf_P(time, sizeof(time), PSTR("%02d" D_HOUR_MINUTE_SEPARATOR "%02d" D_MINUTE_SECOND_SEPARATOR "%02d"), RtcTime.hour, RtcTime.minute, RtcTime.second); -// snprintf_P(tftdt, sizeof(tftdt), PSTR("%s%s%s"), date4, spaces, time); - -// renderer->print(tftdt); -// } else { -// renderer->setCursor(0, 0); -// } - -// switch (Settings->display_mode) { -// case 1: // Text -// case 2: // Local -// case 3: // Local -// case 4: // Mqtt -// case 5: // Mqtt -// Ili9341PrintLog(); -// break; -// } -// } -// } -// #endif // USE_DISPLAY_MODES1TO5 - -// /*********************************************************************************************/ -// /*********************************************************************************************\ -// * Interface -// \*********************************************************************************************/ -// bool Xdsp04(uint32_t function) -// { -// bool result = false; - -// if (FUNC_DISPLAY_INIT_DRIVER == function) { -// ILI9341_InitDriver(); -// } -// else if (tft_init_done && (XDSP_04 == Settings->display_model)) { -// switch (function) { -// case FUNC_DISPLAY_MODEL: -// result = true; -// break; -// case FUNC_DISPLAY_TEXT_SIZE: -// case FUNC_DISPLAY_FONT_SIZE: -// case DISPLAY_INIT_MODE: -// renderer->clearDisplay(); -// break; -// #if defined(USE_FT5206) || defined(USE_XPT2046) -// #ifdef USE_TOUCH_BUTTONS -// case FUNC_DISPLAY_EVERY_50_MSECOND: -// #if defined(USE_FT5206) -// if (FT5206_found) { -// #elif defined(USE_XPT2046) -// if (XPT2046_found) { -// #endif - -// ili9342_CheckTouch(); -// } -// break; -// #endif // USE_TOUCH_BUTTONS -// #endif // USE_FT5206 -// #ifdef USE_DISPLAY_MODES1TO5 -// case FUNC_DISPLAY_EVERY_SECOND: -// ILI9341_Refresh(); -// break; -// #endif // USE_DISPLAY_MODES1TO5 - -// } -// } -// return result; -// } - -// #endif // USE_DISPLAY_ILI9341 -// #endif // USE_DISPLAY -// #endif // USE_SPI diff --git a/tasmota/tasmota_xdsp_display/xdsp_07_sh1106.ino b/tasmota/tasmota_xdsp_display/xdsp_07_sh1106.ino index ecfcdf4b6..68992a5ab 100644 --- a/tasmota/tasmota_xdsp_display/xdsp_07_sh1106.ino +++ b/tasmota/tasmota_xdsp_display/xdsp_07_sh1106.ino @@ -19,180 +19,3 @@ // REMOVED // DEPRECATED - USE UNIVERSAL DISPLAY INSTEAD, https://tasmota.github.io/docs/Universal-Display-Driver/#migrating-to-udisplay - -// #ifdef USE_I2C -// #ifdef USE_DISPLAY -// #ifdef USE_DISPLAY_SH1106 - -// #define OLED_RESET 4 - -// #define SPRINT(A) char str[32];sprintf(str,"val: %d ",A);Serial.println((char*)str); - - -// #define XDSP_07 7 -// #define XI2C_06 6 // See I2CDEVICES.md - -// #define OLED_ADDRESS1 0x3C // Oled 128x32 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_ROWS 16 // Max number of lines in display shadow buffer - -// #define OLED_FONT_WIDTH 6 -// #define OLED_FONT_HEIGTH 8 - -// #include -// #include -// #include - -// Adafruit_SH1106 *oled1106; - -// /*********************************************************************************************/ - - -// void SH1106InitDriver() { -// if (!TasmotaGlobal.i2c_enabled) { return; } - -// if (!Settings->display_model) { -// if (I2cSetDevice(OLED_ADDRESS1)) { -// Settings->display_address[0] = OLED_ADDRESS1; -// Settings->display_model = XDSP_07; -// } -// else if (I2cSetDevice(OLED_ADDRESS2)) { -// Settings->display_address[0] = OLED_ADDRESS2; -// Settings->display_model = XDSP_07; -// } -// } - -// if (XDSP_07 == Settings->display_model) { -// I2cSetActiveFound(Settings->display_address[0], "SH1106"); - -// if (Settings->display_width != SH1106_LCDWIDTH) { -// Settings->display_width = SH1106_LCDWIDTH; -// } -// if (Settings->display_height != SH1106_LCDHEIGHT) { -// Settings->display_height = SH1106_LCDHEIGHT; -// } -// // init renderer -// oled1106 = new Adafruit_SH1106(SH1106_LCDWIDTH,SH1106_LCDHEIGHT); -// renderer = oled1106; -// renderer->Begin(SH1106_SWITCHCAPVCC, Settings->display_address[0],0); -// renderer->DisplayInit(DISPLAY_INIT_MODE,Settings->display_size,Settings->display_rotate,Settings->display_font); -// renderer->setTextColor(1,0); - -// #ifdef SHOW_SPLASH -// if (!Settings->flag5.display_no_splash) { -// renderer->setTextFont(0); -// renderer->setTextSize(2); -// renderer->setCursor(20,20); -// renderer->println(F("SH1106")); -// renderer->Updateframe(); -// renderer->DisplayOnff(1); -// } -// #endif - -// AddLog(LOG_LEVEL_INFO, PSTR("DSP: SH1106")); -// } -// } - - -// /*********************************************************************************************/ -// #ifdef USE_DISPLAY_MODES1TO5 - -// void SH1106PrintLog(void) -// { -// disp_refresh--; -// if (!disp_refresh) { -// disp_refresh = Settings->display_refresh; -// if (!disp_screen_buffer_cols) { DisplayAllocScreenBuffer(); } - -// char* txt = DisplayLogBuffer('\370'); -// if (txt != NULL) { -// uint8_t last_row = Settings->display_rows -1; - -// renderer->clearDisplay(); -// renderer->setTextSize(Settings->display_size); -// renderer->setCursor(0,0); -// for (byte i = 0; i < last_row; i++) { -// strlcpy(disp_screen_buffer[i], disp_screen_buffer[i +1], disp_screen_buffer_cols); -// renderer->println(disp_screen_buffer[i]); -// } -// strlcpy(disp_screen_buffer[last_row], txt, disp_screen_buffer_cols); -// DisplayFillScreen(last_row); - -// AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "[%s]"), disp_screen_buffer[last_row]); - -// renderer->println(disp_screen_buffer[last_row]); -// renderer->Updateframe(); -// } -// } -// } - -// void SH1106Time(void) -// { -// char line[12]; - -// renderer->clearDisplay(); -// renderer->setTextSize(Settings->display_size); -// renderer->setTextFont(Settings->display_font); -// renderer->setCursor(0, 0); -// snprintf_P(line, sizeof(line), PSTR(" %02d" D_HOUR_MINUTE_SEPARATOR "%02d" D_MINUTE_SECOND_SEPARATOR "%02d"), RtcTime.hour, RtcTime.minute, RtcTime.second); // [ 12:34:56 ] -// renderer->println(line); -// renderer->println(); -// snprintf_P(line, sizeof(line), PSTR("%02d" D_MONTH_DAY_SEPARATOR "%02d" D_YEAR_MONTH_SEPARATOR "%04d"), RtcTime.day_of_month, RtcTime.month, RtcTime.year); // [01-02-2018] -// renderer->println(line); -// renderer->Updateframe(); -// } - -// void SH1106Refresh(void) // Every second -// { -// if (!renderer) return; -// if (Settings->display_mode) { // Mode 0 is User text -// switch (Settings->display_mode) { -// case 1: // Time -// SH1106Time(); -// break; -// case 2: // Local -// case 3: // Local -// case 4: // Mqtt -// case 5: // Mqtt -// SH1106PrintLog(); -// break; -// } -// } -// } - -// #endif // USE_DISPLAY_MODES1TO5 - -// /*********************************************************************************************\ -// * Interface -// \*********************************************************************************************/ - -// bool Xdsp07(uint32_t function) -// { -// if (!I2cEnabled(XI2C_06)) { return false; } - -// bool result = false; - -// if (FUNC_DISPLAY_INIT_DRIVER == function) { -// SH1106InitDriver(); -// } -// else if (XDSP_07 == Settings->display_model) { - -// switch (function) { -// case FUNC_DISPLAY_MODEL: -// result = true; -// break; -// #ifdef USE_DISPLAY_MODES1TO5 -// case FUNC_DISPLAY_EVERY_SECOND: -// SH1106Refresh(); -// break; -// #endif // USE_DISPLAY_MODES1TO5 -// } -// } -// return result; -// } - -// #endif // USE_DISPLAY_SH1106 -// #endif // USE_DISPLAY -// #endif // USE_I2C diff --git a/tasmota/tasmota_xdsp_display/xdsp_09_SSD1351.ino b/tasmota/tasmota_xdsp_display/xdsp_09_SSD1351.ino index ba776ea9d..24ea1d13d 100644 --- a/tasmota/tasmota_xdsp_display/xdsp_09_SSD1351.ino +++ b/tasmota/tasmota_xdsp_display/xdsp_09_SSD1351.ino @@ -19,163 +19,3 @@ // REMOVED // DEPRECATED - USE UNIVERSAL DISPLAY INSTEAD, https://tasmota.github.io/docs/Universal-Display-Driver/#migrating-to-udisplay - -// #ifdef USE_SPI -// #ifdef USE_DISPLAY -// #ifdef USE_DISPLAY_SSD1351 - -// #define XDSP_09 9 - -// #define COLORED 1 -// #define UNCOLORED 0 - -// // uses about 1.9k flash + renderer class -// // using font 8 is opional (num=3) -// // very badly readable, but may be useful for graphs -// #define USE_TINY_FONT - -// #include - -// bool ssd1351_init_done = false; -// extern uint8_t color_type; -// SSD1351 *ssd1351; - -// /*********************************************************************************************/ - -// void SSD1351_InitDriver() { -// if (PinUsed(GPIO_SSD1351_CS) && -// ((TasmotaGlobal.soft_spi_enabled & SPI_MOSI) || (TasmotaGlobal.spi_enabled & SPI_MOSI))) { - -// Settings->display_model = XDSP_09; - -// if (Settings->display_width != SSD1351_WIDTH) { -// Settings->display_width = SSD1351_WIDTH; -// } -// if (Settings->display_height != SSD1351_HEIGHT) { -// Settings->display_height = SSD1351_HEIGHT; -// } - -// // default colors -// fg_color = SSD1351_WHITE; -// bg_color = SSD1351_BLACK; - -// // init renderer -// if (TasmotaGlobal.soft_spi_enabled){ -// ssd1351 = new SSD1351(Pin(GPIO_SSD1351_CS), Pin(GPIO_SSPI_MOSI), Pin(GPIO_SSPI_SCLK), Pin(GPIO_SSD1351_DC)); -// } -// else if (TasmotaGlobal.spi_enabled) { -// ssd1351 = new SSD1351(Pin(GPIO_SSD1351_CS), Pin(GPIO_SPI_MOSI), Pin(GPIO_SPI_CLK), Pin(GPIO_SSD1351_DC)); -// } - -// delay(100); -// ssd1351->begin(); -// renderer = ssd1351; -// renderer->DisplayInit(DISPLAY_INIT_MODE,Settings->display_size,Settings->display_rotate,Settings->display_font); -// renderer->dim(GetDisplayDimmer16()); - -// #ifdef SHOW_SPLASH -// if (!Settings->flag5.display_no_splash) { -// // Welcome text -// renderer->setTextFont(2); -// renderer->setTextColor(SSD1351_WHITE,SSD1351_BLACK); -// renderer->DrawStringAt(10, 60, "SSD1351", SSD1351_RED,0); -// delay(1000); -// } - -// #endif -// color_type = COLOR_COLOR; - -// ssd1351_init_done = true; -// AddLog(LOG_LEVEL_INFO, PSTR("DSP: SSD1351")); -// } -// } - -// #ifdef USE_DISPLAY_MODES1TO5 - -// void SSD1351PrintLog(void) { -// disp_refresh--; -// if (!disp_refresh) { -// disp_refresh = Settings->display_refresh; -// if (!disp_screen_buffer_cols) { DisplayAllocScreenBuffer(); } - -// char* txt = DisplayLogBuffer('\370'); -// if (txt != NULL) { -// uint8_t last_row = Settings->display_rows -1; - -// renderer->clearDisplay(); -// renderer->setTextSize(Settings->display_size); -// renderer->setCursor(0,0); -// for (byte i = 0; i < last_row; i++) { -// strlcpy(disp_screen_buffer[i], disp_screen_buffer[i +1], disp_screen_buffer_cols); -// renderer->println(disp_screen_buffer[i]); -// } -// strlcpy(disp_screen_buffer[last_row], txt, disp_screen_buffer_cols); -// DisplayFillScreen(last_row); - -// AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "[%s]"), disp_screen_buffer[last_row]); - -// renderer->println(disp_screen_buffer[last_row]); -// renderer->Updateframe(); -// } -// } -// } - -// void SSD1351Time(void) { -// char line[12]; - -// renderer->clearDisplay(); -// renderer->setTextSize(2); -// renderer->setCursor(0, 0); -// snprintf_P(line, sizeof(line), PSTR(" %02d" D_HOUR_MINUTE_SEPARATOR "%02d" D_MINUTE_SECOND_SEPARATOR "%02d"), RtcTime.hour, RtcTime.minute, RtcTime.second); // [ 12:34:56 ] -// renderer->println(line); -// renderer->println(); -// snprintf_P(line, sizeof(line), PSTR("%02d" D_MONTH_DAY_SEPARATOR "%02d" D_YEAR_MONTH_SEPARATOR "%04d"), RtcTime.day_of_month, RtcTime.month, RtcTime.year); // [01-02-2018] -// renderer->println(line); -// renderer->Updateframe(); -// } - -// void SSD1351Refresh(void) { // Every second -// if (Settings->display_mode) { // Mode 0 is User text -// switch (Settings->display_mode) { -// case 1: // Time -// SSD1351Time(); -// break; -// case 2: // Local -// case 3: // Local -// case 4: // Mqtt -// case 5: // Mqtt -// SSD1351PrintLog(); -// break; -// } -// } -// } - -// #endif // USE_DISPLAY_MODES1TO5 - -// /*********************************************************************************************\ -// * Interface -// \*********************************************************************************************/ - -// bool Xdsp09(uint32_t function) { -// bool result = false; - -// if (FUNC_DISPLAY_INIT_DRIVER == function) { -// SSD1351_InitDriver(); -// } -// else if (ssd1351_init_done && (XDSP_09 == Settings->display_model)) { -// switch (function) { -// case FUNC_DISPLAY_MODEL: -// result = true; -// break; -// #ifdef USE_DISPLAY_MODES1TO5 -// case FUNC_DISPLAY_EVERY_SECOND: -// SSD1351Refresh(); -// break; -// #endif // USE_DISPLAY_MODES1TO5 -// } -// } -// return result; -// } -// #endif // USE_DISPLAY_SSD1351 -// #endif // USE_DISPLAY -// #endif // USE_SPI diff --git a/tasmota/tasmota_xdsp_display/xdsp_12_ST7789.ino b/tasmota/tasmota_xdsp_display/xdsp_12_ST7789.ino index 6f8af6826..c00c336c1 100644 --- a/tasmota/tasmota_xdsp_display/xdsp_12_ST7789.ino +++ b/tasmota/tasmota_xdsp_display/xdsp_12_ST7789.ino @@ -19,194 +19,3 @@ // REMOVED // DEPRECATED - USE UNIVERSAL DISPLAY INSTEAD, https://tasmota.github.io/docs/Universal-Display-Driver/#migrating-to-udisplay - -// //#ifdef USE_SPI -// #ifdef USE_SPI -// #ifdef USE_DISPLAY -// #ifdef USE_DISPLAY_ST7789 - -// #define XDSP_12 12 -// #define XI2C_38 38 // See I2CDEVICES.md - -// #undef COLORED -// #define COLORED 1 -// #undef UNCOLORED -// #define UNCOLORED 0 - -// // touch panel controller -// #undef FT5206_address -// #define FT5206_address 0x38 - -// // using font 8 is opional (num=3) -// // very badly readable, but may be useful for graphs -// #undef USE_TINY_FONT -// #define USE_TINY_FONT - - -// #include -// #include - -// // currently fixed -// #define BACKPLANE_PIN 2 -// #ifdef USE_LANBON_L8 -// #undef BACKPLANE_PIN -// #define BACKPLANE_PIN 5 -// #endif // USE_LANBON_L8 - -// extern uint8_t color_type; -// Arduino_ST7789 *st7789; - -// #ifdef USE_FT5206 -// uint8_t st7789_ctouch_counter = 0; -// #endif // USE_FT5206 -// bool st7789_init_done = false; - -// /*********************************************************************************************/ - -// void ST7789_InitDriver(void) { -// if (PinUsed(GPIO_ST7789_DC) && // This device does not need CS which breaks SPI bus usage -// ((TasmotaGlobal.soft_spi_enabled & SPI_MOSI) || (TasmotaGlobal.spi_enabled & SPI_MOSI))) { - -// Settings->display_model = XDSP_12; - -// if (!Settings->display_width) { -// Settings->display_width = 240; -// } -// if (!Settings->display_height) { -// Settings->display_height = 240; -// } - -// // default colors -// fg_color = ST7789_WHITE; -// bg_color = ST7789_BLACK; - -// int8_t bppin = BACKPLANE_PIN; -// if (PinUsed(GPIO_BACKLIGHT)) { -// bppin = Pin(GPIO_BACKLIGHT); -// } - -// // init renderer, may use hardware spi -// if (TasmotaGlobal.soft_spi_enabled) { -// st7789 = new Arduino_ST7789(Pin(GPIO_ST7789_DC), Pin(GPIO_OLED_RESET), Pin(GPIO_SSPI_MOSI), Pin(GPIO_SSPI_SCLK), Pin(GPIO_ST7789_CS), bppin); -// } -// else if (TasmotaGlobal.spi_enabled) { -// st7789 = new Arduino_ST7789(Pin(GPIO_ST7789_DC), Pin(GPIO_OLED_RESET), Pin(GPIO_ST7789_CS), bppin); -// } - -// st7789->init(Settings->display_width,Settings->display_height); -// renderer = st7789; -// renderer->DisplayInit(DISPLAY_INIT_MODE,Settings->display_size,Settings->display_rotate,Settings->display_font); -// renderer->dim(GetDisplayDimmer16()); - -// #ifdef SHOW_SPLASH -// if (!Settings->flag5.display_no_splash) { -// // Welcome text -// renderer->setTextColor(ST7789_WHITE,ST7789_BLACK); -// renderer->setTextFont(2); -// renderer->DrawStringAt(30, (Settings->display_height-12)/2, "ST7789 TFT!", ST7789_WHITE,0); -// delay(1000); -// } -// #endif - -// color_type = COLOR_COLOR; - -// #ifdef ESP32 -// #ifdef USE_FT5206 -// // start digitizer with fixed adress and pins for esp32 -// #undef SDA_2 -// #undef SCL_2 -// #define SDA_2 23 -// #define SCL_2 32 -// #ifdef USE_LANBON_L8 -// #undef SDA_2 -// #undef SCL_2 -// #define SDA_2 4 -// #define SCL_2 0 -// #endif // USE_LANBON_L8 -// Wire1.begin(SDA_2, SCL_2, (uint32_t)400000); -// FT5206_Touch_Init(Wire1); -// #endif // USE_FT5206 -// #endif // ESP32 - -// st7789_init_done = true; -// AddLog(LOG_LEVEL_INFO, PSTR("DSP: ST7789")); -// } -// } - -// #ifdef ESP32 -// #ifdef USE_FT5206 -// #ifdef USE_TOUCH_BUTTONS - -// void ST7789_RotConvert(int16_t *x, int16_t *y) { -// int16_t temp; -// if (renderer) { -// uint8_t rot=renderer->getRotation(); -// switch (rot) { -// case 0: -// break; -// case 1: -// temp=*y; -// *y=renderer->height()-*x; -// *x=temp; -// break; -// case 2: -// *x=renderer->width()-*x; -// *y=renderer->height()-*y; -// break; -// case 3: -// temp=*y; -// *y=*x; -// *x=renderer->width()-temp; -// break; -// } -// } -// } - -// // check digitizer hit -// void ST7789_CheckTouch() { -// st7789_ctouch_counter++; -// if (2 == st7789_ctouch_counter) { -// // every 100 ms should be enough -// st7789_ctouch_counter = 0; -// Touch_Check(ST7789_RotConvert); -// } -// } -// #endif // USE_TOUCH_BUTTONS -// #endif // USE_FT5206 -// #endif // ESP32 - -// /*********************************************************************************************/ -// /*********************************************************************************************\ -// * Interface -// \*********************************************************************************************/ -// bool Xdsp12(uint32_t function) -// { -// bool result = false; - -// //AddLog(LOG_LEVEL_INFO, PSTR("touch %d - %d"), FT5206_found, function); - -// if (FUNC_DISPLAY_INIT_DRIVER == function) { -// ST7789_InitDriver(); -// } -// else if (st7789_init_done && (XDSP_12 == Settings->display_model)) { -// switch (function) { -// case FUNC_DISPLAY_MODEL: -// result = true; -// break; -// case FUNC_DISPLAY_EVERY_50_MSECOND: -// #ifdef USE_FT5206 -// #ifdef USE_TOUCH_BUTTONS -// if (FT5206_found) { -// ST7789_CheckTouch(); -// } -// #endif -// #endif // USE_FT5206 -// break; -// } -// } -// return result; -// } - -// #endif // USE_DISPLAY_ST7789 -// #endif // USE_DISPLAY -// #endif // USE_SPI diff --git a/tasmota/tasmota_xdsp_display/xdsp_14_SSD1331.ino b/tasmota/tasmota_xdsp_display/xdsp_14_SSD1331.ino index 26e828af0..2f6f88ced 100644 --- a/tasmota/tasmota_xdsp_display/xdsp_14_SSD1331.ino +++ b/tasmota/tasmota_xdsp_display/xdsp_14_SSD1331.ino @@ -19,179 +19,3 @@ // REMOVED // DEPRECATED - USE UNIVERSAL DISPLAY INSTEAD, https://tasmota.github.io/docs/Universal-Display-Driver/#migrating-to-udisplay - -// #ifdef USE_SPI -// #ifdef USE_DISPLAY -// #ifdef USE_DISPLAY_SSD1331 // This driver eats 5.3 K flash - -// #define XDSP_14 14 - -// #define COLORED 1 -// #define UNCOLORED 0 -// #define USE_TINY_FONT - -// #define SSD1331_BLACK 0x0000 // 0, 0, 0 -// #define SSD1331_WHITE 0xFFFF // 255, 255, 255 -// #define SSD1331_RED 0xF800 // 255, 0, 0 -// #define SSD1331_BLUE 0x001F // 0, 0, 255 - -// #include -// #include - -// bool ssd1331_init_done = false; - -// extern uint8_t color_type; -// Adafruit_SSD1331 *ssd1331; - -// /*********************************************************************************************/ - -// void SSD1331_InitDriver() { -// if (PinUsed(GPIO_SSD1331_CS) && PinUsed(GPIO_SSD1331_DC) && -// ((TasmotaGlobal.soft_spi_enabled & SPI_MOSI) || (TasmotaGlobal.spi_enabled & SPI_MOSI))) { - -// Settings->display_model = XDSP_14; - -// if (Settings->display_width != Adafruit_SSD1331::TFTWIDTH) { -// Settings->display_width = Adafruit_SSD1331::TFTWIDTH; -// } -// if (Settings->display_height != Adafruit_SSD1331::TFTHEIGHT) { -// Settings->display_height = Adafruit_SSD1331::TFTHEIGHT; -// } - - -// // default colors -// fg_color = SSD1331_WHITE; -// bg_color = SSD1331_BLACK; - -// // init renderer -// if (TasmotaGlobal.soft_spi_enabled) { -// ssd1331 = new Adafruit_SSD1331(Pin(GPIO_SSD1331_CS), Pin(GPIO_SSD1331_DC), Pin(GPIO_SSPI_MOSI), Pin(GPIO_SSPI_SCLK), Pin(GPIO_OLED_RESET)); -// } -// else if (TasmotaGlobal.spi_enabled) { -// ssd1331 = new Adafruit_SSD1331(&SPI, Pin(GPIO_SSD1331_CS), Pin(GPIO_SSD1331_DC), Pin(GPIO_OLED_RESET)); -// } - -// delay(100); -// ssd1331->begin(); -// renderer = ssd1331; -// // Rotation is currently broken, https://github.com/adafruit/Adafruit-SSD1331-OLED-Driver-Library-for-Arduino/issues/26 -// renderer->DisplayInit(DISPLAY_INIT_MODE, Settings->display_size, Settings->display_rotate, Settings->display_font); -// renderer->dim(GetDisplayDimmer16()); - -// #ifdef SHOW_SPLASH -// if (!Settings->flag5.display_no_splash) { -// // Welcome text -// renderer->clearDisplay(); -// renderer->setTextFont(1); -// renderer->DrawStringAt(24, 27, "SSD1331", SSD1331_RED, 0); -// delay(1000); -// renderer->clearDisplay(); -// } -// #endif - -// color_type = COLOR_COLOR; - -// ssd1331_init_done = true; -// AddLog(LOG_LEVEL_INFO, PSTR("DSP: SSD1331")); -// } -// } - -// #ifdef USE_DISPLAY_MODES1TO5 - -// void SSD1331PrintLog(bool withDateTime) { -// disp_refresh--; -// if (!disp_refresh) { -// disp_refresh = Settings->display_refresh; -// if (!disp_screen_buffer_cols) { DisplayAllocScreenBuffer(); } - -// char* txt = DisplayLogBuffer('\370'); -// if (txt != NULL) { -// uint8_t last_row = Settings->display_rows -1; - -// renderer->clearDisplay(); -// renderer->setCursor(0,0); - -// if (withDateTime) { -// char line[17]; -// snprintf_P(line, sizeof(line), PSTR("%02d" D_HOUR_MINUTE_SEPARATOR "%02d %02d" D_MONTH_DAY_SEPARATOR "%02d" D_YEAR_MONTH_SEPARATOR "%04d"), RtcTime.hour, RtcTime.minute, RtcTime.day_of_month, RtcTime.month, RtcTime.year); // [12:34 01-02-2018] -// renderer->setTextColor(SSD1331_BLUE); -// renderer->println(line); -// renderer->setTextColor(fg_color); -// last_row--; -// } - -// for (byte i = 0; i < last_row; i++) { -// strlcpy(disp_screen_buffer[i], disp_screen_buffer[i +1], disp_screen_buffer_cols); -// renderer->println(disp_screen_buffer[i]); -// } -// strlcpy(disp_screen_buffer[last_row], txt, disp_screen_buffer_cols); -// DisplayFillScreen(last_row); - -// AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_DEBUG "[%s]"), disp_screen_buffer[last_row]); - -// renderer->println(disp_screen_buffer[last_row]); -// renderer->Updateframe(); -// } -// } -// } - -// void SSD1331Time(void) { -// char line[12]; - -// renderer->clearDisplay(); -// snprintf_P(line, sizeof(line), PSTR(" %02d" D_HOUR_MINUTE_SEPARATOR "%02d" D_MINUTE_SECOND_SEPARATOR "%02d"), RtcTime.hour, RtcTime.minute, RtcTime.second); // [ 12:34:56 ] -// renderer->setCursor(17, 20); -// renderer->println(line); -// snprintf_P(line, sizeof(line), PSTR("%02d" D_MONTH_DAY_SEPARATOR "%02d" D_YEAR_MONTH_SEPARATOR "%04d"), RtcTime.day_of_month, RtcTime.month, RtcTime.year); // [01-02-2018] -// renderer->setCursor(17, 35); -// renderer->println(line); -// renderer->Updateframe(); -// } - -// void SSD1331Refresh(void) { // Every second -// if (Settings->display_mode) { // Mode 0 is User text -// switch (Settings->display_mode) { -// case 1: // Time -// SSD1331Time(); -// break; -// case 2: // Local -// case 4: // Mqtt -// SSD1331PrintLog(false); -// break; -// case 3: // Local + Time -// case 5: // Mqtt + Time -// SSD1331PrintLog(true); -// break; -// } -// } -// } - -// #endif // USE_DISPLAY_MODES1TO5 - -// /*********************************************************************************************\ -// * Interface -// \*********************************************************************************************/ - -// bool Xdsp14(uint32_t function) { -// bool result = false; - -// if (FUNC_DISPLAY_INIT_DRIVER == function) { -// SSD1331_InitDriver(); -// } -// else if (ssd1331_init_done && (XDSP_14 == Settings->display_model)) { -// switch (function) { -// case FUNC_DISPLAY_MODEL: -// result = true; -// break; -// #ifdef USE_DISPLAY_MODES1TO5 -// case FUNC_DISPLAY_EVERY_SECOND: -// SSD1331Refresh(); -// break; -// #endif // USE_DISPLAY_MODES1TO5 -// } -// } -// return result; -// } -// #endif // USE_DISPLAY_SSD1331 -// #endif // USE_DISPLAY -// #endif // USE_SPI diff --git a/tasmota/tasmota_xdsp_display/xdsp_17_universal.ino b/tasmota/tasmota_xdsp_display/xdsp_17_universal.ino index 9a11d29f4..e1845ccea 100644 --- a/tasmota/tasmota_xdsp_display/xdsp_17_universal.ino +++ b/tasmota/tasmota_xdsp_display/xdsp_17_universal.ino @@ -482,11 +482,6 @@ int8_t cs; bg_color = renderer->bgcol(); color_type = renderer->color_type(); -#ifdef USE_M5STACK_CORE2 - renderer->SetPwrCB(Core2DisplayPower); - renderer->SetDimCB(Core2DisplayDim); -#endif // USE_M5STACK_CORE2 - renderer->DisplayInit(DISPLAY_INIT_MODE, Settings->display_size, inirot, Settings->display_font); Settings->display_width = renderer->width();