mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-24 11:16:34 +00:00
Merge branch 'development' into pre-release-9.3.0
This commit is contained in:
commit
488edab49c
@ -136,7 +136,7 @@ static const uint8_t PROGMEM ili9342_initcmd[] = {
|
||||
0x00 // End of list
|
||||
};
|
||||
|
||||
ILI9341_2::ILI9341_2(int8_t cs, int8_t mosi, int8_t miso, int8_t sclk, int8_t res, int8_t dc, int8_t bp, int8_t spibus) : Renderer(ILI9341_TFTWIDTH, ILI9341_TFTHEIGHT) {
|
||||
ILI9341_2::ILI9341_2(int8_t cs, int8_t mosi, int8_t miso, int8_t sclk, int8_t res, int8_t dc, int8_t bp, int8_t spibus, uint8_t dtype) : Renderer(ILI9341_TFTWIDTH, ILI9341_TFTHEIGHT) {
|
||||
_cs = cs;
|
||||
_mosi = mosi;
|
||||
_miso = miso;
|
||||
@ -144,7 +144,7 @@ ILI9341_2::ILI9341_2(int8_t cs, int8_t mosi, int8_t miso, int8_t sclk, int8_t re
|
||||
_res = res;
|
||||
_dc = dc;
|
||||
_bp = bp;
|
||||
_hwspi = 1; // sign ili9341
|
||||
_hwspi = dtype; // sign ili9341 or 2
|
||||
_spibus = spibus;
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,7 @@ class ILI9341_2 : public Renderer {
|
||||
|
||||
public:
|
||||
|
||||
ILI9341_2(int8_t cs, int8_t mosi, int8_t miso, int8_t sclk, int8_t res, int8_t dc, int8_t bp, int8_t spibus);
|
||||
ILI9341_2(int8_t cs, int8_t mosi, int8_t miso, int8_t sclk, int8_t res, int8_t dc, int8_t bp, int8_t spibus, uint8_t dtype);
|
||||
ILI9341_2(int8_t cs, int8_t res, int8_t dc, int8_t bp);
|
||||
|
||||
void init(uint16_t width, uint16_t height);
|
||||
|
@ -405,12 +405,13 @@ bool ESP_Mail_Client::readMail(IMAPSession *imap, bool closeSession)
|
||||
if (!SD.exists(imap->_config->storage.saved_path))
|
||||
createDirs(imap->_config->storage.saved_path);
|
||||
}
|
||||
else if (!_flashOk && imap->_storageType == esp_mail_file_storage_type_flash)
|
||||
else if (!_flashOk && imap->_storageType == esp_mail_file_storage_type_flash) {
|
||||
#if defined(ESP32)
|
||||
_flashOk = SPIFFS.begin(FORMAT_SPIFFS_IF_FAILED);
|
||||
// _flashOk = SPIFFS.begin(FORMAT_SPIFFS_IF_FAILED);
|
||||
#elif defined(ESP8266)
|
||||
_flashOk = FLASH_FS.begin();
|
||||
// _flashOk = FLASH_FS.begin();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
if (cHeader(imap)->part_headers.size() > 0)
|
||||
@ -602,13 +603,13 @@ bool ESP_Mail_Client::readMail(IMAPSession *imap, bool closeSession)
|
||||
}
|
||||
else if (imap->_storageType == esp_mail_file_storage_type_flash)
|
||||
{
|
||||
if (_flashOk)
|
||||
if (_flashOk) {
|
||||
#if defined(ESP32)
|
||||
SPIFFS.end();
|
||||
// SPIFFS.end();
|
||||
#elif defined(ESP8266)
|
||||
FLASH_FS.end();
|
||||
// FLASH_FS.end();
|
||||
#endif
|
||||
|
||||
}
|
||||
_flashOk = false;
|
||||
}
|
||||
}
|
||||
@ -2752,13 +2753,13 @@ bool ESP_Mail_Client::sendAttachments(SMTPSession *smtp, SMTP_Message *msg, cons
|
||||
if (!_sdOk && att->file.storage_type == esp_mail_file_storage_type_sd)
|
||||
_sdOk = sdTest();
|
||||
|
||||
if (!_flashOk && att->file.storage_type == esp_mail_file_storage_type_flash)
|
||||
if (!_flashOk && att->file.storage_type == esp_mail_file_storage_type_flash) {
|
||||
#if defined(ESP32)
|
||||
_flashOk = SPIFFS.begin(FORMAT_SPIFFS_IF_FAILED);
|
||||
// _flashOk = SPIFFS.begin(FORMAT_SPIFFS_IF_FAILED);
|
||||
#elif defined(ESP8266)
|
||||
_flashOk = FLASH_FS.begin();
|
||||
// _flashOk = FLASH_FS.begin();
|
||||
#endif
|
||||
|
||||
}
|
||||
if ((!_sdOk && att->file.storage_type == esp_mail_file_storage_type_sd) || (!_flashOk && att->file.storage_type == esp_mail_file_storage_type_flash))
|
||||
{
|
||||
|
||||
@ -2815,9 +2816,9 @@ bool ESP_Mail_Client::openFileRead(SMTPSession *smtp, SMTP_Message *msg, SMTP_At
|
||||
}
|
||||
else if (att->file.storage_type == esp_mail_file_storage_type_flash) {
|
||||
#if defined(ESP32)
|
||||
file_existed = SPIFFS.exists(filepath.c_str());
|
||||
//file_existed = SPIFFS.exists(filepath.c_str());
|
||||
#elif defined(ESP8266)
|
||||
file_existed = FLASH_FS.exists(filepath.c_str());
|
||||
//file_existed = FLASH_FS.exists(filepath.c_str());
|
||||
#endif
|
||||
} else if (att->file.storage_type == esp_mail_file_storage_type_univ) {
|
||||
file_existed = ufsp->exists(filepath.c_str());
|
||||
@ -2838,9 +2839,9 @@ bool ESP_Mail_Client::openFileRead(SMTPSession *smtp, SMTP_Message *msg, SMTP_At
|
||||
}
|
||||
else if (att->file.storage_type == esp_mail_file_storage_type_flash) {
|
||||
#if defined(ESP32)
|
||||
file_existed = SPIFFS.exists(filepath.c_str());
|
||||
//file_existed = SPIFFS.exists(filepath.c_str());
|
||||
#elif defined(ESP8266)
|
||||
file_existed = FLASH_FS.exists(filepath.c_str());
|
||||
//file_existed = FLASH_FS.exists(filepath.c_str());
|
||||
#endif
|
||||
}
|
||||
else if (att->file.storage_type == esp_mail_file_storage_type_univ) {
|
||||
@ -2882,9 +2883,9 @@ bool ESP_Mail_Client::openFileRead(SMTPSession *smtp, SMTP_Message *msg, SMTP_At
|
||||
}
|
||||
else if (att->file.storage_type == esp_mail_file_storage_type_flash) {
|
||||
#if defined(ESP32)
|
||||
file = SPIFFS.open(filepath.c_str(), FILE_READ);
|
||||
//file = SPIFFS.open(filepath.c_str(), FILE_READ);
|
||||
#elif defined(ESP8266)
|
||||
file = FLASH_FS.open(filepath.c_str(), "r");
|
||||
//file = FLASH_FS.open(filepath.c_str(), "r");
|
||||
#endif
|
||||
}
|
||||
else if (att->file.storage_type == esp_mail_file_storage_type_univ) {
|
||||
@ -2997,13 +2998,13 @@ bool ESP_Mail_Client::sendInline(SMTPSession *smtp, SMTP_Message *msg, const std
|
||||
if (!_sdOk && att->file.storage_type == esp_mail_file_storage_type_sd)
|
||||
_sdOk = sdTest();
|
||||
|
||||
if (!_flashOk && att->file.storage_type == esp_mail_file_storage_type_flash)
|
||||
if (!_flashOk && att->file.storage_type == esp_mail_file_storage_type_flash) {
|
||||
#if defined(ESP32)
|
||||
_flashOk = SPIFFS.begin(FORMAT_SPIFFS_IF_FAILED);
|
||||
// _flashOk = SPIFFS.begin(FORMAT_SPIFFS_IF_FAILED);
|
||||
#elif defined(ESP8266)
|
||||
_flashOk = FLASH_FS.begin();
|
||||
// _flashOk = FLASH_FS.begin();
|
||||
#endif
|
||||
|
||||
}
|
||||
if ((!_sdOk && att->file.storage_type == esp_mail_file_storage_type_sd) || (!_flashOk && att->file.storage_type == esp_mail_file_storage_type_flash))
|
||||
{
|
||||
|
||||
@ -5694,13 +5695,13 @@ void ESP_Mail_Client::saveHeader(IMAPSession *imap)
|
||||
prepareFilePath(imap, headerFilePath, true);
|
||||
if (imap->_storageType == esp_mail_file_storage_type_sd && !_sdOk)
|
||||
_sdOk = sdTest();
|
||||
else if (imap->_storageType == esp_mail_file_storage_type_flash && !_flashOk)
|
||||
else if (imap->_storageType == esp_mail_file_storage_type_flash && !_flashOk) {
|
||||
#if defined(ESP32)
|
||||
_flashOk = SPIFFS.begin(FORMAT_SPIFFS_IF_FAILED);
|
||||
// _flashOk = SPIFFS.begin(FORMAT_SPIFFS_IF_FAILED);
|
||||
#elif defined(ESP8266)
|
||||
_flashOk = FLASH_FS.begin();
|
||||
// _flashOk = FLASH_FS.begin();
|
||||
#endif
|
||||
|
||||
}
|
||||
if (_sdOk || _flashOk)
|
||||
{
|
||||
if (file)
|
||||
@ -5708,13 +5709,13 @@ void ESP_Mail_Client::saveHeader(IMAPSession *imap)
|
||||
|
||||
if (imap->_storageType == esp_mail_file_storage_type_sd)
|
||||
file = SD.open(headerFilePath.c_str(), FILE_WRITE);
|
||||
else if (imap->_storageType == esp_mail_file_storage_type_flash)
|
||||
else if (imap->_storageType == esp_mail_file_storage_type_flash) {
|
||||
#if defined(ESP32)
|
||||
file = SPIFFS.open(headerFilePath.c_str(), FILE_WRITE);
|
||||
// file = SPIFFS.open(headerFilePath.c_str(), FILE_WRITE);
|
||||
#elif defined(ESP8266)
|
||||
file = FLASH_FS.open(headerFilePath.c_str(), "w");
|
||||
// file = FLASH_FS.open(headerFilePath.c_str(), "w");
|
||||
#endif
|
||||
|
||||
}
|
||||
if (file)
|
||||
{
|
||||
std::string s;
|
||||
@ -5932,13 +5933,13 @@ bool ESP_Mail_Client::handleAttachment(IMAPSession *imap, char *buf, int bufLen,
|
||||
|
||||
if (imap->_storageType == esp_mail_file_storage_type_sd && !_sdOk)
|
||||
_sdOk = sdTest();
|
||||
else if (imap->_storageType == esp_mail_file_storage_type_flash && !_flashOk)
|
||||
else if (imap->_storageType == esp_mail_file_storage_type_flash && !_flashOk) {
|
||||
#if defined(ESP32)
|
||||
_flashOk = SPIFFS.begin(FORMAT_SPIFFS_IF_FAILED);
|
||||
// _flashOk = SPIFFS.begin(FORMAT_SPIFFS_IF_FAILED);
|
||||
#elif defined(ESP8266)
|
||||
_flashOk = FLASH_FS.begin();
|
||||
// _flashOk = FLASH_FS.begin();
|
||||
#endif
|
||||
|
||||
}
|
||||
if (_sdOk || _flashOk)
|
||||
{
|
||||
|
||||
@ -5962,12 +5963,13 @@ bool ESP_Mail_Client::handleAttachment(IMAPSession *imap, char *buf, int bufLen,
|
||||
|
||||
if (imap->_storageType == esp_mail_file_storage_type_sd)
|
||||
file = SD.open(filePath.c_str(), FILE_WRITE);
|
||||
else if (imap->_storageType == esp_mail_file_storage_type_flash)
|
||||
else if (imap->_storageType == esp_mail_file_storage_type_flash) {
|
||||
#if defined(ESP32)
|
||||
file = SPIFFS.open(filePath.c_str(), FILE_WRITE);
|
||||
// file = SPIFFS.open(filePath.c_str(), FILE_WRITE);
|
||||
#elif defined(ESP8266)
|
||||
file = FLASH_FS.open(filePath.c_str(), "w");
|
||||
// file = FLASH_FS.open(filePath.c_str(), "w");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -6362,12 +6364,13 @@ void ESP_Mail_Client::decodeText(IMAPSession *imap, char *buf, int bufLen, int &
|
||||
|
||||
if (imap->_storageType == esp_mail_file_storage_type_sd)
|
||||
file = SD.open(filePath.c_str(), FILE_WRITE);
|
||||
else if (imap->_storageType == esp_mail_file_storage_type_flash)
|
||||
else if (imap->_storageType == esp_mail_file_storage_type_flash) {
|
||||
#if defined(ESP32)
|
||||
file = SPIFFS.open(filePath.c_str(), FILE_WRITE);
|
||||
// file = SPIFFS.open(filePath.c_str(), FILE_WRITE);
|
||||
#elif defined(ESP8266)
|
||||
file = FLASH_FS.open(filePath.c_str(), "w");
|
||||
// file = FLASH_FS.open(filePath.c_str(), "w");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -7294,12 +7297,13 @@ bool IMAPSession::connect(ESP_Mail_Session *sesssion, IMAP_Config *config)
|
||||
{
|
||||
if (_sesson_cfg->certificate.cert_file_storage_type == esp_mail_file_storage_type::esp_mail_file_storage_type_sd && !MailClient._sdOk)
|
||||
MailClient._sdOk = MailClient.sdTest();
|
||||
if (_sesson_cfg->certificate.cert_file_storage_type == esp_mail_file_storage_type::esp_mail_file_storage_type_flash && !MailClient._flashOk)
|
||||
if (_sesson_cfg->certificate.cert_file_storage_type == esp_mail_file_storage_type::esp_mail_file_storage_type_flash && !MailClient._flashOk) {
|
||||
#if defined(ESP32)
|
||||
MailClient._flashOk = SPIFFS.begin(FORMAT_SPIFFS_IF_FAILED);
|
||||
// MailClient._flashOk = SPIFFS.begin(FORMAT_SPIFFS_IF_FAILED);
|
||||
#elif defined(ESP8266)
|
||||
MailClient._flashOk = FLASH_FS.begin();
|
||||
// MailClient._flashOk = FLASH_FS.begin();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
return MailClient.imapAuth(this);
|
||||
@ -7978,12 +7982,14 @@ bool SMTPSession::connect(ESP_Mail_Session *config)
|
||||
{
|
||||
if (_sesson_cfg->certificate.cert_file_storage_type == esp_mail_file_storage_type::esp_mail_file_storage_type_sd && !MailClient._sdOk)
|
||||
MailClient._sdOk = MailClient.sdTest();
|
||||
if (_sesson_cfg->certificate.cert_file_storage_type == esp_mail_file_storage_type::esp_mail_file_storage_type_flash && !MailClient._flashOk)
|
||||
if (_sesson_cfg->certificate.cert_file_storage_type == esp_mail_file_storage_type::esp_mail_file_storage_type_flash && !MailClient._flashOk) {
|
||||
#if defined(ESP32)
|
||||
MailClient._flashOk = SPIFFS.begin(FORMAT_SPIFFS_IF_FAILED);
|
||||
// MailClient._flashOk = SPIFFS.begin(FORMAT_SPIFFS_IF_FAILED);
|
||||
#elif defined(ESP8266)
|
||||
MailClient._flashOk = FLASH_FS.begin();
|
||||
// MailClient._flashOk = FLASH_FS.begin();
|
||||
#endif
|
||||
MailClient._flashOk = 1;
|
||||
}
|
||||
}
|
||||
return MailClient.smtpAuth(this);
|
||||
}
|
||||
|
@ -48,7 +48,7 @@
|
||||
#include <HTTPClient.h>
|
||||
#include <WiFiClientSecure.h>
|
||||
#include <FS.h>
|
||||
#include <SPIFFS.h>
|
||||
//#include <SPIFFS.h>
|
||||
#include <ETH.h>
|
||||
#include "wcs/esp32/ESP_Mail_HTTPClient32.h"
|
||||
#include "extras/ESPTimeHelper.h"
|
||||
|
@ -1,17 +1,17 @@
|
||||
/*
|
||||
* Customized version of ESP32 HTTPClient Library.
|
||||
*
|
||||
* Customized version of ESP32 HTTPClient Library.
|
||||
*
|
||||
* v 1.1.1
|
||||
*
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
* Copyright (c) 2021 K. Suwatchai (Mobizt)
|
||||
*
|
||||
*
|
||||
* HTTPClient Arduino library for ESP32
|
||||
*
|
||||
* Copyright (c) 2015 Markus Sattler. All rights reserved.
|
||||
* This file is part of the HTTPClient for Arduino.
|
||||
* Port to ESP32 by Evandro Luis Copercini (2017),
|
||||
* changed fingerprints to CA verification.
|
||||
* Port to ESP32 by Evandro Luis Copercini (2017),
|
||||
* changed fingerprints to CA verification.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@ -205,8 +205,9 @@ void ESP_Mail_HTTPClient32::setCertFile(const char *caCertFile, esp_mail_file_st
|
||||
bool t = false;
|
||||
_certType = 2;
|
||||
|
||||
if (storageType == esp_mail_file_storage_type::esp_mail_file_storage_type_flash)
|
||||
t = SPIFFS.begin(true);
|
||||
if (storageType == esp_mail_file_storage_type::esp_mail_file_storage_type_flash) {
|
||||
// t = SPIFFS.begin(true);
|
||||
}
|
||||
else if (storageType == esp_mail_file_storage_type::esp_mail_file_storage_type_sd)
|
||||
t = SD.begin();
|
||||
if (!t)
|
||||
@ -215,8 +216,8 @@ void ESP_Mail_HTTPClient32::setCertFile(const char *caCertFile, esp_mail_file_st
|
||||
File f;
|
||||
if (storageType == esp_mail_file_storage_type::esp_mail_file_storage_type_flash)
|
||||
{
|
||||
if (SPIFFS.exists(caCertFile))
|
||||
f = SPIFFS.open(caCertFile, FILE_READ);
|
||||
//if (SPIFFS.exists(caCertFile))
|
||||
// f = SPIFFS.open(caCertFile, FILE_READ);
|
||||
}
|
||||
else if (storageType == esp_mail_file_storage_type::esp_mail_file_storage_type_sd)
|
||||
{
|
||||
|
@ -1,17 +1,17 @@
|
||||
/*
|
||||
* Customized version of ESP32 HTTPClient Library.
|
||||
*
|
||||
* Customized version of ESP32 HTTPClient Library.
|
||||
*
|
||||
* v 1.1.1
|
||||
*
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
* Copyright (c) 2021 K. Suwatchai (Mobizt)
|
||||
*
|
||||
*
|
||||
* HTTPClient Arduino library for ESP32
|
||||
*
|
||||
* Copyright (c) 2015 Markus Sattler. All rights reserved.
|
||||
* This file is part of the HTTPClient for Arduino.
|
||||
* Port to ESP32 by Evandro Luis Copercini (2017),
|
||||
* changed fingerprints to CA verification.
|
||||
* Port to ESP32 by Evandro Luis Copercini (2017),
|
||||
* changed fingerprints to CA verification.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@ -37,7 +37,7 @@
|
||||
#include <Arduino.h>
|
||||
#include <WiFiClient.h>
|
||||
#include <FS.h>
|
||||
#include <SPIFFS.h>
|
||||
//#include <SPIFFS.h>
|
||||
#include <SD.h>
|
||||
#include "ESP_Mail_WCS32.h"
|
||||
|
||||
@ -115,7 +115,7 @@ public:
|
||||
* \param host - Host name without protocols.
|
||||
* \param port - Server's port.
|
||||
* \return True as default.
|
||||
* If no certificate string provided, use (const char*)NULL to CAcert param
|
||||
* If no certificate string provided, use (const char*)NULL to CAcert param
|
||||
*/
|
||||
bool begin(const char *host, uint16_t port);
|
||||
|
||||
@ -129,7 +129,7 @@ public:
|
||||
* Establish http connection if header provided and send it, send payload if provided.
|
||||
* \param header - The header string (constant chars array).
|
||||
* \param payload - The payload string (constant chars array), optional.
|
||||
* \return http status code, Return zero if new http connection and header and/or payload sent
|
||||
* \return http status code, Return zero if new http connection and header and/or payload sent
|
||||
* with no error or no header and payload provided. If obly payload provided, no new http connection was established.
|
||||
*/
|
||||
int send(const char *header, const char *payload);
|
||||
@ -138,7 +138,7 @@ public:
|
||||
* Send extra header without making new http connection (if send has been called)
|
||||
* \param header - The header string (constant chars array).
|
||||
* \return True if header sending success.
|
||||
* Need to call send with header first.
|
||||
* Need to call send with header first.
|
||||
*/
|
||||
bool send(const char *header);
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
Customized version of WiFiClientSecure.cpp
|
||||
|
||||
|
||||
WiFiClientBearSSL- SSL client/server for esp8266 using BearSSL libraries
|
||||
- Mostly compatible with Arduino WiFi shield library and standard
|
||||
WiFiClient/ServerSecure (except for certificate handling).
|
||||
@ -53,6 +53,9 @@ extern "C"
|
||||
#include <c_types.h>
|
||||
#include <coredecls.h>
|
||||
|
||||
//#define Optimistic_yield(A) optimistic_yield(A);ESP.wdtFeed();
|
||||
#define Optimistic_yield(A) optimistic_yield(A)
|
||||
|
||||
#if !CORE_MOCK
|
||||
|
||||
// The BearSSL thunks in use for now
|
||||
@ -315,7 +318,7 @@ namespace ESP_Mail
|
||||
// Ensure we yield if we need multiple fragments to avoid WDT
|
||||
if (sent_bytes)
|
||||
{
|
||||
optimistic_yield(1000);
|
||||
Optimistic_yield(1000);
|
||||
}
|
||||
|
||||
// Get BearSSL to a state where we can send
|
||||
@ -519,7 +522,7 @@ namespace ESP_Mail
|
||||
|
||||
for (int no_work = 0; blocking || no_work < 2;)
|
||||
{
|
||||
optimistic_yield(100);
|
||||
Optimistic_yield(100);
|
||||
|
||||
if (loopTimeout)
|
||||
{
|
||||
@ -555,10 +558,10 @@ namespace ESP_Mail
|
||||
|
||||
if (!blocking && len > availForWrite)
|
||||
{
|
||||
/*
|
||||
/*
|
||||
writes on WiFiClient will block if len > availableForWrite()
|
||||
this is needed to prevent available() calls from blocking
|
||||
on dropped connections
|
||||
on dropped connections
|
||||
*/
|
||||
len = availForWrite;
|
||||
}
|
||||
@ -662,7 +665,7 @@ namespace ESP_Mail
|
||||
{
|
||||
_handshake_done = true;
|
||||
}
|
||||
optimistic_yield(1000);
|
||||
Optimistic_yield(1000);
|
||||
}
|
||||
return _handshake_done;
|
||||
}
|
||||
@ -885,7 +888,7 @@ namespace ESP_Mail
|
||||
ctx->match_fingerprint = _use_fingerprint ? _fingerprint : nullptr;
|
||||
ctx->allow_self_signed = _allow_self_signed ? 1 : 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Some constants uses to init the server/client contexts
|
||||
// Note that suites_P needs to be copied to RAM before use w/BearSSL!
|
||||
@ -2047,7 +2050,7 @@ namespace ESP_Mail
|
||||
|
||||
if (!result)
|
||||
{
|
||||
optimistic_yield(100);
|
||||
Optimistic_yield(100);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -2116,4 +2119,4 @@ namespace ESP_Mail
|
||||
|
||||
#endif /* ESP8266 */
|
||||
|
||||
#endif /* ESP_Mail_WCS_CPP */
|
||||
#endif /* ESP_Mail_WCS_CPP */
|
||||
|
@ -772,11 +772,13 @@
|
||||
#define USE_ZIGBEE_AUTOBIND_PRESSURE 1 // hPA
|
||||
#define USE_ZIGBEE_AUTOBIND_ILLUMINANCE 5 // lux
|
||||
#define USE_ZIGBEE_AUTOBIND_HUMIDITY 1.0 // %
|
||||
#define USE_ZIGBEE_AUTOBIND_LIFT 1.0 // %
|
||||
// Below are the Max Thresholds for reporting time (in seconds)
|
||||
#define USE_ZIGBEE_MAXTIME_BATT 4*60*60 // 4h
|
||||
#define USE_ZIGBEE_MAXTIME_TRV 60*10 // 10m
|
||||
#define USE_ZIGBEE_MAXTIME_SENSOR 60*60 // 1h
|
||||
#define USE_ZIGBEE_MAXTIME_LIGHT 60*60 // 1h
|
||||
#define USE_ZIGBEE_MAXTIME_LIFT 4*60*60 // 4h
|
||||
|
||||
// -- Other sensors/drivers -----------------------
|
||||
|
||||
|
@ -1,11 +1,22 @@
|
||||
#ifdef USE_ESP32MAIL
|
||||
|
||||
|
||||
#include <ESP_Mail_Client.h>
|
||||
|
||||
|
||||
#ifdef ESP8266
|
||||
#ifndef SEND_MAIL32_MINRAM
|
||||
#undef SEND_MAIL32_MINRAM
|
||||
#define SEND_MAIL32_MINRAM 13*1024
|
||||
#endif
|
||||
#endif // ESP8266
|
||||
|
||||
#ifdef ESP32
|
||||
#ifndef SEND_MAIL32_MINRAM
|
||||
#undef SEND_MAIL32_MINRAM
|
||||
#define SEND_MAIL32_MINRAM 30*1024
|
||||
#endif
|
||||
#endif // ESP32
|
||||
|
||||
#define xPSTR(a) a
|
||||
#define MAX_ATTCHMENTS 8
|
||||
char *attachments[MAX_ATTCHMENTS];
|
||||
@ -13,6 +24,9 @@ uint8_t num_attachments;
|
||||
void script_send_email_body(void(*func)(char *));
|
||||
String html_content = "";
|
||||
SMTP_Message *email_mptr;
|
||||
SMTPSession *smtp;
|
||||
//SMTPSession smtp;
|
||||
void smtpCallback(SMTP_Status status);
|
||||
|
||||
//#define DEBUG_EMAIL_PORT
|
||||
|
||||
@ -30,17 +44,22 @@ uint16_t SendMail(char *buffer) {
|
||||
uint16_t status = 0;
|
||||
uint16_t blen;
|
||||
char *endcmd;
|
||||
SMTPSession smtp;
|
||||
ESP_Mail_Session session;
|
||||
SMTP_Message message;
|
||||
email_mptr = &message;
|
||||
|
||||
smtp = new SMTPSession();
|
||||
if (!smtp) {
|
||||
return 4;
|
||||
}
|
||||
// return if not enough memory
|
||||
uint32_t mem = ESP.getFreeHeap();
|
||||
//AddLog(LOG_LEVEL_INFO, PSTR("heap: %d"),mem);
|
||||
if (mem < SEND_MAIL32_MINRAM) {
|
||||
// return 4;
|
||||
return 4;
|
||||
}
|
||||
#ifdef DEBUG_EMAIL_PORT
|
||||
AddLog(LOG_LEVEL_INFO, PSTR("heap: %d"),mem);
|
||||
#endif
|
||||
|
||||
while (*buffer==' ') buffer++;
|
||||
|
||||
@ -154,15 +173,14 @@ uint16_t SendMail(char *buffer) {
|
||||
#endif
|
||||
|
||||
|
||||
//smtp.debug(true);
|
||||
smtp.debug(false);
|
||||
//smtp->debug(true);
|
||||
smtp->debug(false);
|
||||
// smtp->callback(smtpCallback);
|
||||
|
||||
message.clearRecipients();
|
||||
message.clearCc();
|
||||
message.clearBcc();
|
||||
|
||||
//smtp.callback(smtpCallback);
|
||||
|
||||
session.server.host_name = mserv;
|
||||
session.server.port = port;
|
||||
session.login.email = user;
|
||||
@ -201,17 +219,18 @@ uint16_t SendMail(char *buffer) {
|
||||
|
||||
/* Connect to server with the session config */
|
||||
delay(0);
|
||||
if (!smtp.connect(&session))
|
||||
if (!smtp->connect(&session))
|
||||
goto exit;
|
||||
|
||||
/* Start sending the Email and close the session */
|
||||
delay(0);
|
||||
|
||||
if (!MailClient.sendMail(&smtp, &message, true)) {
|
||||
Serial.println("Error sending Email, " + smtp.errorReason());
|
||||
if (!MailClient.sendMail(smtp, &message, true)) {
|
||||
Serial.println("Error sending Email, " + smtp->errorReason());
|
||||
}
|
||||
|
||||
exit:
|
||||
if (smtp) delete smtp;
|
||||
for (uint32_t cnt = 0; cnt < MAX_ATTCHMENTS; cnt++) {
|
||||
if (attachments[cnt]) {
|
||||
free(attachments[cnt]);
|
||||
@ -322,4 +341,35 @@ void attach_Data(char *name, uint8_t *buff, uint32_t len) {
|
||||
email_mptr->resetAttachItem(att);
|
||||
}
|
||||
|
||||
/* Callback function to get the Email sending status */
|
||||
void smtpCallback(SMTP_Status status)
|
||||
{
|
||||
/* Print the current status */
|
||||
Serial.println(status.info());
|
||||
|
||||
/* Print the sending result */
|
||||
if (status.success())
|
||||
{
|
||||
Serial.println("----------------");
|
||||
Serial.printf("Message sent success: %d\n", status.completedCount());
|
||||
Serial.printf("Message sent failled: %d\n", status.failedCount());
|
||||
Serial.println("----------------\n");
|
||||
struct tm dt;
|
||||
|
||||
for (size_t i = 0; i < smtp->sendingResult.size(); i++)
|
||||
{
|
||||
/* Get the result item */
|
||||
SMTP_Result result = smtp->sendingResult.getItem(i);
|
||||
localtime_r(&result.timesstamp, &dt);
|
||||
|
||||
Serial.printf("Message No: %d\n", i + 1);
|
||||
Serial.printf("Status: %s\n", result.completed ? "success" : "failed");
|
||||
Serial.printf("Date/Time: %d/%d/%d %d:%d:%d\n", dt.tm_year + 1900, dt.tm_mon + 1, dt.tm_mday, dt.tm_hour, dt.tm_min, dt.tm_sec);
|
||||
Serial.printf("Recipient: %s\n", result.recipients);
|
||||
Serial.printf("Subject: %s\n", result.subject);
|
||||
}
|
||||
Serial.println("----------------\n");
|
||||
}
|
||||
|
||||
}
|
||||
#endif // USE_ESP32MAIL
|
||||
|
@ -2924,7 +2924,7 @@ const char kWebCommands[] PROGMEM = "|" // No prefix
|
||||
#ifdef USE_EMULATION
|
||||
D_CMND_EMULATION "|"
|
||||
#endif
|
||||
#ifdef USE_SENDMAIL
|
||||
#if defined(USE_SENDMAIL) || defined(USE_ESP32MAIL)
|
||||
D_CMND_SENDMAIL "|"
|
||||
#endif
|
||||
D_CMND_WEBSERVER "|" D_CMND_WEBPASSWORD "|" D_CMND_WEBLOG "|" D_CMND_WEBREFRESH "|" D_CMND_WEBSEND "|" D_CMND_WEBCOLOR "|"
|
||||
@ -2934,7 +2934,7 @@ void (* const WebCommand[])(void) PROGMEM = {
|
||||
#ifdef USE_EMULATION
|
||||
&CmndEmulation,
|
||||
#endif
|
||||
#ifdef USE_SENDMAIL
|
||||
#if defined(USE_SENDMAIL) || defined(USE_ESP32MAIL)
|
||||
&CmndSendmail,
|
||||
#endif
|
||||
&CmndWebServer, &CmndWebPassword, &CmndWeblog, &CmndWebRefresh, &CmndWebSend, &CmndWebColor,
|
||||
@ -2966,7 +2966,7 @@ void CmndEmulation(void)
|
||||
}
|
||||
#endif // USE_EMULATION
|
||||
|
||||
#ifdef USE_SENDMAIL
|
||||
#if defined(USE_SENDMAIL) || defined(USE_ESP32MAIL)
|
||||
void CmndSendmail(void)
|
||||
{
|
||||
if (XdrvMailbox.data_len > 0) {
|
||||
|
@ -4325,7 +4325,7 @@ int16_t Run_script_sub(const char *type, int8_t tlen, struct GVARS *gv) {
|
||||
ResponseAppend_P(PSTR("%s"), tmp);
|
||||
goto next_line;
|
||||
}
|
||||
#ifdef USE_SENDMAIL
|
||||
#if defined(USE_SENDMAIL) || defined(USE_ESP32MAIL)
|
||||
else if (!strncmp(lp, "mail", 4)) {
|
||||
lp+=5;
|
||||
char tmp[256];
|
||||
@ -4680,10 +4680,9 @@ int16_t Run_script_sub(const char *type, int8_t tlen, struct GVARS *gv) {
|
||||
|
||||
uint8_t script_xsns_index = 0;
|
||||
|
||||
|
||||
void ScripterEvery100ms(void) {
|
||||
|
||||
if (Settings.rule_enabled && (TasmotaGlobal.uptime > 4)) {
|
||||
if (bitRead(Settings.rule_enabled, 0) && (TasmotaGlobal.uptime > 4)) {
|
||||
ResponseClear();
|
||||
uint16_t script_tele_period_save = TasmotaGlobal.tele_period;
|
||||
TasmotaGlobal.tele_period = 2;
|
||||
@ -4695,7 +4694,7 @@ void ScripterEvery100ms(void) {
|
||||
Run_Scripter(">T", 2, TasmotaGlobal.mqtt_data);
|
||||
}
|
||||
}
|
||||
if (Settings.rule_enabled) {
|
||||
if (bitRead(Settings.rule_enabled, 0)) {
|
||||
if (glob_script_mem.fast_script == 99) Run_Scripter(">F", 2, 0);
|
||||
}
|
||||
}
|
||||
@ -7161,7 +7160,7 @@ nextwebline:
|
||||
#endif //USE_SCRIPT_WEB_DISPLAY
|
||||
|
||||
|
||||
#ifdef USE_SENDMAIL
|
||||
#if defined(USE_SENDMAIL) || defined(USE_ESP32MAIL)
|
||||
|
||||
void script_send_email_body(void(*func)(char *)) {
|
||||
uint8_t msect = Run_Scripter(">m", -2, 0);
|
||||
|
@ -62,7 +62,7 @@ struct TUYA {
|
||||
uint16_t CTMin = 153; // Minimum CT level allowed - When SetOption82 is enabled will default to 200
|
||||
uint16_t CTMax = 500; // Maximum CT level allowed - When SetOption82 is enabled will default to 380
|
||||
bool ModeSet = false; // Controls 0 - Single Tone light, 1 - RGB Light
|
||||
uint16_t Sensors[14]; // Stores the values of Sensors connected to the Tuya Device
|
||||
int16_t Sensors[14]; // Stores the values of Sensors connected to the Tuya Device
|
||||
bool SensorsValid[14]; // Bool used for nullify the sensor value until a real value is received from the MCU
|
||||
bool SuspendTopic = false; // Used to reduce the load at init time or when polling the configuraton on demand
|
||||
uint32_t ignore_topic_timeout = 0; // Suppress the /STAT topic (if enabled) to avoid data overflow until the configuration is over
|
||||
@ -318,7 +318,7 @@ int StrCmpNoCase(char const *Str1, char const *Str2) // Compare case sensistive
|
||||
}
|
||||
}
|
||||
|
||||
float TuyaAdjustedTemperature(uint16_t packetValue, uint8_t res)
|
||||
float TuyaAdjustedTemperature(int16_t packetValue, uint8_t res)
|
||||
{
|
||||
switch (res)
|
||||
{
|
||||
|
@ -901,7 +901,8 @@ enum Z_configuration {
|
||||
CONF_NWKMGR_ADDR = 0x89,
|
||||
CONF_ZDO_DIRECT_CB = 0x8F,
|
||||
CONF_TCLK_TABLE_START = 0x0101,
|
||||
ZNP_HAS_CONFIGURED = 0xF00
|
||||
ZNP_HAS_CONFIGURED = 0xF00,
|
||||
ZNP_HAS_CONFIGURED3 = 0x60, // different attribute address for ZStack 3
|
||||
};
|
||||
|
||||
//
|
||||
|
@ -79,6 +79,7 @@ const uint8_t ZIGBEE_LABEL_START_ROUTER = 13; // Start ZNP as router
|
||||
const uint8_t ZIGBEE_LABEL_INIT_DEVICE = 14; // Init ZNP as end-device
|
||||
const uint8_t ZIGBEE_LABEL_START_DEVICE = 15; // Start ZNP as end-device
|
||||
const uint8_t ZIGBEE_LABEL_START_ROUTER_DEVICE = 16; // Start common to router and device
|
||||
const uint8_t ZIGBEE_LABEL_ZB3_INIT = 17; // check parameters for ZB3
|
||||
const uint8_t ZIGBEE_LABEL_FACT_RESET_ROUTER_DEVICE_POST = 19; // common post configuration for router and device
|
||||
const uint8_t ZIGBEE_LABEL_READY = 20; // goto label 20 for main loop
|
||||
const uint8_t ZIGBEE_LABEL_MAIN_LOOP = 21; // main loop
|
||||
@ -113,6 +114,11 @@ public:
|
||||
bool recv_until = false; // ignore all messages until the received frame fully matches
|
||||
bool eeprom_present = false; // is the ZBBridge EEPROM present?
|
||||
bool eeprom_ready = false; // is the ZBBridge EEPROM formatted and ready?
|
||||
#ifdef USE_ZIGBEE_ZNP
|
||||
bool zb3 = false; // true if ZStack 3.x, false if ZStack 1.2
|
||||
#else
|
||||
bool zb3 = true; // always ZB3 with EZSP
|
||||
#endif // USE_ZIGBEE_ZNP
|
||||
// Zigbee mapping
|
||||
bool mapping_in_progress = false; // is there a mapping in progress
|
||||
bool mapping_ready = false; // do we have mapping information ready
|
||||
@ -131,11 +137,9 @@ public:
|
||||
// Energy scan
|
||||
int8_t energy[USE_ZIGBEE_CHANNEL_COUNT];
|
||||
|
||||
uint32_t permit_end_time = 0; // timestamp when permit join ends, with ZNP 1.2, it takes only 0 (off) and -1 (on)
|
||||
#ifdef USE_ZIGBEE_EZSP
|
||||
uint32_t permit_end_time = 0; // timestamp when permit join ends
|
||||
uint16_t ezsp_version = 0;
|
||||
#elif defined(USE_ZIGBEE_ZNP)
|
||||
bool permit_end_time = false; // in ZNP mode it's only a boolean
|
||||
#endif
|
||||
|
||||
#ifdef USE_ZIGBEE_EZSP
|
||||
|
@ -94,6 +94,7 @@ enum Zigbee_StateMachine_Instruction_Set {
|
||||
#define ZI_STOP(x) { .i = { ZGB_INSTR_STOP, (x), 0x0000} },
|
||||
|
||||
#define ZI_CALL(f, x) { .i = { ZGB_INSTR_CALL, (x), 0x0000} }, { .p = (const void*)(f) },
|
||||
// #define ZI_CALL2(f, x, y) { .i = { ZGB_INSTR_CALL, (x), (y)} }, { .p = (const void*)(f) },
|
||||
#define ZI_LOG(x, m) { .i = { ZGB_INSTR_LOG, (x), 0x0000 } }, { .p = ((const void*)(m)) },
|
||||
#define ZI_MQTT_STATE(x, m) { .i = { ZGB_INSTR_MQTT_STATE, (x), 0x0000 } }, { .p = ((const void*)(m)) },
|
||||
#define ZI_ON_RECV_UNEXPECTED(f) { .i = { ZGB_ON_RECV_UNEXPECTED, 0x00, 0x0000} }, { .p = (const void*)(f) },
|
||||
@ -149,7 +150,7 @@ ZBM(ZBS_VERSION, Z_SREQ | Z_SYS, SYS_VERSION ) // 2102 Z_SYS:versio
|
||||
ZBM(ZBR_VERSION, Z_SRSP | Z_SYS, SYS_VERSION ) // 6102 Z_SYS:version
|
||||
|
||||
// Check if ZNP_HAS_CONFIGURED is set
|
||||
ZBM(ZBS_ZNPHC, Z_SREQ | Z_SYS, SYS_OSAL_NV_READ, ZNP_HAS_CONFIGURED & 0xFF, ZNP_HAS_CONFIGURED >> 8, 0x00 /* offset */ ) // 2108000F00 - 6108000155
|
||||
ZBR(ZBS_ZNPHC, Z_SREQ | Z_SYS, SYS_OSAL_NV_READ, ZNP_HAS_CONFIGURED & 0xFF, ZNP_HAS_CONFIGURED >> 8, 0x00 /* offset */ ) // 2108000F00 - 6108000155
|
||||
ZBM(ZBR_ZNPHC, Z_SRSP | Z_SYS, SYS_OSAL_NV_READ, Z_SUCCESS, 0x01 /* len */, 0x55) // 6108000155
|
||||
// If not set, the response is 61-08-02-00 = Z_SRSP | Z_SYS, SYS_OSAL_NV_READ, Z_INVALIDPARAMETER, 0x00 /* len */
|
||||
|
||||
@ -169,8 +170,16 @@ ZBR(ZBR_CHANN, Z_SRSP | Z_SYS, SYS_OSAL_NV_READ, Z_SUCCESS,
|
||||
Z_B0(USE_ZIGBEE_CHANNEL_MASK), Z_B1(USE_ZIGBEE_CHANNEL_MASK), Z_B2(USE_ZIGBEE_CHANNEL_MASK), Z_B3(USE_ZIGBEE_CHANNEL_MASK),
|
||||
) // 61080004xxxxxxxx
|
||||
|
||||
ZBM(ZBS_PFGK, Z_SREQ | Z_SYS, SYS_OSAL_NV_READ, CONF_PRECFGKEY,0x00, 0x00 ) // 2108620000
|
||||
ZBR(ZBR_PFGK, Z_SRSP | Z_SYS, SYS_OSAL_NV_READ, Z_SUCCESS,
|
||||
ZBM(ZBS_PFGK, Z_SREQ | Z_SAPI, SAPI_READ_CONFIGURATION, CONF_PRECFGKEY ) // 260462
|
||||
ZBR(ZBR_PFGK, Z_SRSP | Z_SAPI, SAPI_READ_CONFIGURATION, Z_SUCCESS, CONF_PRECFGKEY,
|
||||
0x10 /* len */,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* key_l */
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* key_h */
|
||||
/*0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
|
||||
0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0D*/ ) // 660400621001030507090B0D0F00020406080A0C0D
|
||||
|
||||
ZBM(ZBS_PFGK3, Z_SREQ | Z_SYS, SYS_OSAL_NV_READ, CONF_PRECFGKEY,0x00, 0x00 ) // 2108620000
|
||||
ZBR(ZBR_PFGK3, Z_SRSP | Z_SYS, SYS_OSAL_NV_READ, Z_SUCCESS,
|
||||
0x10 /* len */,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* key_l */
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* key_h */
|
||||
@ -238,14 +247,14 @@ ZBM(ZBS_WNV_SECMODE, Z_SREQ | Z_SYS, SYS_OSAL_NV_WRITE, Z_B0(CONF_TCLK_TABLE_STA
|
||||
// Write Z_ZDO Direct CB
|
||||
ZBM(ZBS_W_ZDODCB, Z_SREQ | Z_SYS, SYS_OSAL_NV_WRITE, CONF_ZDO_DIRECT_CB,0x00, 0x00, 0x01 /* len */, 0x01 ) // 21098F00000101
|
||||
// NV Init ZNP Has Configured
|
||||
ZBM(ZBS_WNV_INITZNPHC, Z_SREQ | Z_SYS, SYS_OSAL_NV_ITEM_INIT, ZNP_HAS_CONFIGURED & 0xFF, ZNP_HAS_CONFIGURED >> 8,
|
||||
ZBR(ZBS_WNV_INITZNPHC, Z_SREQ | Z_SYS, SYS_OSAL_NV_ITEM_INIT, ZNP_HAS_CONFIGURED & 0xFF, ZNP_HAS_CONFIGURED >> 8,
|
||||
0x01, 0x00 /* InitLen 16 bits */, 0x01 /* len */, 0x00 ) // 2107000F01000100 - 610709
|
||||
// Init succeeded
|
||||
//ZBM(ZBR_WNV_INIT_OK, Z_SRSP | Z_SYS, SYS_OSAL_NV_ITEM_INIT, Z_CREATED ) // 610709 - NV Write
|
||||
ZBM(ZBR_WNV_INIT_OK, Z_SRSP | Z_SYS, SYS_OSAL_NV_ITEM_INIT ) // 6107xx, Success if 610700 or 610709 - NV Write
|
||||
|
||||
// Write ZNP Has Configured
|
||||
ZBM(ZBS_WNV_ZNPHC, Z_SREQ | Z_SYS, SYS_OSAL_NV_WRITE, Z_B0(ZNP_HAS_CONFIGURED), Z_B1(ZNP_HAS_CONFIGURED),
|
||||
ZBR(ZBS_WNV_ZNPHC, Z_SREQ | Z_SYS, SYS_OSAL_NV_WRITE, Z_B0(ZNP_HAS_CONFIGURED), Z_B1(ZNP_HAS_CONFIGURED),
|
||||
0x00 /* offset */, 0x01 /* len */, 0x55 ) // 2109000F000155 - 610900
|
||||
// Z_ZDO:startupFromApp
|
||||
ZBM(ZBS_STARTUPFROMAPP, Z_SREQ | Z_ZDO, ZDO_STARTUP_FROM_APP, 100, 0 /* delay */) // 25406400
|
||||
@ -333,8 +342,17 @@ void ZNP_UpdateConfig(uint8_t zb_channel, uint16_t zb_pan_id, uint64_t zb_ext_pa
|
||||
0x04 /* len */,
|
||||
Z_B0(zb_channel_mask), Z_B1(zb_channel_mask), Z_B2(zb_channel_mask), Z_B3(zb_channel_mask),
|
||||
) // 61080004xxxxxxxx
|
||||
|
||||
ZBW(ZBR_PFGK, Z_SRSP | Z_SYS, SYS_OSAL_NV_READ, Z_SUCCESS,
|
||||
// Zstack 1.2
|
||||
ZBW(ZBR_PFGK, Z_SRSP | Z_SAPI, SAPI_READ_CONFIGURATION, Z_SUCCESS, CONF_PRECFGKEY,
|
||||
0x10 /* len */,
|
||||
Z_B0(zb_precfgkey_l), Z_B1(zb_precfgkey_l), Z_B2(zb_precfgkey_l), Z_B3(zb_precfgkey_l),
|
||||
Z_B4(zb_precfgkey_l), Z_B5(zb_precfgkey_l), Z_B6(zb_precfgkey_l), Z_B7(zb_precfgkey_l),
|
||||
Z_B0(zb_precfgkey_h), Z_B1(zb_precfgkey_h), Z_B2(zb_precfgkey_h), Z_B3(zb_precfgkey_h),
|
||||
Z_B4(zb_precfgkey_h), Z_B5(zb_precfgkey_h), Z_B6(zb_precfgkey_h), Z_B7(zb_precfgkey_h),
|
||||
/*0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,
|
||||
0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0D*/ ) // 660400621001030507090B0D0F00020406080A0C0D
|
||||
// ZStack 3
|
||||
ZBW(ZBR_PFGK3, Z_SRSP | Z_SYS, SYS_OSAL_NV_READ, Z_SUCCESS,
|
||||
0x10 /* len */,
|
||||
Z_B0(zb_precfgkey_l), Z_B1(zb_precfgkey_l), Z_B2(zb_precfgkey_l), Z_B3(zb_precfgkey_l),
|
||||
Z_B4(zb_precfgkey_l), Z_B5(zb_precfgkey_l), Z_B6(zb_precfgkey_l), Z_B7(zb_precfgkey_l),
|
||||
@ -363,6 +381,17 @@ void ZNP_UpdateConfig(uint8_t zb_channel, uint16_t zb_pan_id, uint64_t zb_ext_pa
|
||||
) // 21096200001001030507090B0D0F00020406080A0C0D
|
||||
}
|
||||
|
||||
// Update configuration for ZStack 3
|
||||
void ZNP_UpdateZStack3(void) {
|
||||
ZBW(ZBS_ZNPHC, Z_SREQ | Z_SYS, SYS_OSAL_NV_READ, ZNP_HAS_CONFIGURED3 & 0xFF, ZNP_HAS_CONFIGURED3 >> 8, 0x00 /* offset */ ) // 2108000F00 - 6108000155
|
||||
|
||||
ZBW(ZBS_WNV_INITZNPHC, Z_SREQ | Z_SYS, SYS_OSAL_NV_ITEM_INIT, ZNP_HAS_CONFIGURED3 & 0xFF, ZNP_HAS_CONFIGURED3 >> 8,
|
||||
0x01, 0x00 /* InitLen 16 bits */, 0x01 /* len */, 0x00 ) // 2107000F01000100 - 610709
|
||||
|
||||
ZBW(ZBS_WNV_ZNPHC, Z_SREQ | Z_SYS, SYS_OSAL_NV_WRITE, Z_B0(ZNP_HAS_CONFIGURED3), Z_B1(ZNP_HAS_CONFIGURED3),
|
||||
0x00 /* offset */, 0x01 /* len */, 0x55 ) // 2109000F000155 - 610900
|
||||
}
|
||||
|
||||
static const Zigbee_Instruction zb_prog[] PROGMEM = {
|
||||
ZI_LABEL(0)
|
||||
ZI_NOOP()
|
||||
@ -402,10 +431,17 @@ static const Zigbee_Instruction zb_prog[] PROGMEM = {
|
||||
ZI_WAIT_RECV(1000, ZBR_EXTPAN)
|
||||
ZI_SEND(ZBS_CHANN) // check CHANNEL
|
||||
ZI_WAIT_RECV(1000, ZBR_CHANN)
|
||||
ZI_SEND(ZBS_PFGK) // check PFGK
|
||||
ZI_WAIT_RECV(1000, ZBR_PFGK)
|
||||
ZI_SEND(ZBS_PFGKEN) // check PFGKEN
|
||||
ZI_WAIT_RECV(1000, ZBR_PFGKEN)
|
||||
|
||||
ZI_CALL(&Z_GotoZB3, ZIGBEE_LABEL_ZB3_INIT)
|
||||
ZI_SEND(ZBS_PFGK) // check PFGK on ZB1.2
|
||||
ZI_WAIT_RECV(1000, ZBR_PFGK)
|
||||
ZI_GOTO(ZIGBEE_LABEL_START_COORD)
|
||||
|
||||
ZI_LABEL(ZIGBEE_LABEL_ZB3_INIT)
|
||||
ZI_SEND(ZBS_PFGK3) // check PFGK on ZB3
|
||||
ZI_WAIT_RECV(1000, ZBR_PFGK3)
|
||||
//ZI_LOG(LOG_LEVEL_INFO, D_LOG_ZIGBEE "zigbee configuration ok")
|
||||
// all is good, we can start
|
||||
|
||||
@ -416,7 +452,7 @@ static const Zigbee_Instruction zb_prog[] PROGMEM = {
|
||||
//ZI_LOG(LOG_LEVEL_INFO, D_LOG_ZIGBEE "starting zigbee coordinator")
|
||||
ZI_SEND(ZBS_STARTUPFROMAPP) // start coordinator
|
||||
ZI_WAIT_RECV(5000, ZBR_STARTUPFROMAPP) // wait for sync ack of command
|
||||
ZI_WAIT_UNTIL_FUNC(10000, AREQ_STARTUPFROMAPP, &ZNP_ReceiveStateChange) // wait for async message that coordinator started
|
||||
ZI_WAIT_UNTIL_FUNC(20000, AREQ_STARTUPFROMAPP, &ZNP_ReceiveStateChange) // wait for async message that coordinator started, max 20s
|
||||
ZI_SEND(ZBS_GETDEVICEINFO) // GetDeviceInfo
|
||||
ZI_WAIT_RECV_FUNC(2000, ZBR_GETDEVICEINFO, &ZNP_ReceiveDeviceInfo)
|
||||
//ZI_WAIT_RECV(2000, ZBR_GETDEVICEINFO) // memorize info
|
||||
@ -1027,6 +1063,7 @@ void ZigbeeStateMachine_Run(void) {
|
||||
if (cur_ptr1) {
|
||||
uint32_t res;
|
||||
res = (*((ZB_Func)cur_ptr1))(cur_d8);
|
||||
// res = (*((ZB_Func)cur_ptr1))(cur_d8, cur_d16);
|
||||
if (res > 0) {
|
||||
ZigbeeGotoLabel(res);
|
||||
continue; // avoid incrementing PC after goto
|
||||
@ -1170,4 +1207,15 @@ int32_t ZigbeeProcessInput(SBuffer &buf) {
|
||||
return 0; // Fix GCC 10.1 warning
|
||||
}
|
||||
|
||||
//
|
||||
// Condiditional GOTO depending on ZB3 or not
|
||||
// Take the branch if ZB3
|
||||
int32_t Z_GotoZB3(uint8_t value) {
|
||||
if (zigbee.zb3) {
|
||||
return value; // take the branch
|
||||
} else {
|
||||
return 0; // continue
|
||||
}
|
||||
}
|
||||
|
||||
#endif // USE_ZIGBEE
|
||||
|
@ -227,15 +227,6 @@ int32_t EZ_PermitJoinRsp(int32_t res, const SBuffer &buf) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
//
|
||||
// Special case: EZSP does not send an event for PermitJoin end, so we generate a synthetic one
|
||||
//
|
||||
void Z_PermitJoinDisable(void) {
|
||||
Response_P(PSTR("{\"" D_JSON_ZIGBEE_STATE "\":{\"Status\":20,\"Message\":\"Pairing mode disabled\"}}"));
|
||||
MqttPublishPrefixTopicRulesProcess_P(RESULT_OR_TELE, PSTR(D_JSON_ZIGBEE_STATE));
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Received MessageSentHandler
|
||||
//
|
||||
@ -254,6 +245,14 @@ int32_t EZ_MessageSent(int32_t res, const SBuffer &buf) {
|
||||
|
||||
#endif // USE_ZIGBEE_EZSP
|
||||
|
||||
//
|
||||
// Special case: EZSP does not send an event for PermitJoin end, so we generate a synthetic one
|
||||
//
|
||||
void Z_PermitJoinDisable(void) {
|
||||
Response_P(PSTR("{\"" D_JSON_ZIGBEE_STATE "\":{\"Status\":20,\"Message\":\"Pairing mode disabled\"}}"));
|
||||
MqttPublishPrefixTopicRulesProcess_P(RESULT_OR_TELE, PSTR(D_JSON_ZIGBEE_STATE));
|
||||
}
|
||||
|
||||
/*********************************************************************************************\
|
||||
* Handle auto-mapping
|
||||
\*********************************************************************************************/
|
||||
@ -427,6 +426,10 @@ int32_t ZNP_Reboot(int32_t res, SBuffer &buf) {
|
||||
MqttPublishPrefixTopicRulesProcess_P(RESULT_OR_TELE, PSTR(D_JSON_ZIGBEE_STATE));
|
||||
|
||||
if ((0x02 == major_rel) && ((0x06 == minor_rel) || (0x07 == minor_rel))) {
|
||||
if (0x07 == minor_rel) {
|
||||
zigbee.zb3 = true; // we run Zigbee 3
|
||||
ZNP_UpdateZStack3(); // update configuration for ZStack 3
|
||||
}
|
||||
return 0; // version 2.6.x and 2.7.x are ok
|
||||
} else {
|
||||
return ZIGBEE_LABEL_UNSUPPORTED_VERSION; // abort
|
||||
@ -546,18 +549,18 @@ int32_t ZNP_ReceivePermitJoinStatus(int32_t res, const SBuffer &buf) {
|
||||
uint8_t status_code;
|
||||
const char* message;
|
||||
|
||||
if (0xFF == duration) {
|
||||
if (!zigbee.zb3 && (0xFF == duration)) {
|
||||
status_code = ZIGBEE_STATUS_PERMITJOIN_OPEN_XX;
|
||||
message = PSTR("Enable Pairing mode until next boot");
|
||||
zigbee.permit_end_time = true; // In ZNP mode, declare permitjoin open
|
||||
zigbee.permit_end_time = -1; // In ZNP mode, declare permitjoin open
|
||||
} else if (duration > 0) {
|
||||
status_code = ZIGBEE_STATUS_PERMITJOIN_OPEN_60;
|
||||
message = PSTR("Enable Pairing mode for %d seconds");
|
||||
zigbee.permit_end_time = true; // In ZNP mode, declare permitjoin open
|
||||
zigbee.permit_end_time = -1; // In ZNP mode, declare permitjoin open
|
||||
} else {
|
||||
status_code = ZIGBEE_STATUS_PERMITJOIN_CLOSE;
|
||||
message = PSTR("Disable Pairing mode");
|
||||
zigbee.permit_end_time = false; // In ZNP mode, declare permitjoin closed
|
||||
zigbee.permit_end_time = 0; // In ZNP mode, declare permitjoin closed
|
||||
}
|
||||
Response_P(PSTR("{\"" D_JSON_ZIGBEE_STATE "\":{"
|
||||
"\"Status\":%d,\"Message\":\""),
|
||||
@ -657,7 +660,7 @@ int32_t Z_ReceiveActiveEp(int32_t res, const SBuffer &buf) {
|
||||
|
||||
// list of clusters that need bindings
|
||||
const uint8_t Z_bindings[] PROGMEM = {
|
||||
Cx0001, Cx0006, Cx0008, Cx0201, Cx0300,
|
||||
Cx0001, Cx0006, Cx0008, Cx0102, Cx0201, Cx0300,
|
||||
Cx0400, Cx0402, Cx0403, Cx0405, Cx0406,
|
||||
Cx0500,
|
||||
};
|
||||
@ -1499,6 +1502,7 @@ const Z_autoAttributeReporting_t Z_autoAttributeReporting[] PROGMEM = {
|
||||
{ 0x0001, 0x0020, 60*60, USE_ZIGBEE_MAXTIME_BATT, USE_ZIGBEE_AUTOBIND_BATTVOLTAGE }, // BatteryVoltage
|
||||
{ 0x0001, 0x0021, 60*60, USE_ZIGBEE_MAXTIME_BATT, USE_ZIGBEE_AUTOBIND_BATTPERCENT }, // BatteryPercentage
|
||||
{ 0x0006, 0x0000, 1, USE_ZIGBEE_MAXTIME_LIGHT, 0 }, // Power
|
||||
{ 0x0102, 0x0008, 1, USE_ZIGBEE_MAXTIME_LIFT, USE_ZIGBEE_AUTOBIND_LIFT }, // CurrentPositionLiftPercentage
|
||||
{ 0x0201, 0x0000, 60, USE_ZIGBEE_MAXTIME_TRV, USE_ZIGBEE_AUTOBIND_TEMPERATURE }, // LocalTemperature
|
||||
{ 0x0201, 0x0008, 60, USE_ZIGBEE_MAXTIME_TRV, USE_ZIGBEE_AUTOBIND_HEATDEMAND }, // PIHeatingDemand
|
||||
{ 0x0201, 0x0012, 60, USE_ZIGBEE_MAXTIME_TRV, USE_ZIGBEE_AUTOBIND_TEMPERATURE }, // OccupiedHeatingSetpoint
|
||||
|
@ -1416,13 +1416,15 @@ void CmndZbPermitJoin(void) {
|
||||
if (payload <= 0) {
|
||||
duration = 0;
|
||||
}
|
||||
|
||||
// ZNP Version
|
||||
#ifdef USE_ZIGBEE_ZNP
|
||||
if (99 == payload) {
|
||||
if (zigbee.zb3) {
|
||||
ResponseCmndChar_P(PSTR("Unlimited time not supported")); return;
|
||||
}
|
||||
duration = 0xFF; // unlimited time
|
||||
}
|
||||
|
||||
// ZNP Version
|
||||
#ifdef USE_ZIGBEE_ZNP
|
||||
SBuffer buf(34);
|
||||
buf.add8(Z_SREQ | Z_ZDO); // 25
|
||||
buf.add8(ZDO_MGMT_PERMIT_JOIN_REQ); // 36
|
||||
@ -1437,10 +1439,6 @@ void CmndZbPermitJoin(void) {
|
||||
|
||||
// EZSP VERSION
|
||||
#ifdef USE_ZIGBEE_EZSP
|
||||
if (99 == payload) {
|
||||
ResponseCmndChar_P(PSTR("Unlimited time not supported")); return;
|
||||
}
|
||||
|
||||
SBuffer buf(3);
|
||||
buf.add16(EZSP_permitJoining);
|
||||
buf.add8(duration);
|
||||
@ -1451,18 +1449,21 @@ void CmndZbPermitJoin(void) {
|
||||
buf.add8(duration);
|
||||
buf.add8(0x01); // TC_Significance - This field shall always have a value of 1, indicating a request to change the Trust Center policy. If a frame is received with a value of 0, it shall be treated as having a value of 1.
|
||||
EZ_SendZDO(0xFFFC, ZDO_Mgmt_Permit_Joining_req, buf.buf(), buf.len());
|
||||
|
||||
// Set Timer after the end of the period, and reset a non-expired previous timer
|
||||
if (duration > 0) {
|
||||
// Log pairing mode enabled
|
||||
Response_P(PSTR("{\"" D_JSON_ZIGBEE_STATE "\":{\"Status\":21,\"Message\":\"Pairing mode enabled\"}}"));
|
||||
MqttPublishPrefixTopicRulesProcess_P(RESULT_OR_TELE, PSTR(D_JSON_ZIGBEE_STATE));
|
||||
zigbee.permit_end_time = millis() + duration * 1000;
|
||||
} else {
|
||||
zigbee.permit_end_time = millis();
|
||||
}
|
||||
#endif // USE_ZIGBEE_EZSP
|
||||
|
||||
// Set Timer after the end of the period, and reset a non-expired previous timer
|
||||
if (zigbee.zb3) {
|
||||
if (duration > 0) {
|
||||
// Log pairing mode enabled
|
||||
Response_P(PSTR("{\"" D_JSON_ZIGBEE_STATE "\":{\"Status\":21,\"Message\":\"Pairing mode enabled\"}}"));
|
||||
MqttPublishPrefixTopicRulesProcess_P(RESULT_OR_TELE, PSTR(D_JSON_ZIGBEE_STATE));
|
||||
zigbee.permit_end_time = millis() + duration * 1000;
|
||||
} else {
|
||||
zigbee.permit_end_time = millis();
|
||||
}
|
||||
if (0 == zigbee.permit_end_time) { zigbee.permit_end_time = 1; } // avoid very rare case where timer collides with timestamp equals to zero
|
||||
}
|
||||
|
||||
ResponseCmndDone();
|
||||
}
|
||||
|
||||
@ -1498,31 +1499,40 @@ void CmndZbEZSPListen(void) {
|
||||
void ZigbeeGlowPermitJoinLight(void) {
|
||||
static const uint16_t cycle_time = 1000; // cycle up and down in 1000 ms
|
||||
static const uint16_t half_cycle_time = cycle_time / 2; // cycle up and down in 1000 ms
|
||||
|
||||
uint16_t led_power = 0; // turn led off
|
||||
if (zigbee.permit_end_time) {
|
||||
uint16_t led_power = 0; // turn led off
|
||||
uint32_t millis_to_go = millis() - zigbee.permit_end_time;
|
||||
uint32_t sub_second = millis_to_go % cycle_time;
|
||||
if (sub_second <= half_cycle_time) {
|
||||
led_power = changeUIntScale(sub_second, 0, half_cycle_time, 0, 1023);
|
||||
} else {
|
||||
led_power = changeUIntScale(sub_second, half_cycle_time, cycle_time, 1023, 0);
|
||||
}
|
||||
led_power = ledGamma10_10(led_power);
|
||||
}
|
||||
|
||||
// change the led state
|
||||
int led_pin = Pin(GPIO_LEDLNK);
|
||||
if (led_pin >= 0) {
|
||||
analogWrite(led_pin, TasmotaGlobal.ledlnk_inverted ? 1023 - led_power : led_power);
|
||||
}
|
||||
}
|
||||
#endif // USE_ZIGBEE_EZSP
|
||||
|
||||
// check if the permitjoin timer has expired
|
||||
void ZigbeePermitJoinUpdate(void) {
|
||||
if (zigbee.zb3 && zigbee.permit_end_time) {
|
||||
// permit join is ongoing
|
||||
if (TimeReached(zigbee.permit_end_time)) {
|
||||
zigbee.permit_end_time = 0; // disable timer
|
||||
Z_PermitJoinDisable();
|
||||
} else {
|
||||
uint32_t millis_to_go = millis() - zigbee.permit_end_time;
|
||||
uint32_t sub_second = millis_to_go % cycle_time;
|
||||
if (sub_second <= half_cycle_time) {
|
||||
led_power = changeUIntScale(sub_second, 0, half_cycle_time, 0, 1023);
|
||||
} else {
|
||||
led_power = changeUIntScale(sub_second, half_cycle_time, cycle_time, 1023, 0);
|
||||
}
|
||||
led_power = ledGamma10_10(led_power);
|
||||
}
|
||||
|
||||
// change the led state
|
||||
int led_pin = Pin(GPIO_LEDLNK);
|
||||
if (led_pin >= 0) {
|
||||
analogWrite(led_pin, TasmotaGlobal.ledlnk_inverted ? 1023 - led_power : led_power);
|
||||
}
|
||||
#ifdef USE_ZIGBEE_EZSP
|
||||
ZigbeeGlowPermitJoinLight(); // update glowing light accordingly
|
||||
#endif // USE_ZIGBEE_EZSP
|
||||
}
|
||||
}
|
||||
#endif // USE_ZIGBEE_EZSP
|
||||
|
||||
//
|
||||
// Command `ZbStatus`
|
||||
@ -2144,9 +2154,7 @@ bool Xdrv23(uint8_t function)
|
||||
if (ZigbeeSerial) {
|
||||
ZigbeeInputLoop();
|
||||
ZigbeeOutputLoop(); // send any outstanding data
|
||||
#ifdef USE_ZIGBEE_EZSP
|
||||
ZigbeeGlowPermitJoinLight();
|
||||
#endif // USE_ZIGBEE_EZSP
|
||||
ZigbeePermitJoinUpdate(); // timer for permit join
|
||||
}
|
||||
if (zigbee.state_machine) {
|
||||
ZigbeeStateMachine_Run();
|
||||
|
@ -28,17 +28,32 @@
|
||||
* Supported commands:
|
||||
* WcStream = Control streaming, 0 = stop, 1 = start
|
||||
* WcResolution = Set resolution
|
||||
* 0 = FRAMESIZE_96x96, (96x96)
|
||||
* 1 = FRAMESIZE_QQVGA2 (128x160)
|
||||
* 2 = FRAMESIZE_QCIF (176x144)
|
||||
* 3 = FRAMESIZE_HQVGA (240x176)
|
||||
* 4 = FRAMESIZE_QVGA (320x240)
|
||||
* 5 = FRAMESIZE_CIF (400x296)
|
||||
* 6 = FRAMESIZE_VGA (640x480)
|
||||
* 7 = FRAMESIZE_SVGA (800x600)
|
||||
* 8 = FRAMESIZE_XGA (1024x768)
|
||||
* 9 = FRAMESIZE_SXGA (1280x1024)
|
||||
* 10 = FRAMESIZE_UXGA (1600x1200)
|
||||
0 = FRAMESIZE_96X96, // 96x96
|
||||
1 = FRAMESIZE_QQVGA, // 160x120
|
||||
2 = FRAMESIZE_QCIF, // 176x144
|
||||
3 = FRAMESIZE_HQVGA, // 240x176
|
||||
4 = FRAMESIZE_240X240, // 240x240
|
||||
5 = FRAMESIZE_QVGA, // 320x240
|
||||
6 = FRAMESIZE_CIF, // 400x296
|
||||
7 = FRAMESIZE_HVGA, // 480x320
|
||||
8 = FRAMESIZE_VGA, // 640x480
|
||||
9 = FRAMESIZE_SVGA, // 800x600
|
||||
10 = FRAMESIZE_XGA, // 1024x768
|
||||
11 = FRAMESIZE_HD, // 1280x720
|
||||
12 = FRAMESIZE_SXGA, // 1280x1024
|
||||
13 = FRAMESIZE_UXGA, // 1600x1200
|
||||
// 3MP Sensors above this no yet supported with this driver
|
||||
14 = FRAMESIZE_FHD, // 1920x1080
|
||||
15 = FRAMESIZE_P_HD, // 720x1280
|
||||
16 = FRAMESIZE_P_3MP, // 864x1536
|
||||
17 = FRAMESIZE_QXGA, // 2048x1536
|
||||
// 5MP Sensors
|
||||
18 = FRAMESIZE_QHD, // 2560x1440
|
||||
19 = FRAMESIZE_WQXGA, // 2560x1600
|
||||
20 = FRAMESIZE_P_FHD, // 1080x1920
|
||||
21 = FRAMESIZE_QSXGA, // 2560x1920
|
||||
22 = FRAMESIZE_INVALID
|
||||
|
||||
* WcMirror = Mirror picture, 0 = no, 1 = yes
|
||||
* WcFlip = Flip picture, 0 = no, 1 = yes
|
||||
* WcSaturation = Set picture Saturation -2 ... +2
|
||||
@ -75,6 +90,7 @@ extern ESP8266WebServer *Webserver;
|
||||
#define BOUNDARY "e8b8c539-047d-4777-a985-fbba6edff11e"
|
||||
|
||||
|
||||
|
||||
// CAMERA_MODEL_AI_THINKER default template pins
|
||||
#define PWDN_GPIO_NUM 32
|
||||
#define RESET_GPIO_NUM -1
|
||||
@ -162,7 +178,7 @@ bool WcPinUsed(void) {
|
||||
}
|
||||
|
||||
uint32_t WcSetup(int32_t fsiz) {
|
||||
if (fsiz > 10) { fsiz = 10; }
|
||||
if (fsiz >= FRAMESIZE_FHD) { fsiz = FRAMESIZE_FHD - 1; }
|
||||
|
||||
Wc.stream_active = 0;
|
||||
|
||||
@ -927,7 +943,7 @@ void WcShowStream(void) {
|
||||
void WcInit(void) {
|
||||
if (!Settings.webcam_config.data) {
|
||||
Settings.webcam_config.stream = 1;
|
||||
Settings.webcam_config.resolution = 5;
|
||||
Settings.webcam_config.resolution = FRAMESIZE_QVGA;
|
||||
Settings.webcam_config.flip = 0;
|
||||
Settings.webcam_config.mirror = 0;
|
||||
Settings.webcam_config.saturation = 0; // -2
|
||||
@ -993,7 +1009,7 @@ void CmndWebcamStream(void) {
|
||||
}
|
||||
|
||||
void CmndWebcamResolution(void) {
|
||||
if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload <= 10)) {
|
||||
if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload < FRAMESIZE_FHD)) {
|
||||
Settings.webcam_config.resolution = XdrvMailbox.payload;
|
||||
WcSetOptions(0, Settings.webcam_config.resolution);
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ uint8_t ili9342_ctouch_counter = 0;
|
||||
|
||||
bool tft_init_done = false;
|
||||
|
||||
|
||||
/*********************************************************************************************/
|
||||
|
||||
void ILI9341_InitDriver()
|
||||
@ -61,6 +62,12 @@ void ILI9341_InitDriver()
|
||||
// disable screen buffer
|
||||
buffer = NULL;
|
||||
|
||||
#ifdef USE_DISPLAY_ILI9341
|
||||
uint8_t dtype = 1;
|
||||
#else
|
||||
uint8_t dtype = 2;
|
||||
#endif // USE_DISPLAY_ILI9341
|
||||
|
||||
// default colors
|
||||
fg_color = ILI9341_WHITE;
|
||||
bg_color = ILI9341_BLACK;
|
||||
@ -73,11 +80,11 @@ void ILI9341_InitDriver()
|
||||
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);
|
||||
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, dtype);
|
||||
}
|
||||
} 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);
|
||||
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, dtype);
|
||||
}
|
||||
}
|
||||
#endif // USE_M5STACK_CORE2
|
||||
|
Loading…
x
Reference in New Issue
Block a user