Merge branch 'development' into pre-release-11.0

This commit is contained in:
Theo Arends 2022-02-07 13:41:39 +01:00
commit 50f0101e59
1578 changed files with 65208 additions and 80352 deletions
.github
.gitpod.DockerfileBUILDS.mdCHANGELOG.mdI2CDEVICES.mdREADME.mdRELEASENOTES.md
boards
include
lib

View File

@ -7,7 +7,7 @@
- [ ] Only relevant files were touched
- [ ] Only one feature/fix was added per PR and the code change compiles without warnings
- [ ] The code change is tested and works with Tasmota core ESP8266 V.2.7.4.9
- [ ] The code change is tested and works with Tasmota core ESP32 V.2.0.1.1
- [ ] The code change is tested and works with Tasmota core ESP32 V.2.0.2.1
- [ ] I accept the [CLA](https://github.com/arendst/Tasmota/blob/development/CONTRIBUTING.md#contributor-license-agreement-cla).
_NOTE: The code change must pass CI tests. **Your PR cannot be merged unless tests pass**_

File diff suppressed because it is too large Load Diff

View File

@ -14,10 +14,12 @@ on:
- '**.properties'
- 'pio-tools/*.py'
- '**.ini'
- '.github/workflows/build_all_the_things.yml'
jobs:
base-images:
runs-on: ubuntu-latest
if: github.repository == 'arendst/Tasmota'
strategy:
matrix:
variant:
@ -46,10 +48,10 @@ jobs:
uses: actions/setup-python@v1
- name: Install dependencies
run: |
python -m pip install --upgrade pip
#python -m pip install --upgrade pip
pip install -U platformio
platformio upgrade --dev
platformio update
#platformio upgrade --dev
#platformio update
- name: Run PlatformIO
run: platformio run -e ${{ matrix.variant }}
- uses: actions/upload-artifact@v2
@ -59,6 +61,7 @@ jobs:
language-images:
runs-on: ubuntu-latest
if: github.repository == 'arendst/Tasmota'
strategy:
matrix:
variant: [ tasmota ]
@ -69,10 +72,10 @@ jobs:
uses: actions/setup-python@v1
- name: Install dependencies
run: |
python -m pip install --upgrade pip
#python -m pip install --upgrade pip
pip install -U platformio
platformio upgrade --dev
platformio update
#platformio upgrade --dev
#platformio update
- name: Run PlatformIO
run: platformio run -e ${{ matrix.variant }}-${{ matrix.language }}
- uses: actions/upload-artifact@v2

2
.gitpod.Dockerfile vendored
View File

@ -2,4 +2,4 @@ FROM gitpod/workspace-full
USER gitpod
RUN pip3 install -U platformio && brew install uncrustify
RUN pip3 install -U platformio

View File

@ -76,6 +76,7 @@ Note: `minimal` variant is not listed as it shouldn't be used outside of the [up
| USE_MCP39F501 | x | x / - | x | x | - | - |
| USE_SDM72 | - | - / x | - | x | - | - |
| USE_SDM120 | - | - / x | - | x | - | - |
| USE_SDM230 | - | - / x | - | - | - | - |
| USE_SDM630 | - | - / x | - | x | - | - |
| USE_DDS2382 | - | - / x | - | x | - | - |
| USE_DDSU666 | - | - / x | - | x | - | - |
@ -100,7 +101,7 @@ Note: `minimal` variant is not listed as it shouldn't be used outside of the [up
| USE_SHT | - | - / x | - | x | - | - |
| USE_HTU | - | - / x | - | x | - | - |
| USE_BMP | - | - / x | - | x | - | - |
| USE_BME680 | - | - / x | - | x | - | - |
| USE_BME68X | - | - / x | - | x | - | - |
| USE_BH1750 | - | - / x | - | x | - | - |
| USE_VEML6070 | - | - / x | - | x | - | - |
| USE_ADS1115 | - | - / x | - | x | - | - |

View File

@ -3,9 +3,137 @@ All notable changes to this project will be documented in this file.
## [Released]
## [11.0.0] 202202178
- Release Olivia
## [10.1.0.8]
### Added
### Changed
- From Calendar Versioning (CalVer) back to Semantic Versioning (SemVer) for better major change indication and future support
### Fixed
## [2022.1.4 = 10.1.0.7] 20220205
### Added
- Rule variables %timer1% to %timer16% (#14619)
### Changed
- Version display from 2022.01.3 to 2022.1.4
### Fixed
- SR04 sensor driver regression from 2022.01.2
## [2022.01.3 = 10.1.0.6] 20220204
### Added
- Command ``WebTime <start_pos>,<end_pos>`` to show part of date and/or time in web gui based on "2017-03-07T11:08:02-07:00"
- ESP32 disable serial console when 3 (ESP32) or 2 (Other models) serial interfaces are requested (#14487)
- Support for BME688 with latest Bosch-Sensor-API library (#14513)
- Command ``SetOption44 1..100`` to set base tolerance percentage for matching incoming IR messages (default 25, max 100) (#14555)
- Command ``Json {<Tasmota commands>}`` to enable input of any command as JSON tokens (#14568)
- Rule variable %color% (#14572)
- Command ``SspmDisplay 1`` to display Sonoff SPM energy data in GUI for relays powered on only
- Command ``SspmEnergyTotal<relay>`` to (p)reset Sonoff SPM total energy without today's energy
- Command ``SspmEnergyYesterday<relay>`` to (p)reset Sonoff SPM energy yesterday
- Command ``SspmHistory<relay>`` to retrieve Sonoff SPM daily energy up to last six month (as defined by ARM firmware)
- Command ``SspmIAmHere<relay>`` to (faintly) blink Sonoff SPM-4Relay module error light of requested relay
- Command ``SspmLog<relay> [x]`` to retrieve Sonoff SPM relay power state change and cause logging
- Command ``SspmOverload<relay> <options>`` to set Sonoff SPM overload criteria for any relay
- Command ``SspmScan`` to rescan Sonoff SPM modbus
- Support for MQ analog sensor for air quality by Francesco Adriani (#14581)
- Command ``SetOption134 1`` to disable PWM auto-phasing for lights by default (new behavior) (#14590)
- Increase PWM channels to 16 (Esp32 only)
- Initial support for ESP32S3 with support for 38 configurable GPIOs
### Changed
- BME68x-Sensor-API library from v3.5.9 to v4.4.7
- ESP32 core library from v2.0.2 to v2.0.2.1 (#14553)
### Fixed
- OneWire-Stickbreaker (DS18x20) library support for ESP32S2 (#14338)
## [2022.01.2 = 10.1.0.5] 20220116
### Added
- Tasmota favicon to webbrowser tab (#14322)
- Commands for ESP32 ethernet configuration ``EthIpAddress``, ``EthGateway``, ``EthSubnetmask``, ``EthDnsServer1`` and ``EthDnsServer2`` (#14385)
- Support for Eastron SDM230 modBus energy meter (#13443)
### Changed
- IRremoteESP8266 library from v2.8.0 to v2.8.1
## [2022.01.1 = 10.1.0.4] 20220107
### Added
- Experimental ADE7953 (Shelly EM) reset on restart (#14261)
- Command ``SspmMap 2,1,..`` to map Sonoff SPM scanned module to physical module (#14281)
- Solax X1 modbus RTS support and offline status (#14305)
- DDP schemes for light and WS2812 (#14017)
- ESP32 single binary firmware (#14239)
- ESP32 support for USE_PWM_DIMMER as GPIO ``Option E1``
- Support for Linkind dimmer as GPIO ``Option A6`` (#14004)
### Changed
- PubSubClient library from v2.8.12 to v2.8.13
- TasmotaSerial library from v3.3.0 to v3.4.0
- TasmotaModbus library from v1.2.0 to v3.4.0
- From Semantic Versioning (SemVer) to Calendar Versioning (CalVer)
- ESP32 Set stack size with ``#define SET_ESP32_STACK_SIZE``, added ``StackLowMark`` metrics
- ESP32 Berry stores compiled bytecode into IRAM, freeing space in heap (#14307)
### Fixed
- Intermittent exceptions and heap corruption due to PubSubClient library buffer overflow (#13700)
- Scripter memory corruption (#14268)
- Edit file for SD card (#14229)
- Solax X1 negative temperature support (#14278)
- Modbus serial config regression from v10.1.0.3
## [10.1.0.3] 20211231
### Added
- Command ``SSerialConfig <serialconfig>`` to change Serial Bridge configuration
### Fixed
- DHT support negative temperatures on different hardware (#14173)
- ESP32 Provide proper OTA_URL for tasmota32solo1 (#14202)
- Hardware serial parity and stop bits support (#14212)
### Changed
- LVGL update from 8.0.2 to 8.1.0
## [10.1.0.2] 20211225
### Changed
- TasmotaSerial library from v3.3.0 to v3.4.0 - reverted (#14153)
- Force initial serial configuration even if no serial GPIO's are enabled (#14153)
- Revert change to fix extra flashwrite before QuickPowerDetection (#14153)
- Increase SerialBridge receive buffer from 130 to 256 characters - reverted (#14153)
- ESP8266Audio library from v1.9.2 to v1.9.5 (#14172)
- ESP8266SAM library from v1.0 to v1.0.1 (#14172)
### Fixed
- Serial broken after #14153 - reverted
## [10.1.0.1] 20211223
### Added
- PWM Dimmer two button support (#13993)
- Device Group Send full status item (#14045)
- Support for MAX7219 Dot Matrix displays (#14091)
- ESP32 support for TuyaMcu
- ESP32 Berry features
### Changed
- Mitsubishi HVAC temperature resolution (#13936)
- Remove restriction of topic must differ from mqttclient (#14019)
### Fixed
- EZOO2 sensor message format (#14000)
- ESP32 Webcam exception during flashwrites
- ESP32 LedPwmMode exception (#14073)
- ESP32 Compile error when I2S_Audio is enabled (#14095)
## [10.1.0] 20211208
- Release Noelle
### Added
- Berry added ``tcpclient``
## [10.0.0.4] 20211208
### Added
- (Internal) Support for FUNC_BUTTON_MULTI_PRESSED in (light)drivers
@ -896,6 +1024,7 @@ All notable changes to this project will be documented in this file.
### Changed
- Triple-mode TLS via configuration in a single firmware (TLS AWS IoT, Letsencrypt and No-TLS)
- Berry C mapping moved to a separate ``berry_mapping`` library
### Fixed
- ESP32 PWM range

View File

@ -1,6 +1,5 @@
# I2C devices
Tasmota supports several I2C devices but to use them they mostly need to be enabled at compile time to solve possible address conflicts.
Tasmota supports several I2C devices. To use them I2C and the device need to be enabled at compile time. I2C and some devices are supported also in the official releases. Devices can be de/-actived on runtime to solve possible address conflicts. (e.g. address 0x27 is used by multiple devices)
Using command ``I2cDriver`` individual drivers can be enabled or disabled at runtime allowing duplicate I2C addresses at compile time. Use the Index from the table below to control I2C drivers like ``I2cDriver10 0`` for disabling BMP support.
@ -41,7 +40,7 @@ Index | Define | Driver | Device | Address(es) | Description
19 | USE_SI1145 | xsns_24 | SI1147 | 0x60 | Ultra violet index and light sensor
20 | USE_LM75AD | xsns_26 | LM75AD | 0x48 - 0x4F | Temperature sensor
21 | USE_APDS9960 | xsns_27 | APDS9960 | 0x39 | Proximity ambient light RGB and gesture sensor
22 | USE_MCP230xx | xsns_29 | MCP23008 | 0x20 - 0x26 | 16-bit I/O expander
22 | USE_MCP230xx | xsns_29 | MCP23008 | 0x20 - 0x26 | 8-bit I/O expander
22 | USE_MCP230xx | xsns_29 | MCP23017 | 0x20 - 0x26 | 16-bit I/O expander
23 | USE_MPR121 | xsns_30 | MPR121 | 0x5A - 0x5D | Proximity capacitive touch sensor
24 | USE_CCS811 | xsns_31 | CCS811 | 0x5A | Gas (TVOC) and air quality sensor
@ -66,6 +65,7 @@ Index | Define | Driver | Device | Address(es) | Description
42 | USE_DS1624 | xsns_59 | DS1624 | 0x48 - 0x4F | Temperature sensor
43 | USE_AHT1x | xsns_63 | AHT10/15 | 0x38 - 0x39 | Temperature and humidity sensor
43 | USE_AHT2x | xsns_63 | AHT20 | 0x38 | Temperature and humidity sensor
43 | USE_AHT2x | xsns_63 | AM2301B | 0x38 | Temperature and humidity sensor
44 | USE_WEMOS_MOTOR_V1 | xdrv_34 | | 0x2D - 0x30 | WEMOS motor shield v1.0.0 (6612FNG)
45 | USE_HDC1080 | xsns_65 | HDC1080 | 0x40 | Temperature and Humidity sensor
46 | USE_IAQ | xsns_66 | IAQ | 0x5a | Air quality sensor
@ -97,4 +97,4 @@ Index | Define | Driver | Device | Address(es) | Description
61 | USE_T67XX | xsns_89 | T67XX | 0x15 | CO2 sensor
62 | USE_SCD40 | xsns_92 | SCD40 | 0x62 | CO2 sensor Sensirion SCD40/SCD41
63 | USE_HM330X | xsns_93 | HM330X | 0x40 | Particule sensor
64 | USE_HDC2010 | xsns_94 | HDC2010 | 0x40 | Temperature and Humidity sensor
64 | USE_HDC2010 | xsns_94 | HDC2010 | 0x40 | Temperature and Humidity sensor

View File

@ -25,9 +25,8 @@ Easy initial installation of Tasmota can be performed using the [Tasmota WebInst
[![Dev Version](https://img.shields.io/badge/development%20version-v10.1.x.x-blue.svg)](https://github.com/arendst/Tasmota)
[![Download Dev](https://img.shields.io/badge/download-development-yellow.svg)](http://ota.tasmota.com/tasmota/)
[![Tasmota CI](https://github.com/arendst/Tasmota/workflows/Tasmota%20CI/badge.svg)](https://github.com/arendst/Tasmota/actions?query=workflow%3A%22Tasmota+CI%22)
[![Tasmota ESP32 CI](https://github.com/arendst/Tasmota/workflows/Tasmota%20ESP32%20CI/badge.svg)](https://github.com/arendst/Tasmota/actions?query=workflow%3A%22Tasmota+ESP32+CI%22)
[![Build_firmware](https://github.com/arendst/Tasmota/workflows/Build_firmware/badge.svg)](https://github.com/arendst/Tasmota/actions?query=workflow%3ABuild_firmware)
[![Tasmota CI](https://github.com/arendst/Tasmota/actions/workflows/build_all_the_things.yml/badge.svg)](https://github.com/arendst/Tasmota/actions/workflows/build_all_the_things.yml)
[![Build_development](https://github.com/arendst/Tasmota/actions/workflows/Tasmota_build_devel.yml/badge.svg)](https://github.com/arendst/Tasmota/actions/workflows/Tasmota_build_devel.yml)
See [CHANGELOG.md](CHANGELOG.md) for detailed change information.

View File

@ -66,7 +66,7 @@ Latest released binaries can be downloaded from
- http://ota.tasmota.com/tasmota/release
Historical binaries can be downloaded from
- http://ota.tasmota.com/tasmota/release-10.1.0
- http://ota.tasmota.com/tasmota/release-11.0.0
The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmota.com/tasmota/release/tasmota.bin.gz``
@ -90,7 +90,7 @@ Latest released binaries can be downloaded from
- http://ota.tasmota.com/tasmota32/release
Historical binaries can be downloaded from
- http://ota.tasmota.com/tasmota32/release-10.1.0
- http://ota.tasmota.com/tasmota32/release-11.0.0
The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmota.com/tasmota32/release/tasmota32.bin``
@ -100,51 +100,72 @@ The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmo
[Complete list](BUILDS.md) of available feature and sensors.
## Changelog v10.1.0 Noelle
## Changelog v11.0.0 Olivia
### Added
- Support for 1 second heartbeat GPIO
- Support for FUNC_BUTTON_MULTI_PRESSED in (light)drivers
- Command ``TcpConfig`` for TCPBridge protocol configuration [#13565](https://github.com/arendst/Tasmota/issues/13565)
- Support for HDC2010 temperature/humidity sensor by Luc Boudreau [#13633](https://github.com/arendst/Tasmota/issues/13633)
- WS2812 scheme 13 stairs effect [#13595](https://github.com/arendst/Tasmota/issues/13595)
- Command ``IfxPeriod `` to overrule ``Teleperiod`` for Influx messages [#13750](https://github.com/arendst/Tasmota/issues/13750)
- Support for GPE Multi color smart light as sold by Action in the Netherlands
- Shutter support for venetian blinds with tilt control
- Support for 74xx595 8-bit shift registers [#13921](https://github.com/arendst/Tasmota/issues/13921)
- ESP32 Autoconfiguration
- ESP32 Preliminary support for Tasmota Apps (.tapp extesions)
- ESP32 OTA over HTTPS
- ESP32 HTTPS support to ``WebQuery``
- ESP32 Berry support for neopixel (WS2812, SK6812)
- ESP32 Berry ``import re`` regex module
- ESP32 Berry add module ``python_compat`` to be closer to Python syntax [#13428](https://github.com/arendst/Tasmota/issues/13428)
- ESP32 Proof of Concept Sonoff SPM with limited functionality (switching and energy monitoring) [#13447](https://github.com/arendst/Tasmota/issues/13447)
- Command ``Json {<Tasmota commands>}`` to enable input of any command as JSON tokens [#14568](https://github.com/arendst/Tasmota/issues/14568)
- Command ``SetOption44 1..100`` to set base tolerance percentage for matching incoming IR messages (default 25, max 100) [#14555](https://github.com/arendst/Tasmota/issues/14555)
- Command ``SetOption134 1`` to disable PWM auto-phasing for lights by default (new behavior) [#14590](https://github.com/arendst/Tasmota/issues/14590)
- Command ``SSerialConfig <serialconfig>`` to change Serial Bridge configuration
- Command ``SspmDisplay 1`` to display Sonoff SPM energy data in GUI for relays powered on only
- Command ``SspmEnergyTotal<relay>`` to (p)reset Sonoff SPM total energy without today's energy
- Command ``SspmEnergyYesterday<relay>`` to (p)reset Sonoff SPM energy yesterday
- Command ``SspmHistory<relay>`` to retrieve Sonoff SPM daily energy up to last six month (as defined by ARM firmware)
- Command ``SspmIAmHere<relay>`` to (faintly) blink Sonoff SPM-4Relay module error light of requested relay
- Command ``SspmLog<relay> [x]`` to retrieve Sonoff SPM relay power state change and cause logging
- Command ``SspmMap 2,1,..`` to map Sonoff SPM scanned module to physical module [#14281](https://github.com/arendst/Tasmota/issues/14281)
- Command ``SspmOverload<relay> <options>`` to set Sonoff SPM overload criteria for any relay
- Command ``SspmScan`` to rescan Sonoff SPM modbus
- Command ``WebTime <start_pos>,<end_pos>`` to show part of date and/or time in web gui based on "2017-03-07T11:08:02-07:00"
- Commands for ESP32 ethernet configuration ``EthIpAddress``, ``EthGateway``, ``EthSubnetmask``, ``EthDnsServer1`` and ``EthDnsServer2`` [#14385](https://github.com/arendst/Tasmota/issues/14385)
- Support for Eastron SDM230 modBus energy meter [#13443](https://github.com/arendst/Tasmota/issues/13443)
- PWM Dimmer two button support [#13993](https://github.com/arendst/Tasmota/issues/13993)
- Support for Linkind dimmer as GPIO ``Option A6`` [#14004](https://github.com/arendst/Tasmota/issues/14004)
- DDP schemes for light and WS2812 [#14017](https://github.com/arendst/Tasmota/issues/14017)
- Device Group Send full status item [#14045](https://github.com/arendst/Tasmota/issues/14045)
- Support for MAX7219 Dot Matrix displays [#14091](https://github.com/arendst/Tasmota/issues/14091)
- Experimental ADE7953 (Shelly EM) reset on restart [#14261](https://github.com/arendst/Tasmota/issues/14261)
- Solax X1 negative temperature support [#14278](https://github.com/arendst/Tasmota/issues/14278)
- Solax X1 modbus RTS support and offline status [#14305](https://github.com/arendst/Tasmota/issues/14305)
- Tasmota favicon to webbrowser tab [#14322](https://github.com/arendst/Tasmota/issues/14322)
- Support for BME688 with latest Bosch-Sensor-API library [#14513](https://github.com/arendst/Tasmota/issues/14513)
- Rule variable %color% [#14572](https://github.com/arendst/Tasmota/issues/14572)
- Rule variables %timer1% to %timer16% [#14619](https://github.com/arendst/Tasmota/issues/14619)
- Support for MQ analog sensor for air quality by Francesco Adriani [#14581](https://github.com/arendst/Tasmota/issues/14581)
- ESP32 single binary firmware [#14239](https://github.com/arendst/Tasmota/issues/14239)
- ESP32 disable serial console when 3 (ESP32) or 2 (Other models) serial interfaces are requested [#14487](https://github.com/arendst/Tasmota/issues/14487)
- ESP32 support for TuyaMcu
- ESP32 Berry features
- ESP32 support for USE_PWM_DIMMER as GPIO ``Option E1``
- ESP32 increase PWM channels to 16
- ESP32 initial support for ESP32S3 with support for 38 configurable GPIOs
### Breaking Changed
- ESP32-S2 TSettings memory usage fixed to 4096 bytes regression from v9.5.0.8
### Changed
- IRremoteESP8266 library from v2.7.20 to v2.8.0
- ESP32 core library from v1.0.7.4 to v2.0.1.1
- ESP32-C3 core library from v2.0.0-post to consolidated ESP32 core library
- ESP32 NimBLE to v.1.3.3
- ESP32 toolchains changed from 8.4.0-2021r1 to 8.4.0-2021r2
- Range conversion edge values
- ESP8266 Gratuitous ARP enabled and set to 60 seconds [#13623](https://github.com/arendst/Tasmota/issues/13623)
- File editor no-wrap [#13427](https://github.com/arendst/Tasmota/issues/13427)
- MQTT TLS dual mode (CA or fingeprint) in same firmware, ``SetOption132 1`` to force fingerprint
- ESP32 Ethernet hostname ending in ``_eth`` to ``-eth`` according to RFC952
- ESP32 core library from v2.0.2 to v2.0.2.1
- PubSubClient library from v2.8.12 to v2.8.13
- TasmotaSerial library from v3.3.0 to v3.4.0
- TasmotaModbus library from v1.2.0 to v3.4.0
- ESP8266Audio library from v1.9.2 to v1.9.5
- ESP8266SAM library from v1.0 to v1.0.1
- BME68x-Sensor-API library from v3.5.9 to v4.4.7
- SR04 driver to support US-100
- Mitsubishi HVAC temperature resolution [#13936](https://github.com/arendst/Tasmota/issues/13936)
- Remove restriction of topic must differ from mqttclient [#14019](https://github.com/arendst/Tasmota/issues/14019)
- ESP32 Set stack size with ``#define SET_ESP32_STACK_SIZE``, added ``StackLowMark`` metrics
- ESP32 Berry stores compiled bytecode into IRAM, freeing space in heap [#14307](https://github.com/arendst/Tasmota/issues/14307)
### Fixed
- Initial reset RTC memory based variables like EnergyToday and EnergyTotal
- SML compile error [#13441](https://github.com/arendst/Tasmota/issues/13441)
- GUI checkbox MQTT TLS not saved regression from v9.2.0.3 [#13442](https://github.com/arendst/Tasmota/issues/13442)
- Discovery of shutters [#13572](https://github.com/arendst/Tasmota/issues/13572)
- Tuya dimmer range issue [#13849](https://github.com/arendst/Tasmota/issues/13849)
- ESP32 Telegram compile error [#13435](https://github.com/arendst/Tasmota/issues/13435)
- ESP32-C3 OneWire as used by DS18x20 [#13583](https://github.com/arendst/Tasmota/issues/13583)
- ESP32 analog NTC temperature calculation [#13703](https://github.com/arendst/Tasmota/issues/13703)
- ESP32 compile error BLE EQ3 driver with core 2.0.x [#13948](https://github.com/arendst/Tasmota/issues/13948)
- Intermittent exceptions and heap corruption due to PubSubClient library buffer overflow [#13700](https://github.com/arendst/Tasmota/issues/13700)
- EZOO2 sensor message format [#14000](https://github.com/arendst/Tasmota/issues/14000)
- DHT support negative temperatures on different hardware [#14173](https://github.com/arendst/Tasmota/issues/14173)
- Hardware serial parity and stop bits support [#14212](https://github.com/arendst/Tasmota/issues/14212)
- Edit file for SD card [#14229](https://github.com/arendst/Tasmota/issues/14229)
- Scripter memory corruption [#14268](https://github.com/arendst/Tasmota/issues/14268)
- ESP32 Webcam exception during flashwrites
- ESP32 LedPwmMode exception [#14073](https://github.com/arendst/Tasmota/issues/14073)
- ESP32 Compile error when I2S_Audio is enabled [#14095](https://github.com/arendst/Tasmota/issues/14095)
- ESP32 Provide proper OTA_URL for tasmota32solo1 [#14202](https://github.com/arendst/Tasmota/issues/14202)
- ESP32 OneWire-Stickbreaker (DS18x20) library support for ESP32C3 and ESP32S2 [#14338](https://github.com/arendst/Tasmota/issues/14338)
### Removed
- ILI9488 driver in favour of Universal Display driver [#13719](https://github.com/arendst/Tasmota/issues/13719)

View File

@ -4,7 +4,7 @@
"ldscript": "esp32_out.ld"
},
"core": "esp32",
"extra_flags": "-DARDUINO_ESP32_DEV -DBOARD_HAS_PSRAM -DHAS_PSRAM_FIX -mfix-esp32-psram-cache-issue -mfix-esp32-psram-cache-strategy=memw",
"extra_flags": "-DARDUINO_ESP32_DEV -DBOARD_HAS_PSRAM -DHAS_PSRAM_FIX -mfix-esp32-psram-cache-issue -mfix-esp32-psram-cache-strategy=memw -DARDUINO_USB_CDC_ON_BOOT=0 -DESP32_4M",
"f_cpu": "240000000L",
"f_flash": "80000000L",
"flash_mode": "dout",
@ -25,7 +25,7 @@
"arduino",
"espidf"
],
"name": "AI Thinker ESP32-CAM, 4M Flash 4MB PSRAM, Tasmota 1856k Code/OTA, 320k SPIFFS",
"name": "AI Thinker ESP32-CAM, 4M Flash 4MB PSRAM, Tasmota 1856k Code/OTA, 320k FS",
"upload": {
"flash_size": "4MB",
"maximum_ram_size": 327680,

View File

@ -4,7 +4,7 @@
"ldscript": "esp32_out.ld"
},
"core": "esp32",
"extra_flags": "-DARDUINO_M5STACK_Core2 -DBOARD_HAS_PSRAM",
"extra_flags": "-DARDUINO_M5STACK_Core2 -DBOARD_HAS_PSRAM -DARDUINO_USB_CDC_ON_BOOT=0 -DESP32_16M",
"f_cpu": "240000000L",
"f_flash": "80000000L",
"flash_mode": "dout",
@ -25,7 +25,7 @@
"arduino",
"espidf"
],
"name": "M5Stack Core2 16M Flash, 4MB PSRAM, Tasmota 2944k Code/OTA, 10M SPIFFS",
"name": "M5Stack Core2 16M Flash, 4MB PSRAM, Tasmota 2944k Code/OTA, 10M FS",
"upload": {
"flash_size": "16MB",
"maximum_ram_size": 327680,

View File

@ -4,7 +4,7 @@
"ldscript": "esp32_out.ld"
},
"core": "esp32",
"extra_flags": "-DARDUINO_ODROID_ESP32 -DBOARD_HAS_PSRAM -DHAS_PSRAM_FIX -mfix-esp32-psram-cache-issue -mfix-esp32-psram-cache-strategy=memw",
"extra_flags": "-DARDUINO_ODROID_ESP32 -DBOARD_HAS_PSRAM -DHAS_PSRAM_FIX -mfix-esp32-psram-cache-issue -mfix-esp32-psram-cache-strategy=memw -DARDUINO_USB_CDC_ON_BOOT=0 -DESP32_16M",
"f_cpu": "240000000L",
"f_flash": "80000000L",
"flash_mode": "dout",
@ -25,7 +25,7 @@
"arduino",
"espidf"
],
"name": "ESP32 ODROID-GO 16M Flash, 4MB PSRAM, Tasmota 2944k Code/OTA, 10M SPIFFS",
"name": "ESP32 ODROID-GO 16M Flash, 4MB PSRAM, Tasmota 2944k Code/OTA, 10M FS",
"upload": {
"flash_size": "16MB",
"maximum_ram_size": 327680,

View File

@ -4,7 +4,7 @@
"ldscript": "esp32_out.ld"
},
"core": "esp32",
"extra_flags": "-DARDUINO_ESP32_DEV -DBOARD_HAS_PSRAM -DESP32_16M",
"extra_flags": "-DARDUINO_ESP32_DEV -DBOARD_HAS_PSRAM -DARDUINO_USB_CDC_ON_BOOT=0 -DESP32_16M",
"f_cpu": "80000000L",
"f_flash": "40000000L",
"flash_mode": "dout",
@ -25,7 +25,7 @@
"arduino",
"espidf"
],
"name": "Espressif Generic ESP32 16M Flash, Tasmota 2944k Code/OTA, 10M SPIFFS",
"name": "Espressif Generic ESP32 16M Flash, Tasmota 2944k Code/OTA, 10M FS",
"upload": {
"flash_size": "16MB",
"maximum_ram_size": 327680,

View File

@ -4,7 +4,7 @@
"ldscript": "esp32_out.ld"
},
"core": "esp32",
"extra_flags": "-DARDUINO_ESP32_DEV -DBOARD_HAS_PSRAM -DESP32_4M",
"extra_flags": "-DARDUINO_ESP32_DEV -DBOARD_HAS_PSRAM -DARDUINO_USB_CDC_ON_BOOT=0 -DESP32_4M",
"f_cpu": "80000000L",
"f_flash": "40000000L",
"flash_mode": "dout",
@ -25,7 +25,7 @@
"arduino",
"espidf"
],
"name": "Espressif Generic ESP32 4M Flash, Tasmota 1856k Code/OTA, 320k SPIFFS",
"name": "Espressif Generic ESP32 4M Flash, Tasmota 1856k Code/OTA, 320k FS",
"upload": {
"flash_size": "4MB",
"maximum_ram_size": 327680,

View File

@ -4,7 +4,7 @@
"ldscript": "esp32_out.ld"
},
"core": "esp32",
"extra_flags": "-DARDUINO_ESP32_DEV -DBOARD_HAS_PSRAM -DESP32_8M",
"extra_flags": "-DARDUINO_ESP32_DEV -DBOARD_HAS_PSRAM -DARDUINO_USB_CDC_ON_BOOT=0 -DESP32_8M",
"f_cpu": "80000000L",
"f_flash": "40000000L",
"flash_mode": "dout",
@ -25,7 +25,7 @@
"arduino",
"espidf"
],
"name": "Espressif Generic ESP32 8M Flash, Tasmota 2944k Code/OTA, 2112k SPIFFS",
"name": "Espressif Generic ESP32 8M Flash, Tasmota 2944k Code/OTA, 2112k FS",
"upload": {
"flash_size": "8MB",
"maximum_ram_size": 327680,

View File

@ -4,7 +4,7 @@
"ldscript": "esp32_out.ld"
},
"core": "esp32",
"extra_flags": "-DARDUINO_ESP32_DEV -DESP32_4M",
"extra_flags": "-DARDUINO_ESP32_DEV -DARDUINO_USB_CDC_ON_BOOT=0 -DESP32_4M -DCORE32SOLO1",
"f_cpu": "80000000L",
"f_flash": "40000000L",
"flash_mode": "dout",
@ -25,7 +25,7 @@
"arduino",
"espidf"
],
"name": "Espressif Generic ESP32 4M Flash, Tasmota 1856k Code/OTA, 320k SPIFFS",
"name": "Espressif Generic ESP32 4M Flash, Tasmota 1856k Code/OTA, 320k FS",
"upload": {
"flash_size": "4MB",
"maximum_ram_size": 327680,

View File

@ -4,6 +4,7 @@
"ldscript": "esp32c3_out.ld"
},
"core": "esp32",
"extra_flags": "-DARDUINO_USB_CDC_ON_BOOT=0 -DESP32_4M -DESP32C3",
"f_cpu": "160000000L",
"f_flash": "80000000L",
"flash_mode": "dout",
@ -21,7 +22,7 @@
"arduino",
"espidf"
],
"name": "Espressif Generic ESP32-C3 4M Flash, Tasmota 1856k Code/OTA, 320k SPIFFS",
"name": "Espressif Generic ESP32-C3 4M Flash, Tasmota 1856k Code/OTA, 320k FS",
"upload": {
"flash_size": "4MB",
"maximum_ram_size": 327680,

View File

@ -4,7 +4,7 @@
"ldscript": "esp32s2_out.ld"
},
"core": "esp32",
"extra_flags": "-DBOARD_HAS_PSRAM",
"extra_flags": "-DBOARD_HAS_PSRAM -DESP32_4M -DESP32S2",
"f_cpu": "240000000L",
"f_flash": "80000000L",
"flash_mode": "dout",
@ -22,7 +22,7 @@
"espidf",
"arduino"
],
"name": "Espressif Generic ESP32-S2 4M Flash, Tasmota 1856k Code/OTA, 320k SPIFFS",
"name": "Espressif Generic ESP32-S2 4M Flash, Tasmota 1856k Code/OTA, 320k FS",
"upload": {
"flash_size": "4MB",
"maximum_ram_size": 327680,

35
boards/esp32s3.json Normal file
View File

@ -0,0 +1,35 @@
{
"build": {
"arduino":{
"ldscript": "esp32s3_out.ld"
},
"core": "esp32",
"extra_flags": "-DBOARD_HAS_PSRAM -DESP32_4M -DESP32S3",
"f_cpu": "240000000L",
"f_flash": "80000000L",
"flash_mode": "dout",
"mcu": "esp32s3",
"variant": "esp32s3",
"partitions": "esp32_partition_app1856k_spiffs320k.csv"
},
"connectivity": [
"wifi"
],
"debug": {
"openocd_target": "esp32s3.cfg"
},
"frameworks": [
"espidf",
"arduino"
],
"name": "Espressif Generic ESP32-S3 4M Flash, Tasmota 1856k Code/OTA, 320k FS",
"upload": {
"flash_size": "4MB",
"maximum_ram_size": 327680,
"maximum_size": 4194304,
"require_upload_port": true,
"speed": 460800
},
"url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/",
"vendor": "Espressif"
}

View File

@ -19,7 +19,7 @@
"esp8266-rtos-sdk",
"esp8266-nonos-sdk"
],
"name": "Espressif Generic ESP8266 Tasmota 1M sketch NO SPIFFS",
"name": "Espressif Generic ESP8266 Tasmota 1M sketch NO FS",
"upload": {
"maximum_ram_size": 81920,
"maximum_size": 995326,

View File

@ -19,7 +19,7 @@
"esp8266-rtos-sdk",
"esp8266-nonos-sdk"
],
"name": "Espressif Generic ESP8266 Tasmota 1M sketch 1M SPIFFS",
"name": "Espressif Generic ESP8266 Tasmota 1M sketch 1M FS",
"upload": {
"maximum_ram_size": 81920,
"maximum_size": 995326,

View File

@ -19,7 +19,7 @@
"esp8266-rtos-sdk",
"esp8266-nonos-sdk"
],
"name": "Espressif Generic ESP8266 Tasmota 1M sketch 772k OTA 256k SPIFFS",
"name": "Espressif Generic ESP8266 Tasmota 1M sketch 772k OTA 256k FS",
"upload": {
"maximum_ram_size": 81920,
"maximum_size": 995326,

View File

@ -19,7 +19,7 @@
"esp8266-rtos-sdk",
"esp8266-nonos-sdk"
],
"name": "Espressif Generic ESP8266 Tasmota 1M sketch 1M OTA 2M SPIFFS",
"name": "Espressif Generic ESP8266 Tasmota 1M sketch 1M OTA 2M FS",
"upload": {
"maximum_ram_size": 81920,
"maximum_size": 995326,

View File

@ -19,7 +19,7 @@
"esp8266-rtos-sdk",
"esp8266-nonos-sdk"
],
"name": "Espressif Generic ESP8266 Tasmota 1M sketch 3M SPIFFS",
"name": "Espressif Generic ESP8266 Tasmota 1M sketch 3M FS",
"upload": {
"maximum_ram_size": 81920,
"maximum_size": 995326,

View File

@ -4,7 +4,7 @@
"ldscript": "eagle.flash.2m256.ld"
},
"core": "esp8266",
"extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_ESP01",
"extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_ESP01 -DESP8266_2M -DESP8266_2M256",
"f_cpu": "160000000L",
"f_flash": "40000000L",
"flash_mode": "dout",
@ -19,7 +19,7 @@
"esp8266-rtos-sdk",
"esp8266-nonos-sdk"
],
"name": "Sonoff ZbBridge Tasmota 1M sketch 772k OTA 256k SPIFFS",
"name": "Sonoff ZbBridge Tasmota 1M sketch 772k OTA 256k FS",
"upload": {
"maximum_ram_size": 81920,
"maximum_size": 995326,

View File

@ -52,6 +52,18 @@
#define HSPI_HOST SPI3_HOST
#define VSPI_HOST SPI3_HOST
#elif CONFIG_IDF_TARGET_ESP32S3
// SPI_HOST (SPI1_HOST) is not supported by the SPI Master and SPI Slave driver on ESP32-S2 and later
#define SPI_HOST SPI1_HOST
#define FSPI_HOST SPI2_HOST
#define HSPI_HOST SPI3_HOST
#define VSPI_HOST SPI3_HOST
#ifndef REG_SPI_BASE
#define REG_SPI_BASE(i) (DR_REG_SPI1_BASE + (((i)>1) ? (((i)* 0x1000) + 0x20000) : (((~(i)) & 1)* 0x1000 )))
// SPI_MOSI_DLEN_REG is not defined anymore in esp32s3, instead use SPI_MS_DLEN_REG
#define SPI_MOSI_DLEN_REG(x) SPI_MS_DLEN_REG(x)
#endif // REG_SPI_BASE
#elif CONFIG_IDF_TARGET_ESP32C3
#define SPI_HOST SPI1_HOST
#define HSPI_HOST SPI2_HOST

View File

@ -0,0 +1,8 @@
# osx
.DS_Store
# doxygen
Doxyfile*
doxygen_sqlite3.db
html
*.tmp

View File

@ -0,0 +1,13 @@
# Contribution Guidlines
This library is the culmination of the expertise of many members of the open source community who have dedicated their time and hard work. The best way to ask for help or propose a new idea is to [create a new issue](https://github.com/adafruit/DHT-sensor-library/issues/new) while creating a Pull Request with your code changes allows you to share your own innovations with the rest of the community.
The following are some guidelines to observe when creating issues or PRs:
- Be friendly; it is important that we can all enjoy a safe space as we are all working on the same project and it is okay for people to have different ideas
- [Use code blocks](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#code); it helps us help you when we can read your code! On that note also refrain from pasting more than 30 lines of code in a post, instead [create a gist](https://gist.github.com/) if you need to share large snippets
- Use reasonable titles; refrain from using overly long or capitalized titles as they are usually annoying and do little to encourage others to help :smile:
- Be detailed; refrain from mentioning code problems without sharing your source code and always give information regarding your board and version of the library

View File

@ -0,0 +1,388 @@
/*!
* @file DHT.cpp
*
* @mainpage DHT series of low cost temperature/humidity sensors.
*
* @section intro_sec Introduction
*
* This is a library for DHT series of low cost temperature/humidity sensors.
*
* You must have Adafruit Unified Sensor Library library installed to use this
* class.
*
* Adafruit invests time and resources providing this open source code,
* please support Adafruit andopen-source hardware by purchasing products
* from Adafruit!
*
* @section author Author
*
* Written by Adafruit Industries.
*
* @section license License
*
* MIT license, all text above must be included in any redistribution
*/
#include "DHT.h"
#define MIN_INTERVAL 2000 /**< min interval value */
#define TIMEOUT \
UINT32_MAX /**< Used programmatically for timeout. \
Not a timeout duration. Type: uint32_t. */
/*!
* @brief Instantiates a new DHT class
* @param pin
* pin number that sensor is connected
* @param type
* type of sensor
* @param count
* number of sensors
*/
DHT::DHT(uint8_t pin, uint8_t type, uint8_t count) {
(void)count; // Workaround to avoid compiler warning.
_pin = pin;
_type = type;
#ifdef __AVR
_bit = digitalPinToBitMask(pin);
_port = digitalPinToPort(pin);
#endif
_maxcycles =
microsecondsToClockCycles(1000); // 1 millisecond timeout for
// reading pulses from DHT sensor.
// Note that count is now ignored as the DHT reading algorithm adjusts itself
// based on the speed of the processor.
}
/*!
* @brief Setup sensor pins and set pull timings
* @param usec
* Optionally pass pull-up time (in microseconds) before DHT reading
*starts. Default is 55 (see function declaration in DHT.h).
*/
void DHT::begin(uint8_t usec) {
// set up the pins!
pinMode(_pin, INPUT_PULLUP);
// Using this value makes sure that millis() - lastreadtime will be
// >= MIN_INTERVAL right away. Note that this assignment wraps around,
// but so will the subtraction.
_lastreadtime = millis() - MIN_INTERVAL;
DEBUG_PRINT("DHT max clock cycles: ");
DEBUG_PRINTLN(_maxcycles, DEC);
pullTime = usec;
}
/*!
* @brief Read temperature
* @param S
* Scale. Boolean value:
* - true = Fahrenheit
* - false = Celcius
* @param force
* true if in force mode
* @return Temperature value in selected scale
*/
float DHT::readTemperature(bool S, bool force) {
float f = NAN;
if (read(force)) {
switch (_type) {
case DHT11:
f = data[2];
if (data[3] & 0x80) {
f = -1 - f;
}
f += (data[3] & 0x0f) * 0.1;
if (S) {
f = convertCtoF(f);
}
break;
case DHT12:
f = data[2];
f += (data[3] & 0x0f) * 0.1;
if (data[2] & 0x80) {
f *= -1;
}
if (S) {
f = convertCtoF(f);
}
break;
case DHT22:
case DHT21:
f = ((word)(data[2] & 0x7F)) << 8 | data[3];
f *= 0.1;
if (data[2] & 0x80) {
f *= -1;
}
if (S) {
f = convertCtoF(f);
}
break;
}
}
return f;
}
/*!
* @brief Converts Celcius to Fahrenheit
* @param c
* value in Celcius
* @return float value in Fahrenheit
*/
float DHT::convertCtoF(float c) { return c * 1.8 + 32; }
/*!
* @brief Converts Fahrenheit to Celcius
* @param f
* value in Fahrenheit
* @return float value in Celcius
*/
float DHT::convertFtoC(float f) { return (f - 32) * 0.55555; }
/*!
* @brief Read Humidity
* @param force
* force read mode
* @return float value - humidity in percent
*/
float DHT::readHumidity(bool force) {
float f = NAN;
if (read(force)) {
switch (_type) {
case DHT11:
case DHT12:
f = data[0] + data[1] * 0.1;
break;
case DHT22:
case DHT21:
f = ((word)data[0]) << 8 | data[1];
f *= 0.1;
break;
}
}
return f;
}
/*!
* @brief Compute Heat Index
* Simplified version that reads temp and humidity from sensor
* @param isFahrenheit
* true if fahrenheit, false if celcius
*(default true)
* @return float heat index
*/
float DHT::computeHeatIndex(bool isFahrenheit) {
float hi = computeHeatIndex(readTemperature(isFahrenheit), readHumidity(),
isFahrenheit);
return hi;
}
/*!
* @brief Compute Heat Index
* Using both Rothfusz and Steadman's equations
* (http://www.wpc.ncep.noaa.gov/html/heatindex_equation.shtml)
* @param temperature
* temperature in selected scale
* @param percentHumidity
* humidity in percent
* @param isFahrenheit
* true if fahrenheit, false if celcius
* @return float heat index
*/
float DHT::computeHeatIndex(float temperature, float percentHumidity,
bool isFahrenheit) {
float hi;
if (!isFahrenheit)
temperature = convertCtoF(temperature);
hi = 0.5 * (temperature + 61.0 + ((temperature - 68.0) * 1.2) +
(percentHumidity * 0.094));
if (hi > 79) {
hi = -42.379 + 2.04901523 * temperature + 10.14333127 * percentHumidity +
-0.22475541 * temperature * percentHumidity +
-0.00683783 * pow(temperature, 2) +
-0.05481717 * pow(percentHumidity, 2) +
0.00122874 * pow(temperature, 2) * percentHumidity +
0.00085282 * temperature * pow(percentHumidity, 2) +
-0.00000199 * pow(temperature, 2) * pow(percentHumidity, 2);
if ((percentHumidity < 13) && (temperature >= 80.0) &&
(temperature <= 112.0))
hi -= ((13.0 - percentHumidity) * 0.25) *
sqrt((17.0 - abs(temperature - 95.0)) * 0.05882);
else if ((percentHumidity > 85.0) && (temperature >= 80.0) &&
(temperature <= 87.0))
hi += ((percentHumidity - 85.0) * 0.1) * ((87.0 - temperature) * 0.2);
}
return isFahrenheit ? hi : convertFtoC(hi);
}
/*!
* @brief Read value from sensor or return last one from less than two
*seconds.
* @param force
* true if using force mode
* @return float value
*/
bool DHT::read(bool force) {
// Check if sensor was read less than two seconds ago and return early
// to use last reading.
uint32_t currenttime = millis();
if (!force && ((currenttime - _lastreadtime) < MIN_INTERVAL)) {
return _lastresult; // return last correct measurement
}
_lastreadtime = currenttime;
// Reset 40 bits of received data to zero.
data[0] = data[1] = data[2] = data[3] = data[4] = 0;
#if defined(ESP8266)
yield(); // Handle WiFi / reset software watchdog
#endif
// Send start signal. See DHT datasheet for full signal diagram:
// http://www.adafruit.com/datasheets/Digital%20humidity%20and%20temperature%20sensor%20AM2302.pdf
// Go into high impedence state to let pull-up raise data line level and
// start the reading process.
pinMode(_pin, INPUT_PULLUP);
delay(1);
// First set data line low for a period according to sensor type
pinMode(_pin, OUTPUT);
digitalWrite(_pin, LOW);
switch (_type) {
case DHT22:
case DHT21:
delayMicroseconds(1100); // data sheet says "at least 1ms"
break;
case DHT11:
default:
delay(20); // data sheet says at least 18ms, 20ms just to be safe
break;
}
uint32_t cycles[80];
{
// End the start signal by setting data line high for 40 microseconds.
pinMode(_pin, INPUT_PULLUP);
// Delay a moment to let sensor pull data line low.
delayMicroseconds(pullTime);
// Now start reading the data line to get the value from the DHT sensor.
// Turn off interrupts temporarily because the next sections
// are timing critical and we don't want any interruptions.
InterruptLock lock;
// First expect a low signal for ~80 microseconds followed by a high signal
// for ~80 microseconds again.
if (expectPulse(LOW) == TIMEOUT) {
DEBUG_PRINTLN(F("DHT timeout waiting for start signal low pulse."));
_lastresult = false;
return _lastresult;
}
if (expectPulse(HIGH) == TIMEOUT) {
DEBUG_PRINTLN(F("DHT timeout waiting for start signal high pulse."));
_lastresult = false;
return _lastresult;
}
// Now read the 40 bits sent by the sensor. Each bit is sent as a 50
// microsecond low pulse followed by a variable length high pulse. If the
// high pulse is ~28 microseconds then it's a 0 and if it's ~70 microseconds
// then it's a 1. We measure the cycle count of the initial 50us low pulse
// and use that to compare to the cycle count of the high pulse to determine
// if the bit is a 0 (high state cycle count < low state cycle count), or a
// 1 (high state cycle count > low state cycle count). Note that for speed
// all the pulses are read into a array and then examined in a later step.
for (int i = 0; i < 80; i += 2) {
cycles[i] = expectPulse(LOW);
cycles[i + 1] = expectPulse(HIGH);
}
} // Timing critical code is now complete.
// Inspect pulses and determine which ones are 0 (high state cycle count < low
// state cycle count), or 1 (high state cycle count > low state cycle count).
for (int i = 0; i < 40; ++i) {
uint32_t lowCycles = cycles[2 * i];
uint32_t highCycles = cycles[2 * i + 1];
if ((lowCycles == TIMEOUT) || (highCycles == TIMEOUT)) {
DEBUG_PRINTLN(F("DHT timeout waiting for pulse."));
_lastresult = false;
return _lastresult;
}
data[i / 8] <<= 1;
// Now compare the low and high cycle times to see if the bit is a 0 or 1.
if (highCycles > lowCycles) {
// High cycles are greater than 50us low cycle count, must be a 1.
data[i / 8] |= 1;
}
// Else high cycles are less than (or equal to, a weird case) the 50us low
// cycle count so this must be a zero. Nothing needs to be changed in the
// stored data.
}
DEBUG_PRINTLN(F("Received from DHT:"));
DEBUG_PRINT(data[0], HEX);
DEBUG_PRINT(F(", "));
DEBUG_PRINT(data[1], HEX);
DEBUG_PRINT(F(", "));
DEBUG_PRINT(data[2], HEX);
DEBUG_PRINT(F(", "));
DEBUG_PRINT(data[3], HEX);
DEBUG_PRINT(F(", "));
DEBUG_PRINT(data[4], HEX);
DEBUG_PRINT(F(" =? "));
DEBUG_PRINTLN((data[0] + data[1] + data[2] + data[3]) & 0xFF, HEX);
// Check we read 40 bits and that the checksum matches.
if (data[4] == ((data[0] + data[1] + data[2] + data[3]) & 0xFF)) {
_lastresult = true;
return _lastresult;
} else {
DEBUG_PRINTLN(F("DHT checksum failure!"));
_lastresult = false;
return _lastresult;
}
}
// Expect the signal line to be at the specified level for a period of time and
// return a count of loop cycles spent at that level (this cycle count can be
// used to compare the relative time of two pulses). If more than a millisecond
// ellapses without the level changing then the call fails with a 0 response.
// This is adapted from Arduino's pulseInLong function (which is only available
// in the very latest IDE versions):
// https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/cores/arduino/wiring_pulse.c
uint32_t DHT::expectPulse(bool level) {
#if (F_CPU > 16000000L)
uint32_t count = 0;
#else
uint16_t count = 0; // To work fast enough on slower AVR boards
#endif
// On AVR platforms use direct GPIO port access as it's much faster and better
// for catching pulses that are 10's of microseconds in length:
#ifdef __AVR
uint8_t portState = level ? _bit : 0;
while ((*portInputRegister(_port) & _bit) == portState) {
if (count++ >= _maxcycles) {
return TIMEOUT; // Exceeded timeout, fail.
}
}
// Otherwise fall back to using digitalRead (this seems to be necessary on
// ESP8266 right now, perhaps bugs in direct port access functions?).
#else
while (digitalRead(_pin) == level) {
if (count++ >= _maxcycles) {
return TIMEOUT; // Exceeded timeout, fail.
}
}
#endif
return count;
}

View File

@ -0,0 +1,109 @@
/*!
* @file DHT.h
*
* This is a library for DHT series of low cost temperature/humidity sensors.
*
* You must have Adafruit Unified Sensor Library library installed to use this
* class.
*
* Adafruit invests time and resources providing this open source code,
* please support Adafruit andopen-source hardware by purchasing products
* from Adafruit!
*
* Written by Adafruit Industries.
*
* MIT license, all text above must be included in any redistribution
*/
#ifndef DHT_H
#define DHT_H
#include "Arduino.h"
/* Uncomment to enable printing out nice debug messages. */
//#define DHT_DEBUG
#define DEBUG_PRINTER \
Serial /**< Define where debug output will be printed. \
*/
/* Setup debug printing macros. */
#ifdef DHT_DEBUG
#define DEBUG_PRINT(...) \
{ DEBUG_PRINTER.print(__VA_ARGS__); }
#define DEBUG_PRINTLN(...) \
{ DEBUG_PRINTER.println(__VA_ARGS__); }
#else
#define DEBUG_PRINT(...) \
{} /**< Debug Print Placeholder if Debug is disabled */
#define DEBUG_PRINTLN(...) \
{} /**< Debug Print Line Placeholder if Debug is disabled */
#endif
/* Define types of sensors. */
static const uint8_t DHT11{11}; /**< DHT TYPE 11 */
static const uint8_t DHT12{12}; /**< DHY TYPE 12 */
static const uint8_t DHT21{21}; /**< DHT TYPE 21 */
static const uint8_t DHT22{22}; /**< DHT TYPE 22 */
static const uint8_t AM2301{21}; /**< AM2301 */
#if defined(TARGET_NAME) && (TARGET_NAME == ARDUINO_NANO33BLE)
#ifndef microsecondsToClockCycles
/*!
* As of 7 Sep 2020 the Arduino Nano 33 BLE boards do not have
* microsecondsToClockCycles defined.
*/
#define microsecondsToClockCycles(a) ((a) * (SystemCoreClock / 1000000L))
#endif
#endif
/*!
* @brief Class that stores state and functions for DHT
*/
class DHT {
public:
DHT(uint8_t pin, uint8_t type, uint8_t count = 6);
void begin(uint8_t usec = 55);
float readTemperature(bool S = false, bool force = false);
float convertCtoF(float);
float convertFtoC(float);
float computeHeatIndex(bool isFahrenheit = true);
float computeHeatIndex(float temperature, float percentHumidity,
bool isFahrenheit = true);
float readHumidity(bool force = false);
bool read(bool force = false);
private:
uint8_t data[5];
uint8_t _pin, _type;
#ifdef __AVR
// Use direct GPIO access on an 8-bit AVR so keep track of the port and
// bitmask for the digital pin connected to the DHT. Other platforms will use
// digitalRead.
uint8_t _bit, _port;
#endif
uint32_t _lastreadtime, _maxcycles;
bool _lastresult;
uint8_t pullTime; // Time (in usec) to pull up data line before reading
uint32_t expectPulse(bool level);
};
/*!
* @brief Class that defines Interrupt Lock Avaiability
*/
class InterruptLock {
public:
InterruptLock() {
#if !defined(ARDUINO_ARCH_NRF52)
noInterrupts();
#endif
}
~InterruptLock() {
#if !defined(ARDUINO_ARCH_NRF52)
interrupts();
#endif
}
};
#endif

View File

@ -0,0 +1,58 @@
# DHT sensor library [![Build Status](https://github.com/adafruit/DHT-sensor-library/workflows/Arduino%20Library%20CI/badge.svg)](https://github.com/adafruit/DHT-sensor-library/actions)
## Description
An Arduino library for the DHT series of low-cost temperature/humidity sensors.
You can find DHT tutorials [here](https://learn.adafruit.com/dht).
# Dependencies
* [Adafruit Unified Sensor Driver](https://github.com/adafruit/Adafruit_Sensor)
# Contributing
Contributions are welcome! Not only youll encourage the development of the library, but youll also learn how to best use the library and probably some C++ too
Please read our [Code of Conduct](https://github.com/adafruit/DHT-sensor-library/blob/master/CODE_OF_CONDUCT.md>)
before contributing to help this project stay welcoming.
## Documentation and doxygen
Documentation is produced by doxygen. Contributions should include documentation for any new code added.
Some examples of how to use doxygen can be found in these guide pages:
https://learn.adafruit.com/the-well-automated-arduino-library/doxygen
https://learn.adafruit.com/the-well-automated-arduino-library/doxygen-tips
Written by Adafruit Industries based on work by:
* T. DiCola
* P. Y. Dragon
* L. Fried
* J. Hoffmann
* M. Kooijman
* J. M. Dana
* S. Conaway
* S. IJskes
* T. Forbes
* B. C
* T. J Myers
* L. Sørup
* per1234
* O. Duffy
* matthiasdanner
* J. Lim
* G. Ambrozio
* chelmi
* adams13x13
* Spacefish
* I. Scheller
* C. Miller
* 7eggert
MIT license, check license.txt for more information
All text above must be included in any redistribution
To install, use the Arduino Library Manager and search for "DHT sensor library" and install the library.

View File

@ -0,0 +1,127 @@
# Adafruit Community Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and leaders pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level or type of
experience, education, socio-economic status, nationality, personal appearance,
race, religion, or sexual identity and orientation.
## Our Standards
We are committed to providing a friendly, safe and welcoming environment for
all.
Examples of behavior that contributes to creating a positive environment
include:
* Be kind and courteous to others
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Collaborating with other community members
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and sexual attention or advances
* The use of inappropriate images, including in a community member's avatar
* The use of inappropriate language, including in a community member's nickname
* Any spamming, flaming, baiting or other attention-stealing behavior
* Excessive or unwelcome helping; answering outside the scope of the question
asked
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate
The goal of the standards and moderation guidelines outlined here is to build
and maintain a respectful community. We ask that you dont just aim to be
"technically unimpeachable", but rather try to be your best self.
We value many things beyond technical expertise, including collaboration and
supporting others within our community. Providing a positive experience for
other community members can have a much more significant impact than simply
providing the correct answer.
## Our Responsibilities
Project leaders are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project leaders have the right and responsibility to remove, edit, or
reject messages, comments, commits, code, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any community member for other behaviors that they deem
inappropriate, threatening, offensive, or harmful.
## Moderation
Instances of behaviors that violate the Adafruit Community Code of Conduct
may be reported by any member of the community. Community members are
encouraged to report these situations, including situations they witness
involving other community members.
You may report in the following ways:
In any situation, you may send an email to <support@adafruit.com>.
On the Adafruit Discord, you may send an open message from any channel
to all Community Helpers by tagging @community helpers. You may also send an
open message from any channel, or a direct message to @kattni#1507,
@tannewt#4653, @Dan Halbert#1614, @cater#2442, @sommersoft#0222, or
@Andon#8175.
Email and direct message reports will be kept confidential.
In situations on Discord where the issue is particularly egregious, possibly
illegal, requires immediate action, or violates the Discord terms of service,
you should also report the message directly to Discord.
These are the steps for upholding our communitys standards of conduct.
1. Any member of the community may report any situation that violates the
Adafruit Community Code of Conduct. All reports will be reviewed and
investigated.
2. If the behavior is an egregious violation, the community member who
committed the violation may be banned immediately, without warning.
3. Otherwise, moderators will first respond to such behavior with a warning.
4. Moderators follow a soft "three strikes" policy - the community member may
be given another chance, if they are receptive to the warning and change their
behavior.
5. If the community member is unreceptive or unreasonable when warned by a
moderator, or the warning goes unheeded, they may be banned for a first or
second offense. Repeated offenses will result in the community member being
banned.
## Scope
This Code of Conduct and the enforcement policies listed above apply to all
Adafruit Community venues. This includes but is not limited to any community
spaces (both public and private), the entire Adafruit Discord server, and
Adafruit GitHub repositories. Examples of Adafruit Community spaces include
but are not limited to meet-ups, audio chats on the Adafruit Discord, or
interaction at a conference.
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. As a community
member, you are representing our community, and are expected to behave
accordingly.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 1.4, available at
<https://www.contributor-covenant.org/version/1/4/code-of-conduct.html>,
and the [Rust Code of Conduct](https://www.rust-lang.org/en-US/conduct.html).
For other projects adopting the Adafruit Community Code of
Conduct, please contact the maintainers of those projects for enforcement.
If you wish to use this code of conduct for your own project, consider
explicitly mentioning your moderation policy or making a copy with your
own moderation policy so as to avoid confusion.

View File

@ -0,0 +1,85 @@
// DHT Temperature & Humidity Sensor
// Unified Sensor Library Example
// Written by Tony DiCola for Adafruit Industries
// Released under an MIT license.
// REQUIRES the following Arduino libraries:
// - DHT Sensor Library: https://github.com/adafruit/DHT-sensor-library
// - Adafruit Unified Sensor Lib: https://github.com/adafruit/Adafruit_Sensor
#include <Adafruit_Sensor.h>
#include <DHT.h>
#include <DHT_U.h>
#define DHTPIN 2 // Digital pin connected to the DHT sensor
// Feather HUZZAH ESP8266 note: use pins 3, 4, 5, 12, 13 or 14 --
// Pin 15 can work but DHT must be disconnected during program upload.
// Uncomment the type of sensor in use:
//#define DHTTYPE DHT11 // DHT 11
#define DHTTYPE DHT22 // DHT 22 (AM2302)
//#define DHTTYPE DHT21 // DHT 21 (AM2301)
// See guide for details on sensor wiring and usage:
// https://learn.adafruit.com/dht/overview
DHT_Unified dht(DHTPIN, DHTTYPE);
uint32_t delayMS;
void setup() {
Serial.begin(9600);
// Initialize device.
dht.begin();
Serial.println(F("DHTxx Unified Sensor Example"));
// Print temperature sensor details.
sensor_t sensor;
dht.temperature().getSensor(&sensor);
Serial.println(F("------------------------------------"));
Serial.println(F("Temperature Sensor"));
Serial.print (F("Sensor Type: ")); Serial.println(sensor.name);
Serial.print (F("Driver Ver: ")); Serial.println(sensor.version);
Serial.print (F("Unique ID: ")); Serial.println(sensor.sensor_id);
Serial.print (F("Max Value: ")); Serial.print(sensor.max_value); Serial.println(F("°C"));
Serial.print (F("Min Value: ")); Serial.print(sensor.min_value); Serial.println(F("°C"));
Serial.print (F("Resolution: ")); Serial.print(sensor.resolution); Serial.println(F("°C"));
Serial.println(F("------------------------------------"));
// Print humidity sensor details.
dht.humidity().getSensor(&sensor);
Serial.println(F("Humidity Sensor"));
Serial.print (F("Sensor Type: ")); Serial.println(sensor.name);
Serial.print (F("Driver Ver: ")); Serial.println(sensor.version);
Serial.print (F("Unique ID: ")); Serial.println(sensor.sensor_id);
Serial.print (F("Max Value: ")); Serial.print(sensor.max_value); Serial.println(F("%"));
Serial.print (F("Min Value: ")); Serial.print(sensor.min_value); Serial.println(F("%"));
Serial.print (F("Resolution: ")); Serial.print(sensor.resolution); Serial.println(F("%"));
Serial.println(F("------------------------------------"));
// Set delay between sensor readings based on sensor details.
delayMS = sensor.min_delay / 1000;
}
void loop() {
// Delay between measurements.
delay(delayMS);
// Get temperature event and print its value.
sensors_event_t event;
dht.temperature().getEvent(&event);
if (isnan(event.temperature)) {
Serial.println(F("Error reading temperature!"));
}
else {
Serial.print(F("Temperature: "));
Serial.print(event.temperature);
Serial.println(F("°C"));
}
// Get humidity event and print its value.
dht.humidity().getEvent(&event);
if (isnan(event.relative_humidity)) {
Serial.println(F("Error reading humidity!"));
}
else {
Serial.print(F("Humidity: "));
Serial.print(event.relative_humidity);
Serial.println(F("%"));
}
}

View File

@ -0,0 +1,74 @@
// Example testing sketch for various DHT humidity/temperature sensors
// Written by ladyada, public domain
// REQUIRES the following Arduino libraries:
// - DHT Sensor Library: https://github.com/adafruit/DHT-sensor-library
// - Adafruit Unified Sensor Lib: https://github.com/adafruit/Adafruit_Sensor
#include "DHT.h"
#define DHTPIN 2 // Digital pin connected to the DHT sensor
// Feather HUZZAH ESP8266 note: use pins 3, 4, 5, 12, 13 or 14 --
// Pin 15 can work but DHT must be disconnected during program upload.
// Uncomment whatever type you're using!
//#define DHTTYPE DHT11 // DHT 11
#define DHTTYPE DHT22 // DHT 22 (AM2302), AM2321
//#define DHTTYPE DHT21 // DHT 21 (AM2301)
// Connect pin 1 (on the left) of the sensor to +5V
// NOTE: If using a board with 3.3V logic like an Arduino Due connect pin 1
// to 3.3V instead of 5V!
// Connect pin 2 of the sensor to whatever your DHTPIN is
// Connect pin 3 (on the right) of the sensor to GROUND (if your sensor has 3 pins)
// Connect pin 4 (on the right) of the sensor to GROUND and leave the pin 3 EMPTY (if your sensor has 4 pins)
// Connect a 10K resistor from pin 2 (data) to pin 1 (power) of the sensor
// Initialize DHT sensor.
// Note that older versions of this library took an optional third parameter to
// tweak the timings for faster processors. This parameter is no longer needed
// as the current DHT reading algorithm adjusts itself to work on faster procs.
DHT dht(DHTPIN, DHTTYPE);
void setup() {
Serial.begin(9600);
Serial.println(F("DHTxx test!"));
dht.begin();
}
void loop() {
// Wait a few seconds between measurements.
delay(2000);
// Reading temperature or humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
float h = dht.readHumidity();
// Read temperature as Celsius (the default)
float t = dht.readTemperature();
// Read temperature as Fahrenheit (isFahrenheit = true)
float f = dht.readTemperature(true);
// Check if any reads failed and exit early (to try again).
if (isnan(h) || isnan(t) || isnan(f)) {
Serial.println(F("Failed to read from DHT sensor!"));
return;
}
// Compute heat index in Fahrenheit (the default)
float hif = dht.computeHeatIndex(f, h);
// Compute heat index in Celsius (isFahreheit = false)
float hic = dht.computeHeatIndex(t, h, false);
Serial.print(F("Humidity: "));
Serial.print(h);
Serial.print(F("% Temperature: "));
Serial.print(t);
Serial.print(F("°C "));
Serial.print(f);
Serial.print(F("°F Heat index: "));
Serial.print(hic);
Serial.print(F("°C "));
Serial.print(hif);
Serial.println(F("°F"));
}

View File

@ -0,0 +1,22 @@
###########################################
# Syntax Coloring Map For DHT-sensor-library
###########################################
###########################################
# Datatypes (KEYWORD1)
###########################################
DHT KEYWORD1
###########################################
# Methods and Functions (KEYWORD2)
###########################################
begin KEYWORD2
readTemperature KEYWORD2
convertCtoF KEYWORD2
convertFtoC KEYWORD2
computeHeatIndex KEYWORD2
readHumidity KEYWORD2
read KEYWORD2

View File

@ -0,0 +1,10 @@
name=DHT sensor library
version=1.4.3
author=Adafruit
maintainer=Adafruit <info@adafruit.com>
sentence=Arduino library for DHT11, DHT22, etc Temp & Humidity Sensors
paragraph=Arduino library for DHT11, DHT22, etc Temp & Humidity Sensors
category=Sensors
url=https://github.com/adafruit/DHT-sensor-library
architectures=*
depends=Adafruit Unified Sensor

View File

@ -0,0 +1,20 @@
Copyright (c) 2020 Adafruit Industries
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -4,8 +4,8 @@
"description": "Simple yet powerful linked-list",
"license": "MIT",
"homepage": "https://github.com/arendst/Tasmota",
"frameworks": "*",
"platforms": "*",
"frameworks": "arduino",
"platforms": "espressif32, espressif8266",
"authors":
{
"name": "Stephan Hadinger",

View File

@ -1,6 +1,6 @@
{
"name": "TasmotaSerial",
"version": "3.3.0",
"version": "3.4.0",
"keywords": [
"serial", "io", "TasmotaSerial"
],

View File

@ -1,5 +1,5 @@
name=TasmotaSerial
version=3.3.0
version=3.4.0
author=Theo Arends
maintainer=Theo Arends <theo@arends.com>
sentence=Implementation of software serial with hardware serial fallback for ESP8266 and ESP32.

View File

@ -40,13 +40,7 @@ TasmotaSerial *tms_obj_list[16];
#include "driver/uart.h"
#if CONFIG_IDF_TARGET_ESP32 // ESP32/PICO-D4
static int tasmota_serial_index = 2; // Allow UART2 and UART1 only
#elif CONFIG_IDF_TARGET_ESP32S2 // ESP32-S2
static int tasmota_serial_index = 1; // Allow UART1 only
#elif CONFIG_IDF_TARGET_ESP32C3 // ESP32-C3
static int tasmota_serial_index = 1; // Allow UART1 only
#endif
static int tasmota_serial_index = SOC_UART_NUM -1; // Available UART
#endif // ESP32
@ -90,7 +84,8 @@ TasmotaSerial::TasmotaSerial(int receive_pin, int transmit_pin, int hardware_fal
}
#endif // ESP8266
#ifdef ESP32
if (transmit_pin > 33) { return; } // GPIO34 - GPIO39 are Input only
if ((receive_pin >= 0) && !GPIO_IS_VALID_GPIO(receive_pin)) { return; }
if ((transmit_pin >= 0) && !GPIO_IS_VALID_OUTPUT_GPIO(transmit_pin)) { return; }
m_hardserial = true;
#endif // ESP32
m_valid = true;
@ -111,7 +106,7 @@ TasmotaSerial::~TasmotaSerial(void) {
#ifdef ESP32
TSerial->end();
tasmota_serial_index++;
tasmota_serial_index++; // This only works if no more uarts are requested otherwise will need a global used_uart log
#endif // ESP32
}
@ -121,21 +116,6 @@ bool TasmotaSerial::isValidGPIOpin(int pin) {
bool TasmotaSerial::begin(uint32_t speed, uint32_t config) {
if (!m_valid) { return false; }
if (config > 2) {
// Legacy support where software serial fakes two stop bits if either stop bits is 2 or parity is not None
m_stop_bits = ((config &0x30) >> 5) +1;
if ((1 == m_stop_bits) && (config &0x03)) {
m_stop_bits++;
}
} else {
m_stop_bits = ((config -1) &1) +1;
#ifdef ESP8266
config = (2 == m_stop_bits) ? (uint32_t)SERIAL_8N2 : (uint32_t)SERIAL_8N1;
#endif // ESP8266
#ifdef ESP32
config = (2 == m_stop_bits) ? SERIAL_8N2 : SERIAL_8N1;
#endif // ESP32
}
if (m_hardserial) {
#ifdef ESP8266
@ -149,10 +129,17 @@ bool TasmotaSerial::begin(uint32_t speed, uint32_t config) {
}
#endif // ESP8266
#ifdef ESP32
if (tasmota_serial_index > 0) { // We only support UART1 and UART2 and keep UART0 for debugging
if (tasmota_serial_index >= 0) { // We prefer UART1 and UART2 and keep UART0 for debugging
m_uart = tasmota_serial_index;
tasmota_serial_index--;
TSerial = new HardwareSerial(m_uart);
if (0 == m_uart) {
Serial.flush();
Serial.end();
delay(10); // Allow time to cleanup queues - if not used hangs ESP32
TSerial = &Serial;
} else {
TSerial = new HardwareSerial(m_uart);
}
if (serial_buffer_size > 256) { // RX Buffer can't be resized when Serial is already running (HardwareSerial.cpp)
TSerial->setRxBufferSize(serial_buffer_size);
}
@ -181,6 +168,18 @@ bool TasmotaSerial::begin(uint32_t speed, uint32_t config) {
// Serial.printf("TSR: Using UART%d\n", m_uart);
#endif // ESP32
} else {
// Software serial fakes two stop bits if either stop bits is 2 or parity is not None
// #define UART_NB_STOP_BIT_0 0B00000000
// #define UART_NB_STOP_BIT_1 0B00010000
// #define UART_NB_STOP_BIT_15 0B00100000
// #define UART_NB_STOP_BIT_2 0B00110000
m_stop_bits = ((config &0x30) >> 5) +1;
// #define UART_PARITY_NONE 0B00000000
// #define UART_PARITY_EVEN 0B00000010
// #define UART_PARITY_ODD 0B00000011
if ((1 == m_stop_bits) && (config &0x03)) {
m_stop_bits++;
}
// Use getCycleCount() loop to get as exact timing as possible
m_bit_time = ESP.getCpuFreqMHz() * 1000000 / speed;
m_bit_start_time = m_bit_time + m_bit_time/3 - (ESP.getCpuFreqMHz() > 120 ? 700 : 500); // pre-compute first wait
@ -195,7 +194,7 @@ bool TasmotaSerial::hardwareSerial(void) {
return m_hardserial;
#endif // ESP8266
#ifdef ESP32
return false; // On ESP32 do not mess with Serial0 buffers
return (0 == m_uart); // We prefer UART1 and UART2 and keep UART0 for debugging
#endif // ESP32
}

View File

@ -439,6 +439,17 @@ boolean PubSubClient::loop() {
if (type == MQTTPUBLISH) {
if (callback) {
uint16_t tl = (this->buffer[llen+1]<<8)+this->buffer[llen+2]; /* topic length in bytes */
// Start Tasmota patch
// Observed heap corruption in some cases since v10.0.0
// Also see https://github.com/knolleary/pubsubclient/pull/843
if (llen+3+tl>this->bufferSize) {
_state = MQTT_DISCONNECTED;
_client->stop();
return false;
}
// End Tasmota patch
memmove(this->buffer+llen+2,this->buffer+llen+3,tl); /* move topic inside buffer 1 byte to front */
this->buffer[llen+2+tl] = 0; /* end the topic as a 'C' string with \x00 */
char *topic = (char*) this->buffer+llen+2;

View File

@ -86,3 +86,27 @@ jobs:
valgrind --leak-check=full --track-origins=yes -v --error-limit=no --show-leak-kinds=all --error-exitcode=999 ./wav
valgrind --leak-check=full --track-origins=yes -v --error-limit=no --show-leak-kinds=all --error-exitcode=999 ./midi
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: arduino/arduino-lint-action@v1
with:
library-manager: 'update'
# Validate orthography
code-spell:
name: Check spelling
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Run codespell
uses: codespell-project/actions-codespell@master
with:
skip: ./src/libmad,./src/libhelix-aac,./src/libopus
ignore_words_list: ESP8266,esp8266,esp,dout,DOUT,ser,ans,inout,numer,hist

View File

@ -31,7 +31,9 @@ JohannesMTC has built a similar project especially for model trains: https://git
A neat MQTT-driven ESP8266 light-and-sound device (alarm? toy? who can say!) was built by @CosmicMac, available at https://github.com/CosmicMac/ESParkle
A very interesting "linear clock" with a stepper motor, NTP time keeping, and configurable recorded chimes with schematics, 3D printer plans, and source code, is now available http://home.kpn.nl/bderogee1980/projects/linear_clock/linear_clock.html
A very interesting "linear clock" with a stepper motor, NTP time keeping, and configurable recorded chimes with schematics, 3D printer plans, and source code, is now available https://janderogee.com/projects/linear_clock/linear_clock.htm
Source and instructions for a gorgeous wooden MP3-playing clock, FM radio and a walkie-talkie using the ESP8266 and AVR microcontrollers is available https://github.com/zduka/mp3-player
## Prerequisites
First, make sure you are running the 2.6.3/later or GIT head version of the Arduino libraries for ESP8266, or the latest ESP32 SDK from Espressif.
@ -100,7 +102,7 @@ AudioFileSourcePROGMEM: Reads a file from a PROGMEM array. Under UNIX you can
AudioFileSourceHTTPStream: Simple implementation of a streaming HTTP reader for ShoutCast-type MP3 streaming. Not yet resilient, and at 44.1khz 128bit stutters due to CPU limitations, but it works more or less.
## AudioFileSourceBuffer - Double buffering, useful for HTTP streams
AudioFileSourceBuffer is an input source that simpy adds an additional RAM buffer of the output of any other AudioFileSource. This is particularly useful for web streaming where you need to have 1-2 packets in memory to ensure hiccup-free playback.
AudioFileSourceBuffer is an input source that simply adds an additional RAM buffer of the output of any other AudioFileSource. This is particularly useful for web streaming where you need to have 1-2 packets in memory to ensure hiccup-free playback.
Create your standard input file source, create the buffer with the original source as its input, and pass this buffer object to the generator.
```cpp
@ -158,7 +160,15 @@ AudioOutputSPIFFSWAV: Writes a binary WAV format with headers to a SPIFFS files
AudioOutputNull: Just dumps samples to /dev/null. Used for speed testing as it doesn't artificially limit the AudioGenerator output speed since there are no buffers to fill/drain.
## I2S DACs
I've used both the Adafruit [I2S +3W amp DAC](https://www.adafruit.com/product/3006) and a generic PCM5102 based DAC with success. The biggest problems I've seen from users involve pinouts from the ESP8266 for GPIO and hooking up all necessary pins on the DAC board.
I've used both the Adafruit [I2S +3W amp DAC](https://www.adafruit.com/product/3006) and a generic PCM5102 based DAC with success. The biggest problems I've seen from users involve pinouts from the ESP8266 for GPIO and hooking up all necessary pins on the DAC board. The essential pins are:
I2S pin | Common label* | ESP8266 pin
--------|---------------|-------------
LRC | D4 | GPIO2
BCLK | D8 | GPIO15
DIN | RX | GPIO3
\* The "common label" column applies to common NodeMCU and D1 Mini development boards. Unfortunately some manufacturers use different mappings so the labels listed here might not apply to your particular model.
### Adafruit I2S DAC
This is quite simple and only needs the GND, VIN, LRC, BCLK< and DIN pins to be wired. Be sure to use +5V on the VIN to get the loudest sound. See the [Adafruit example page](https://learn.adafruit.com/adafruit-max98357-i2s-class-d-mono-amp) for more info.

View File

@ -8,7 +8,7 @@
// Espressif Audio Development Framework at:
// https://docs.espressif.com/projects/esp-adf/en/latest/design-guide/audio-samples.html
//
// On ESP8266 you might need to reencode FLAC files with max '-2' compression level
// On ESP8266 you might need to re-encode FLAC files with max '-2' compression level
// (i.e. 1152 maximum block size) or you will run out of memory. FLAC files will be
// slightly bigger but you don't loose audio quality with reencoding (lossles codec).

View File

@ -25,6 +25,7 @@ void setup()
WiFi.mode(WIFI_OFF);
Serial.begin(115200);
SPIFFS.begin();
Serial.println("Starting up...\n");
audioLogger = &Serial;

View File

@ -44,7 +44,7 @@ void setup() {
// param : float (current time [sec] of the song)
// return : float (the amplitude of sound which varies from -1.f to +1.f)
//
// sound function can be registerd only one or the same number with channels
// sound function can be registered only one or the same number with channels
// if the channels > 1 && the number of function == 1,
// same function are used to generate the sound in every channel
//

View File

@ -0,0 +1,142 @@
#include <Arduino.h>
#ifdef ESP32
#include <WiFi.h>
#else
#include <ESP8266WiFi.h>
#endif
#include "AudioFileSourceICYStream.h"
#include "AudioFileSourceBuffer.h"
#include "AudioGeneratorMP3.h"
//#include "AudioOutputI2SNoDAC.h"
#include "AudioOutputSPDIF.h"
//
// Stream MP3 from HTTP to SPDIF
//
// To run, set your ESP8266 build to 160MHz, update the SSID info, and upload.
// Note:
// If using ESP8266 NodeMCU connect LED to RX pin and GND pin
// Enter your WiFi setup here:
#ifndef STASSID
#define STASSID "your-ssid"
#define STAPSK "your-password"
#endif
const char* ssid = STASSID;
const char* password = STAPSK;
// Examples URLs
//const char *URL="http://kvbstreams.dyndns.org:8000/wkvi-am";
// Italian Rock Radio
const char *URL="http://streamingv2.shoutcast.com/radiofreccia";
// Stream URL of Logitech Media Server, aka LMS, Version: 8.2.0 (August 2021)
// const char *URL="http://192.168.1.121:9000/stream.mp3";
AudioGeneratorMP3 *mp3;
AudioFileSourceICYStream *file;
AudioFileSourceBuffer *buff;
// Output device is SPDIF
AudioOutputSPDIF *out;
// Called when a metadata event occurs (i.e. an ID3 tag, an ICY block, etc.
void MDCallback(void *cbData, const char *type, bool isUnicode, const char *string)
{
const char *ptr = reinterpret_cast<const char *>(cbData);
(void) isUnicode; // Punt this ball for now
// Note that the type and string may be in PROGMEM, so copy them to RAM for printf
char s1[32], s2[64];
strncpy_P(s1, type, sizeof(s1));
s1[sizeof(s1)-1]=0;
strncpy_P(s2, string, sizeof(s2));
s2[sizeof(s2)-1]=0;
Serial.printf("METADATA(%s) '%s' = '%s'\n", ptr, s1, s2);
Serial.flush();
}
// Called when there's a warning or error (like a buffer underflow or decode hiccup)
void StatusCallback(void *cbData, int code, const char *string)
{
const char *ptr = reinterpret_cast<const char *>(cbData);
// Note that the string may be in PROGMEM, so copy it to RAM for printf
char s1[64];
strncpy_P(s1, string, sizeof(s1));
s1[sizeof(s1)-1]=0;
Serial.printf("STATUS(%s) '%d' = '%s'\n", ptr, code, s1);
Serial.flush();
}
void setup()
{
Serial.begin(115200);
delay(1000);
Serial.println("Connecting to WiFi");
WiFi.disconnect();
WiFi.softAPdisconnect(true);
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
// Try forever
while (WiFi.status() != WL_CONNECTED) {
Serial.println("...Connecting to WiFi");
delay(1000);
}
Serial.println("Connected");
audioLogger = &Serial;
file = new AudioFileSourceICYStream(URL);
// Commented out for performance issues with high rate MP3 stream
//file->RegisterMetadataCB(MDCallback, (void*)"ICY");
buff = new AudioFileSourceBuffer(file, 4096); // Doubled form default 2048
// Commented out for performance issues with high rate MP3 stream
//buff->RegisterStatusCB(StatusCallback, (void*)"buffer");
// Set SPDIF output
out = new AudioOutputSPDIF();
mp3 = new AudioGeneratorMP3();
// Commented out for performance issues with high rate MP3 stream
//mp3->RegisterStatusCB(StatusCallback, (void*)"mp3");
mp3->begin(buff, out);
}
void loop()
{
// Commented out
//static int lastms = 0;
if (mp3->isRunning()) {
/* Commented out
if (millis()-lastms > 1000) {
lastms = millis();
Serial.printf("Running for %d ms...\n", lastms);
Serial.flush();
}
*/
if (!mp3->loop()) {
mp3->stop();
}
} else {
Serial.printf("MP3 done\n");
// Restart ESP when streaming is done or errored
delay(10000);
ESP.restart();
}
}

View File

@ -14,7 +14,7 @@
"type": "git",
"url": "https://github.com/earlephilhower/ESP8266Audio"
},
"version": "1.9.2",
"version": "1.9.5",
"homepage": "https://github.com/earlephilhower/ESP8266Audio",
"frameworks": "Arduino",
"examples": [

View File

@ -1,5 +1,5 @@
name=ESP8266Audio
version=1.9.2
version=1.9.5
author=Earle F. Philhower, III
maintainer=Earle F. Philhower, III
sentence=Audio file and I2S sound playing routines for ESP8266, ESP32, and Raspberry Pi Pico RP2040

View File

@ -1,6 +1,6 @@
/*
AudioFileSourceFunction
Audio ouptut generator which can generate WAV file data from function
Audio output generator which can generate WAV file data from function
Copyright (C) 2021 Hideaki Tai

View File

@ -1,6 +1,6 @@
/*
AudioFileSourceFunction
Audio ouptut generator which can generate WAV file data from function
Audio output generator which can generate WAV file data from function
Copyright (C) 2021 Hideaki Tai

View File

@ -20,7 +20,9 @@
#if defined(ESP32) || defined(ESP8266)
#define _GNU_SOURCE
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include "AudioFileSourceICYStream.h"
#include <string.h>
@ -47,6 +49,7 @@ bool AudioFileSourceICYStream::open(const char *url)
http.addHeader("Icy-MetaData", "1");
http.collectHeaders( hdr, 4 );
http.setReuse(true);
http.setFollowRedirects(HTTPC_FORCE_FOLLOW_REDIRECTS);
int code = http.GET();
if (code != HTTP_CODE_OK) {
http.end();

Some files were not shown because too many files have changed in this diff Show More