resolved merge conflict

This commit is contained in:
he.so 2020-02-27 17:22:28 +01:00
commit 3657cda425
21 changed files with 1548 additions and 70 deletions

View File

@ -32,16 +32,18 @@
| ROTARY_V1 | - | - | - | - | - | - | - |
| USE_SONOFF_RF | - | - | x | x | x | - | - |
| USE_RF_FLASH | - | - | x | x | x | - | - |
| USE_SONOFF_SC | - | - | x | - | x | - | - |
| USE_SONOFF_SC | - | - | x | x | x | - | - |
| USE_TUYA_MCU | - | x | x | x | x | - | x |
| USE_ARMTRONIX_DIMMERS | - | - | x | x | - | - | - |
| USE_PS_16_DZ | - | - | x | x | x | - | - |
| USE_SONOFF_IFAN | - | - | x | x | x | - | - |
| USE_BUZZER | - | - | x | x | x | - | - |
| USE_ARILUX_RF | - | - | x | x | x | - | - |
| USE_SHUTTER | - | - | - | - | - | - | - |
| USE_SHUTTER | - | - | x | x | - | - | - |
| USE_DEEPSLEEP | - | - | x | - | x | - | - |
| USE_EXS_DIMMER | - | - | x | x | - | - | - |
| USE_DEVICE_GROUPS | - | - | x | - | - | - | - |
| USE_PWM_DIMMER | - | - | x | x | - | - | - |
| | | | | | | | |
| Feature or Sensor | minimal | lite | tasmota | knx | sensors | ir | display | Remarks
| USE_LIGHT | - | x | x | x | x | x | x |
@ -73,28 +75,28 @@
| | | | | | | | |
| Feature or Sensor | minimal | lite | tasmota | knx | sensors | ir | display | Remarks
| USE_I2C | - | - | x | x | x | - | x |
| USE_SHT | - | - | x | x | x | - | x |
| USE_HTU | - | - | x | x | x | - | x |
| USE_BMP | - | - | x | x | x | - | x |
| USE_SHT | - | - | - | - | x | - | - |
| USE_HTU | - | - | - | - | x | - | - |
| USE_BMP | - | - | - | - | x | - | - |
| USE_BME680 | - | - | - | - | x | - | - |
| USE_BH1750 | - | - | x | x | x | - | x |
| USE_BH1750 | - | - | - | - | x | - | - |
| USE_VEML6070 | - | - | - | - | x | - | - |
| USE_ADS1115 | - | - | - | - | x | - | - |
| USE_ADS1115_I2CDEV | - | - | - | - | - | - | - |
| USE_INA219 | - | - | - | - | x | - | - |
| USE_INA226 | - | - | - | - | - | - | - |
| USE_SHT3X | - | - | x | x | x | - | x |
| USE_SHT3X | - | - | - | - | x | - | - |
| USE_TSL2561 | - | - | - | - | x | - | - |
| USE_TSL2591 | - | - | - | - | - | - | - |
| USE_MGS | - | - | - | - | x | - | - |
| USE_SGP30 | - | - | x | x | x | - | x |
| USE_SGP30 | - | - | - | - | x | - | - |
| USE_SI1145 | - | - | - | - | - | - | - |
| USE_LM75AD | - | - | x | x | x | - | x |
| USE_LM75AD | - | - | - | - | x | - | - |
| USE_APDS9960 | - | - | - | - | - | - | - |
| USE_MCP230xx | - | - | - | - | - | - | - |
| USE_PCA9685 | - | - | - | - | - | - | - |
| USE_MPR121 | - | - | - | - | - | - | - |
| USE_CCS811 | - | - | - | - | - | - | - |
| USE_CCS811 | - | - | - | - | x | - | - |
| USE_MPU6050 | - | - | - | - | - | - | - |
| USE_DS3231 | - | - | - | - | - | - | - |
| USE_MGC3130 | - | - | - | - | - | - | - |
@ -115,10 +117,10 @@
| | | | | | | | |
| Feature or Sensor | minimal | lite | tasmota | knx | sensors | ir | display | Remarks
| USE_SPI | - | - | - | - | - | - | x |
| USE_MHZ19 | - | - | x | x | x | - | x |
| USE_SENSEAIR | - | - | x | x | x | - | x |
| USE_PMS5003 | - | - | x | x | x | - | x |
| USE_NOVA_SDS | - | - | x | x | x | - | x |
| USE_MHZ19 | - | - | - | - | x | - | - |
| USE_SENSEAIR | - | - | - | - | x | - | - |
| USE_PMS5003 | - | - | - | - | x | - | - |
| USE_NOVA_SDS | - | - | - | - | x | - | - |
| USE_HPMA | - | - | - | - | x | - | - |
| USE_SERIAL_BRIDGE | - | - | x | x | x | - | x |
| USE_MP3_PLAYER | - | - | - | - | x | - | - |
@ -137,9 +139,9 @@
| USE_IR_RECEIVE | - | - | x | x | x | x | x |
| USE_IR_REMOTE_FULL | - | - | - | - | - | x | - | Enable ALL protocols
| | | | | | | | |
| USE_SR04 | - | - | x | x | x | - | x |
| USE_SR04 | - | - | - | - | x | - | - |
| USE_TM1638 | - | - | - | - | x | - | - |
| USE_HX711 | - | - | x | x | x | - | x |
| USE_HX711 | - | - | - | - | x | - | - |
| USE_TX20_WIND_SENSOR | - | - | - | - | x | - | - |
| USE_RC_SWITCH | - | - | - | - | x | - | - |
| USE_RF_SENSOR | - | - | - | - | x | - | - | AlectoV2 only

View File

@ -76,5 +76,6 @@ Module | Description
70 Sonoff L1 | Sonoff L1 light strip
71 Sonoff iFan03 | Sonoff iFan03 Wifi Smart Ceiling Fan with Light
72 EXS Dimmer | EXS Wifi Dimmer v4
73 PWM Dimmer | Martin Jerry/acenx/Tessan/NTONPOWER SD0x PWM Dimmer Switches
Over 600 additional devices are supported using [templates](TEMPLATES.md).

229
PWM_Dimmer.md Normal file
View File

@ -0,0 +1,229 @@
# PWM Dimmer
The PWM Dimmer module adds support for Martin Jerry/acenx/Tessan/NTONPOWER SD0x PWM dimmer switches. The brightness of the load for these dimmers is controlled by a PWM GPIO pin. They typically have power, up and down buttons, a powered-on LED, five brightness LEDs and another status LED. Examples are:[ https://www.amazon.com/dp/B07FXYSVR1](https://www.amazon.com/dp/B07FXYSVR1),[ https://www.amazon.com/dp/B07V26Q3VD](https://www.amazon.com/dp/B07V26Q3VD),[ https://www.amazon.com/dp/B07K67D43J](https://www.amazon.com/dp/B07K67D43J),[ https://www.amazon.com/dp/B07TTGFWFM](https://www.amazon.com/dp/B07TTGFWFM)
To include PWM dimmer support in the build, define USE_PWM_DIMMER in your user_config_override. This adds 4.5K to the code size. The light module is not required for PWM dimmer operation so you can #undef USE_LIGHT to reduce the firmware bin size.
To enable PWM dimmer operation, select the PWM Dimmer module.
## PWM Dimmer Operation
Pressing and releasing the power button toggles the power on/off. If the toggle turns the power on, the load is returned to the last brightness it was adjusted to. If Fade is enabled, the load is faded on/off at the rate defined by the Speed setting.
When the power is on, holding the down or up button decreases/increases the brightness (PWM value). The brightness is changed faster at higher brightnesses. The BriMin command defines the lowest value the brightness can be decreased to.
The brightness can also be changed using just the power button. When the power is on, holding the power button alternately increases or decreases the brightness. Initially, holding the power button increases the brightness. Releasing and then holding the power button again decreases the brightness.
When the power is off, holding the down or up button turns the power on at a temporary brightness of the low/high levels set by the BriPreset command (default =10,255). Turning the power on at the low preset can also be accomplished by holding the power button while the power is off. The brightness presets are intended to enable quickly turning on a light to a dim or bright level without changing the normal desired brightness. Turning the power on to a preset does not change the brightness the load will be set to when the switch is turned on the next time. For example, if the light is on and you adjust the brightness to 80 and then turn the light off, when you turn it back on, the brightness will return to 80. If you turn the power off again and then press the down button, the light will be turned on with a brightness of the low preset. If you then turn the light off and on again, the brightness will return to 80.
If there are LEDs defined in the template, they are turned on to indicate the current brightness. More LEDs are turned on at higher brightnesses. The LedTimeout command enables/disables an LED timeout. If LED timeout is enabled, the LEDs turn off five seconds after the last change in brightness. Note that the lowest LED and the blue power LED are always on when the power is on.
The LEDLink LED can be used as a nightlight/powered-off indicator. The PoweredOffLed command enables/disables turning the LEDLink LED on when the power is off.
Tapping (pressing and releasing quickly) the down or up buttons a given number of times and then holding the down or up button decreases or increases settings according to the table below. For example, tapping the down button once and then holding the up button sets all RGB lights in the device group to the next fixed color. Tapping the up button three times and then holding the down button decreases the high brightness preset.
<table>
<tr>
<td>Taps
</td>
<td>Down Button
</td>
<td>Up Button
</td>
</tr>
<tr>
<td>1
</td>
<td>Set fixed color<sup>1</sup>
</td>
<td>Publish MQTT event<sup>2</sup>
</td>
</tr>
<tr>
<td>2
</td>
<td>Adjust minimum brightness
</td>
<td>Adjust fade speed
</td>
</tr>
<tr>
<td>3
</td>
<td>Adjust low brightness preset
</td>
<td>Adjust high brightness preset
</td>
</tr>
</table>
1. Setting the previous/next color only functions when remote device mode is enabled (see below) and only when the switch is in a device group with an RGB light. The color sequence as defined by the Light module is red, green, blue, orange, light green, light blue, amber, cyan, purple, yellow, pink, white using RGB channels, white using CT channels.
2. The MQTT topic has the format %group-topic%/cmnd/Event, where %group-topic% is the group topic set by the GroupTopic command. The MQTT payload is SwitchTrigger#, where # is 1 if the down button is held or 2 if the up button is held. These triggers can be used in rules on remote devices (ON Event#SwitchTrigger1) or by automation software to trigger automations such as scene changes. For example, the Event topic SwitchTrigger1 payload could trigger the automation software to turn on the previous scene in a list and the SwitchTrigger2 payload could trigger the automation software to turn on the next scene in a list.
Holding the power button, pressing the down/up buttons a given number of times and then releasing the power button toggles options according to the table below. Note that you must press a down or up button within 0.5 seconds to prevent the power button hold action from taking place.
<table>
<tr>
<td>Presses
</td>
<td>Down Button
</td>
<td>Up Button
</td>
</tr>
<tr>
<td>1
</td>
<td>Toggle powered-off LED
</td>
<td>Toggle brightness LED timeout
</td>
</tr>
<tr>
<td>2
</td>
<td>Toggle fading
</td>
<td>
</td>
</tr>
</table>
Holding any button for over 10 seconds executes the WiFiConfig 2 command.
Pressing and releasing a button publishes an MQTT TOGGLE command. Holding a button publishes an MQTT HOLD command followed by an MQTT OFF command when the button is released.
When Device Groups are enabled, the PWM Dimmer minimum brightness, brightness presets, fade and speed settings are kept in sync across all switches in the group. The powered-off LED and LED timeout settings are specific to each switch. Changing them does not replicate the change to the other switches in the group.
### Commands
<table>
<tr>
<td><strong>Command</strong>
</td>
<td><strong>Parameters</strong>
</td>
</tr>
<tr>
<td>BriMin
</td>
<td>1..255 = set minimum brightness
<p>
+ = increase minimum brightness
<p>
- = decrease minimum brightness
</td>
</tr>
<tr>
<td>BriPreset
</td>
<td> &lt;low>,&lt;high> = set brightness low and high presets
<p>
1..255 = set brightness preset
<p>
+ = increase brightness preset
<p>
- = decrease brightness preset
</td>
</tr>
<tr>
<td>Dimmer
</td>
<td>0..100 = set dimmer value from 0 to 100%
<p>
+ = increase by 10
<p>
- = decrease by 10
</td>
</tr>
<tr>
<td>Fade
</td>
<td>0 = do not use fade <em>(default)</em>
<p>
1 = use fade
</td>
</tr>
<tr>
<td>LedTimeout
</td>
<td>0 = disable LED timeout
<p>
1 = enable LED timeout
</td>
</tr>
<tr>
<td>PoweredOffLed
</td>
<td>0 = disable powered-off LED
<p>
1 = disable powered-off LED
</td>
</tr>
<tr>
<td>Speed
</td>
<td>1..20 = set fade speed from fast 1 to very slow 20
<p>
+ = increase speed
<p>
- = decrease speed
</td>
</tr>
<tr>
<td>SetOption86
</td>
<td>Set brightness LED timeout
<p>
0 = disable timeout (default)
<p>
1 = enable timeout
</td>
</tr>
<tr>
<td>SetOption87
</td>
<td>Set powered-off LED (nightlight)
<p>
0 = disable powered-off LED (default)
<p>
1 = enable powered-off LED
</td>
</tr>
<tr>
<td>SetOption88
</td>
<td>Set remote device mode
<p>
0 = disable remote device mode(default)
<p>
1 = enable remote device mode
</td>
</tr>
</table>
### Remote Device Mode
Remote device mode allows PWM Dimmer switches to control remote devices. With remote device mode enabled, each button controls a different device. Note that dimmer switches with toggle-style down/up buttons have limited functionality as remote device mode switches because you can not push the down and up buttons simultaneously.
To include remote device mode support in the build, define USE_PWM_DIMMER_REMOTE in your user_config_override. Remote device mode support requires device group support so USE_DEVICE_GROUPS is automatically defined if USE_PWM_DIMMER_REMOTE is defined. Remote device mode support adds 0.7K to the code size in addition to the code size required for device groups support.
To enable remote device mode, set Option88 to 1. Each remote device must be running firmware with device group support and have remote device support enabled. The remote devices do not need to be built with PWM dimmer support nor do they need to be switches.
If a remote device is a PWM dimmer, the device acts like a 3-way dimmer switch would and may or may not have a load connected to it. Its also possible to use a PWM dimmer switch without a load to act as a wall switch to control the power, brightness and color of one or more smart lights with Tasmota with device group support loaded on them.
With remote device mode enabled, button 1 is the power button for the local device while buttons 2 and 3 are the power buttons for remote devices. Group names for buttons 2 and 3 are set by the GroupTopic2 and GroupTopic3 commands respectively. Note that the button numbers are defined by the module template and can be in any physical order on the switch (button 1 can be defined as the top button, the middle button or the bottom button).
Pressing and releasing a power button toggles the power on all devices in the group assigned to the button. When the power is on, holding the button alternately increases or decreases the brightness. When the power is off, holding the button turns the power on at a temporary brightness of the low level set by the BriPreset command (default =10).
While holding a power button, the other two buttons act like the down and up buttons for the remote device. All the functions performed by the down and up buttons in non-remote device mode are available in remote device mode. While holding button 1, button 2 performs the functions of the down button and button 3 performs the functions of the up button. While holding button 2, button 1 performs the functions of the down button and button 3 performs the functions of the up button. While holding button 3, button 1 performs the functions of the down button and button 2 performs the functions of the up button.

View File

@ -52,8 +52,9 @@ The following binary downloads have been compiled with ESP8266/Arduino library c
## Changelog
### Version 8.1.0.9
### Version 8.1.0.10
- Change default my_user_config.h driver and sensor support removing most sensors and adding most drivers
- Change Lights: simplified gamma correction and 10 bits internal computation
- Change commands ``Prefix``, ``Ssid``, ``StateText``, ``NTPServer``, and ``FriendlyName`` displaying all items
- Change IRremoteESP8266 library updated to v2.7.3
@ -107,3 +108,4 @@ The following binary downloads have been compiled with ESP8266/Arduino library c
- Add support for Wemos Motor Shield V1 by Denis Sborets (#7764)
- Add Zigbee enhanced commands decoding, added ``ZbPing``
- Add commands ``SetOption85 0/1`` and ``DevGroupShare`` supporting UDP Group command using ``GroupTopic`` without MQTT by Paul Diem (#7790)
- Add support for Martin Jerry/acenx/Tessan/NTONPOWER SD0x PWM dimmer switches by Paul Diem (#7791)

View File

@ -130,6 +130,7 @@ Kingart Touch {"NAME":"PS-16-DZ","GPIO":[255,148,255,149,255,255,0,0,255
Moes DS01 {"NAME":"MOES - DS01","GPIO":[255,255,255,255,255,255,0,0,255,108,255,107,255],"FLAG":0,"BASE":54}
Moes QS-WiFi-D01 Dimmer 150W {"NAME":"WiFi-Dimmer","GPIO":[0,148,0,149,0,0,0,0,0,42,37,0,0],"FLAG":0,"BASE":18}
PS-16-DZ {"NAME":"PS-16-DZ","GPIO":[255,148,255,149,255,255,0,0,255,52,255,255,255],"FLAG":0,"BASE":58}
PWM Dimmer {"NAME":"PWM Dimmer","GPIO":[19,18,0,59,158,58,0,0,57,37,56,122,29],"FLAG":0,"BASE":73}
Zemismart KS-7011 {"NAME":"KS-7011 Dimmer","GPIO":[255,107,255,108,255,255,0,0,255,255,255,255,255],"FLAG":0,"BASE":54}
```

View File

@ -1,5 +1,9 @@
## Unreleased (development)
### 8.1.0.10 20200227
- Change default my_user_config.h driver and sensor support removing most sensors and adding most drivers
### 8.1.0.9 20200220
- Revert most wifi connectivity changes introduced in 8.1.0.5 (#7746, #7602, #7621)
@ -8,6 +12,7 @@
- Add support for Wemos Motor Shield V1 by Denis Sborets (#7764)
- Add Zigbee enhanced commands decoding, added ``ZbPing``
- Add commands ``SetOption85 0/1`` and ``DevGroupShare`` supporting UDP Group command using ``GroupTopic`` without MQTT by Paul Diem (#7790)
- Add support for Martin Jerry/acenx/Tessan/NTONPOWER SD0x PWM dimmer switches by Paul Diem (#7791)
### 8.1.0.8 20200212

View File

@ -535,6 +535,14 @@
// Commands xdrv_32_hotplug.ino
#define D_CMND_HOTPLUG "HotPlug"
// Commands xdrv_34_pwm_dimmer.ino
#ifdef USE_PWM_DIMMER
#define D_CMND_BRI_MIN "BriMin"
#define D_CMND_BRI_PRESET "BriPreset"
#define D_CMND_LED_TIMEOUT "LedTimeout"
#define D_CMND_POWERED_OFF_LED "PoweredOffLed"
#endif
// Commands xsns_02_analog.ino
#define D_CMND_ADCPARAM "AdcParam"

View File

@ -410,13 +410,15 @@
#define USE_SONOFF_IFAN // Add support for Sonoff iFan02 and iFan03 (+2k code)
#define USE_BUZZER // Add support for a buzzer (+0k6 code)
#define USE_ARILUX_RF // Add support for Arilux RF remote controller (+0k8 code, 252 iram (non 2.3.0))
//#define USE_SHUTTER // Add Shutter support for up to 4 shutter with different motortypes (+11k code)
#define USE_SHUTTER // Add Shutter support for up to 4 shutter with different motortypes (+11k code)
#define USE_DEEPSLEEP // Add support for deepsleep (+1k code)
//#define USE_EXS_DIMMER // Add support for ES-Store WiFi Dimmer (+1k5 code)
// #define EXS_MCU_CMNDS // Add command to send MCU commands (+0k8 code)
#define USE_EXS_DIMMER // Add support for ES-Store WiFi Dimmer (+1k5 code)
// #define EXS_MCU_CMNDS // Add command to send MCU commands (+0k8 code)
//#define USE_HOTPLUG // Add support for sensor HotPlug
//#define USE_KEELOQ
//#define USE_DEVICE_GROUPS // Add support for device groups (+5k6 code)
#define USE_DEVICE_GROUPS // Add support for device groups (+5k6 code)
#define USE_PWM_DIMMER // Add support for MJ-SD01/acenx/NTONPOWER PWM dimmers (+4k5 code)
#define USE_PWM_DIMMER_REMOTE // Add support for remote switches to PWM Dimmer, also adds device groups support (+0k7 code, also includes device groups)
//#define USE_KEELOQ // Add support for controling Jarolift rollers by Keeloq algorithm
// -- Optional light modules ----------------------
#define USE_WS2812 // WS2812 Led string using library NeoPixelBus (+5k code, +1k mem, 232 iram) - Disable by //
@ -442,25 +444,25 @@
#define USE_I2C // I2C using library wire (+10k code, 0k2 mem, 124 iram)
#ifdef USE_I2C
#define USE_SHT // [I2cDriver8] Enable SHT1X sensor (+1k4 code)
#define USE_HTU // [I2cDriver9] Enable HTU21/SI7013/SI7020/SI7021 sensor (I2C address 0x40) (+1k5 code)
#define USE_BMP // [I2cDriver10] Enable BMP085/BMP180/BMP280/BME280 sensors (I2C addresses 0x76 and 0x77) (+4k4 code)
// #define USE_SHT // [I2cDriver8] Enable SHT1X sensor (+1k4 code)
// #define USE_HTU // [I2cDriver9] Enable HTU21/SI7013/SI7020/SI7021 sensor (I2C address 0x40) (+1k5 code)
// #define USE_BMP // [I2cDriver10] Enable BMP085/BMP180/BMP280/BME280 sensors (I2C addresses 0x76 and 0x77) (+4k4 code)
// #define USE_BME680 // Enable support for BME680 sensor using Bosch BME680 library (+4k code)
#define USE_BH1750 // [I2cDriver11] Enable BH1750 sensor (I2C address 0x23 or 0x5C) (+0k5 code)
// #define USE_BH1750 // [I2cDriver11] Enable BH1750 sensor (I2C address 0x23 or 0x5C) (+0k5 code)
// #define USE_VEML6070 // [I2cDriver12] Enable VEML6070 sensor (I2C addresses 0x38 and 0x39) (+1k5 code)
#define USE_VEML6070_RSET 270000 // VEML6070, Rset in Ohm used on PCB board, default 270K = 270000ohm, range for this sensor: 220K ... 1Meg
#define USE_VEML6070_SHOW_RAW // VEML6070, shows the raw value of UV-A
// #define USE_ADS1115 // [I2cDriver13] Enable ADS1115 16 bit A/D converter (I2C address 0x48, 0x49, 0x4A or 0x4B) based on Adafruit ADS1x15 library (no library needed) (+0k7 code)
// #define USE_INA219 // [I2cDriver14] Enable INA219 (I2C address 0x40, 0x41 0x44 or 0x45) Low voltage and current sensor (+1k code)
// #define USE_INA226 // [I2cDriver35] Enable INA226 (I2C address 0x40, 0x41 0x44 or 0x45) Low voltage and current sensor (+2k3 code)
#define USE_SHT3X // [I2cDriver15] Enable SHT3x (I2C address 0x44 or 0x45) or SHTC3 (I2C address 0x70) sensor (+0k7 code)
// #define USE_SHT3X // [I2cDriver15] Enable SHT3x (I2C address 0x44 or 0x45) or SHTC3 (I2C address 0x70) sensor (+0k7 code)
// #define USE_TSL2561 // [I2cDriver16] Enable TSL2561 sensor (I2C address 0x29, 0x39 or 0x49) using library Joba_Tsl2561 (+2k3 code)
// #define USE_TSL2591 // [I2cDriver40] Enable TSL2591 sensor (I2C address 0x29) using library Adafruit_TSL2591 (+1k6 code)
// #define USE_MGS // [I2cDriver17] Enable Xadow and Grove Mutichannel Gas sensor using library Multichannel_Gas_Sensor (+10k code)
#define MGS_SENSOR_ADDR 0x04 // Default Mutichannel Gas sensor i2c address
// #define USE_SGP30 // [I2cDriver18] Enable SGP30 sensor (I2C address 0x58) (+1k1 code)
// #define USE_SI1145 // [I2cDriver19] Enable SI1145/46/47 sensor (I2C address 0x60) (+1k code)
#define USE_LM75AD // [I2cDriver20] Enable LM75AD sensor (I2C addresses 0x48 - 0x4F) (+0k5 code)
// #define USE_LM75AD // [I2cDriver20] Enable LM75AD sensor (I2C addresses 0x48 - 0x4F) (+0k5 code)
// #define USE_APDS9960 // [I2cDriver21] Enable APDS9960 Proximity Sensor (I2C address 0x39). Disables SHT and VEML6070 (+4k7 code)
// #define USE_MCP230xx // [I2cDriver22] Enable MCP23008/MCP23017 - Must define I2C Address in #define USE_MCP230xx_ADDR below - range 0x20 - 0x27 (+4k7 code)
// #define USE_MCP230xx_ADDR 0x20 // Enable MCP23008/MCP23017 I2C Address to use (Must be within range 0x20 through 0x26 - set according to your wired setup)
@ -529,13 +531,13 @@
#endif // USE_SPI
// -- Serial sensors ------------------------------
#define USE_MHZ19 // Add support for MH-Z19 CO2 sensor (+2k code)
#define USE_SENSEAIR // Add support for SenseAir K30, K70 and S8 CO2 sensor (+2k3 code)
//#define USE_MHZ19 // Add support for MH-Z19 CO2 sensor (+2k code)
//#define USE_SENSEAIR // Add support for SenseAir K30, K70 and S8 CO2 sensor (+2k3 code)
#define CO2_LOW 800 // Below this CO2 value show green light (needs PWM or WS2812 RG(B) led and enable with SetOption18 1)
#define CO2_HIGH 1200 // Above this CO2 value show red light (needs PWM or WS2812 RG(B) led and enable with SetOption18 1)
#define USE_PMS5003 // Add support for PMS5003 and PMS7003 particle concentration sensor (+1k3 code)
//#define USE_PMS5003 // Add support for PMS5003 and PMS7003 particle concentration sensor (+1k3 code)
//#define PMS_MODEL_PMS3003 // Enable support of PMS3003 instead of PMS5003/PMS7003 (needs the USE_PMS5003 above)
#define USE_NOVA_SDS // Add support for SDS011 and SDS021 particle concentration sensor (+1k5 code)
//#define USE_NOVA_SDS // Add support for SDS011 and SDS021 particle concentration sensor (+1k5 code)
#define STARTING_OFFSET 30 // Turn on NovaSDS XX-seconds before tele_period is reached
//#define USE_HPMA // Add support for Honeywell HPMA115S0 particle concentration sensor (+1k4)
#define USE_SERIAL_BRIDGE // Add support for software Serial Bridge (+0k8 code)
@ -617,10 +619,10 @@
// -- Other sensors/drivers -----------------------
#define USE_SR04 // Add support for HC-SR04 ultrasonic devices (+1k code)
//#define USE_SR04 // Add support for HC-SR04 ultrasonic devices (+1k code)
//#define USE_TM1638 // Add support for TM1638 switches copying Switch1 .. Switch8 (+1k code)
#define USE_HX711 // Add support for HX711 load cell (+1k5 code)
//#define USE_HX711 // Add support for HX711 load cell (+1k5 code)
// #define USE_HX711_GUI // Add optional web GUI to HX711 as scale (+1k8 code)
// Select none or only one of the below defines

View File

@ -105,9 +105,9 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu
uint32_t zigbee_use_names : 1; // bit 1 (v8.1.0.4) - SetOption83 - Use FriendlyNames instead of ShortAddresses when possible
uint32_t awsiot_shadow : 1; // bit 2 (v8.1.0.5) - SetOption84 - (AWS IoT) publish MQTT state to a device shadow
uint32_t device_groups_enabled : 1; // bit 3 (v8.1.0.9) - SetOption85 - Enable Device Groups
uint32_t led_timeout : 1; // bit 4 (v8.1.0.9) - SetOption86 - Turn brightness LED's off 5 seconds after last change
uint32_t powered_off_led : 1; // bit 5 (v8.1.0.9) - SetOption87 - Turn red LED on when powered off
uint32_t remote_device_mode : 1; // bit 6 (v8.1.0.9) - SetOption88 - Buttons control remote devices
uint32_t led_timeout : 1; // bit 4 (v8.1.0.9) - SetOption86 - PWM Dimmer Turn brightness LED's off 5 seconds after last change
uint32_t powered_off_led : 1; // bit 5 (v8.1.0.9) - SetOption87 - PWM Dimmer Turn red LED on when powered off
uint32_t remote_device_mode : 1; // bit 6 (v8.1.0.9) - SetOption88 - PWM Dimmer Buttons control remote devices
uint32_t spare07 : 1;
uint32_t spare08 : 1;
uint32_t spare09 : 1;
@ -469,8 +469,7 @@ struct SYSCFG {
uint8_t bri_min; // F05
uint8_t bri_preset_low; // F06
uint8_t bri_preset_high; // F07
uint8_t button_devices; // F08
uint8_t free_f09[179]; // F09
uint8_t free_f08[180]; // F08
uint32_t keeloq_master_msb; // FBC
uint32_t keeloq_master_lsb; // FC0

View File

@ -519,9 +519,12 @@ void GetFeatures(void)
#ifdef USE_WEMOS_MOTOR_V1
feature5 |= 0x20000000; // xdrv_34_wemos_motor_v1.ino
#endif
// feature5 |= 0x40000000;
// feature5 |= 0x80000000;
#ifdef USE_DEVICE_GROUPS
feature5 |= 0x40000000; // support_device_groups.ino
#endif
#ifdef USE_PWM_DIMMER
feature5 |= 0x80000000; // xdrv_35_pwm_dimmer
#endif
/*********************************************************************************************/

View File

@ -640,6 +640,12 @@ void MqttShowState(void)
break;
}
#endif // USE_SONOFF_IFAN
#ifdef USE_PWM_DIMMER
if (PWM_DIMMER == my_module_type) {
ResponseAppend_P(PSTR(",\"" D_CMND_DIMMER "\":%d,\"" D_CMND_FADE "\":\"%s\",\"" D_CMND_SPEED "\":%d"),
Settings.light_dimmer, GetStateText(Settings.light_fade), Settings.light_speed);
}
#endif // USE_PWM_DIMMER
#ifdef USE_LIGHT
}
#endif

View File

@ -683,11 +683,11 @@ void WifiShutdown(bool option = false)
// Enable from 6.0.0a until 6.1.0a - disabled due to possible cause of bad wifi connect on core 2.3.0
// Re-enabled from 6.3.0.7 with ESP.restart replaced by ESP.reset
// Courtesy of EspEasy
WiFi.persistent(true); // use SDK storage of SSID/WPA parameters
// WiFi.persistent(true); // use SDK storage of SSID/WPA parameters
ETS_UART_INTR_DISABLE();
wifi_station_disconnect(); // this will store empty ssid/wpa into sdk storage
ETS_UART_INTR_ENABLE();
WiFi.persistent(false); // Do not use SDK storage of SSID/WPA parameters
// WiFi.persistent(false); // Do not use SDK storage of SSID/WPA parameters
}
delay(100); // Flush anything in the network buffers.
}

View File

@ -73,6 +73,16 @@ extern "C" void custom_crash_callback(struct rst_info * rst_info, uint32_t stack
#define MODULE SONOFF_BASIC // [Module] Select default model
#endif
#ifdef USE_PWM_DIMMER_REMOTE
#ifdef USE_PWM_DIMMER
#ifndef USE_DEVICE_GROUPS
#define USE_DEVICE_GROUPS
#endif // USE_DEVICE_GROUPS
#else // USE_PWM_DIMMER
#undef USE_PWM_DIMMER_REMOTE
#endif // USE_PWM_DIMMER
#endif // USE_PWM_DIMMER_REMOTE
/*********************************************************************************************\
* [tasmota-sensors.bin]
* Provide an image with useful supported sensors enabled
@ -96,15 +106,17 @@ extern "C" void custom_crash_callback(struct rst_info * rst_info, uint32_t stack
#ifndef TUYA_DIMMER_ID
#define TUYA_DIMMER_ID 0 // Default dimmer Id
#endif
//#define USE_ARMTRONIX_DIMMERS // Add support for Armtronix Dimmers (+1k4 code)
#undef USE_ARMTRONIX_DIMMERS // Disable support for Armtronix Dimmers (+1k4 code)
#define USE_PS_16_DZ // Add support for PS-16-DZ Dimmer (+2k code)
#define USE_SONOFF_IFAN // Add support for Sonoff iFan02 and iFan03 (+2k code)
#define USE_BUZZER // Add support for a buzzer (+0k6 code)
#define USE_ARILUX_RF // Add support for Arilux RF remote controller (+0k8 code, 252 iram (non 2.3.0))
//#define USE_SHUTTER // Add Shutter support for up to 4 shutter with different motortypes (+6k code)
#undef USE_SHUTTER // Disable Shutter support for up to 4 shutter with different motortypes (+6k code)
#define USE_DEEPSLEEP // Add support for deepsleep (+1k code)
#define USE_EXS_DIMMER // Add support for EX-Store WiFi Dimmer
#undef USE_EXS_DIMMER // Disable support for EX-Store WiFi Dimmer
#define USE_HOTPLUG // Add support for sensor HotPlug
#undef USE_DEVICE_GROUPS // Disable support for device groups (+5k6 code)
#undef USE_PWM_DIMMER // Disable support for MJ-SD01/acenx/NTONPOWER PWM dimmers (+4k5 code)
// -- Optional light modules ----------------------
#define USE_LIGHT // Add Dimmer/Light support
@ -142,8 +154,6 @@ extern "C" void custom_crash_callback(struct rst_info * rst_info, uint32_t stack
#define USE_SGP30 // Add I2C code for SGP30 sensor (+1k1 code)
//#define USE_SI1145 // Add I2C code for SI1145/46/47 sensor (+1k code)
#define USE_LM75AD // Add I2C code for LM75AD sensor (+0k5 code)
#define USE_DHT12 // Add I2C code for DHT12 temperature and humidity sensor (+0k7 code)
#define USE_DS1624 // Add I2C code for DS1624, DS1621 sensor
//#define USE_APDS9960 // Add I2C code for APDS9960 Proximity Sensor. Disables SHT and VEML6070 (+4k7 code)
//#define USE_MCP230xx // Enable MCP23008/MCP23017 - Must define I2C Address in #define USE_MCP230xx_ADDR below - range 0x20 - 0x27 (+4k7 code)
// #define USE_MCP230xx_ADDR 0x20 // Enable MCP23008/MCP23017 I2C Address to use (Must be within range 0x20 through 0x27 - set according to your wired setup)
@ -153,7 +163,7 @@ extern "C" void custom_crash_callback(struct rst_info * rst_info, uint32_t stack
// #define USE_PCA9685_ADDR 0x40 // Enable PCA9685 I2C Address to use (Must be within range 0x40 through 0x47 - set according to your wired setup)
// #define USE_PCA9685_FREQ 50 // Define default PWM frequency in Hz to be used (must be within 24 to 1526) - If other value is used, it will rever to 50Hz
//#define USE_MPR121 // Enable MPR121 controller (I2C addresses 0x5A, 0x5B, 0x5C and 0x5D) in input mode for touch buttons (+1k3 code)
//#define USE_CCS811 // Add I2C code for CCS811 sensor (+2k2 code)
#define USE_CCS811 // Add I2C code for CCS811 sensor (+2k2 code)
//#define USE_MPU6050 // Enable MPU6050 sensor (I2C address 0x68 AD0 low or 0x69 AD0 high) (+2k6 code)
//#define USE_DS3231 // Enable DS3231 external RTC in case no Wifi is avaliable. See docs in the source file (+1k2 code)
//#define USE_MGC3130 // Enable MGC3130 Electric Field Effect Sensor (I2C address 0x42) (+2k7 code, 0k3 mem)
@ -167,6 +177,8 @@ extern "C" void custom_crash_callback(struct rst_info * rst_info, uint32_t stack
//#define USE_PAJ7620 // Enable PAJ7620 gesture sensor (I2C address 0x73) (+2.5k code)
//#define USE_PCF8574 // Enable PCF8574 I/O Expander (I2C addresses 0x20 - 0x26 and 0x39 - 0x3F) (+1k9 code)
#define USE_HIH6 // Enable Honywell HIH Humidity and Temperature sensor (I2C address 0x27) (+0k6)
#define USE_DHT12 // Add I2C code for DHT12 temperature and humidity sensor (+0k7 code)
#define USE_DS1624 // Add I2C code for DS1624, DS1621 sensor
//#define USE_AHT1x // Enable AHT10/15 humidity and temperature sensor (I2C address 0x38) (+0k8 code)
#define USE_WEMOS_MOTOR_V1 // Enable Wemos motor driver V1 (I2C addresses 0x2D - 0x30) (+0k7 code)
#define WEMOS_MOTOR_V1_ADDR 0x30 // Default I2C address 0x30
@ -249,6 +261,7 @@ extern "C" void custom_crash_callback(struct rst_info * rst_info, uint32_t stack
#undef USE_EMULATION // Disable Belkin WeMo and Hue Bridge emulation for Alexa (-16k code, -2k mem)
#undef USE_EMULATION_HUE // Disable Hue Bridge emulation for Alexa (+14k code, +2k mem common)
#undef USE_EMULATION_WEMO // Disable Belkin WeMo emulation for Alexa (+6k code, +2k mem common)
#undef USE_DEEPSLEEP // Disable support for deepsleep (+1k code)
#undef USE_DEVICE_GROUPS // Disable support for device groups (+3k5 code)
#undef DEBUG_THEO // Disable debug code
#undef USE_DEBUG_DRIVER // Disable debug code
@ -288,6 +301,8 @@ extern "C" void custom_crash_callback(struct rst_info * rst_info, uint32_t stack
#undef USE_EXS_DIMMER // Disable support for EX-Store WiFi Dimmer
#undef USE_HOTPLUG // Disable support for HotPlug
#undef USE_DEVICE_GROUPS // Disable support for device groups (+3k5 code)
#undef USE_PWM_DIMMER // Disable support for MJ-SD01/acenx/NTONPOWER PWM dimmers (+4k5 code)
#undef USE_PWM_DIMMER_REMOTE // Disbale support for remote switches to PWM Dimmer
#undef USE_ENERGY_SENSOR // Disable energy sensors (-14k code)
#undef USE_PZEM004T // Disable PZEM004T energy sensor
@ -365,6 +380,8 @@ extern "C" void custom_crash_callback(struct rst_info * rst_info, uint32_t stack
#undef USE_EXS_DIMMER // Disable support for EX-Store WiFi Dimmer
#undef USE_HOTPLUG // Disable support for HotPlug
#undef USE_DEVICE_GROUPS // Disable support for device groups (+3k5 code)
#undef USE_PWM_DIMMER // Disable support for MJ-SD01/acenx/NTONPOWER PWM dimmers (+4k5 code)
#undef USE_PWM_DIMMER_REMOTE // Disbale support for remote switches to PWM Dimmer
// -- Optional light modules ----------------------
//#undef USE_LIGHT // Also disable all Dimmer/Light support
@ -472,6 +489,9 @@ extern "C" void custom_crash_callback(struct rst_info * rst_info, uint32_t stack
#undef USE_DEEPSLEEP // Disable support for deepsleep (+1k code)
#undef USE_EXS_DIMMER // Disable support for EX-Store WiFi Dimmer
#undef USE_HOTPLUG // Disable support for HotPlug
#undef USE_DEVICE_GROUPS // Disable support for device groups (+3k5 code)
#undef USE_PWM_DIMMER // Disable support for MJ-SD01/acenx/NTONPOWER PWM dimmers (+4k5 code)
#undef USE_PWM_DIMMER_REMOTE // Disbale support for remote switches to PWM Dimmer
// -- Optional light modules ----------------------
//#undef USE_LIGHT // Also disable all Dimmer/Light support
@ -587,6 +607,8 @@ extern "C" void custom_crash_callback(struct rst_info * rst_info, uint32_t stack
#undef USE_EXS_DIMMER // Disable support for EX-Store WiFi Dimmer
#undef USE_HOTPLUG // Disable support for HotPlug
#undef USE_DEVICE_GROUPS // Disable support for device groups (+3k5 code)
#undef USE_PWM_DIMMER // Disable support for MJ-SD01/acenx/NTONPOWER PWM dimmers (+4k5 code)
#undef USE_PWM_DIMMER_REMOTE // Disbale support for remote switches to PWM Dimmer
// -- Optional light modules ----------------------
#undef USE_LIGHT // Disable support for lights

View File

@ -418,6 +418,7 @@ enum SupportedModules {
SONOFF_L1,
SONOFF_IFAN03,
EXS_DIMMER,
PWM_DIMMER,
MAXMODULE};
#define USER_MODULE 255
@ -864,6 +865,9 @@ const uint8_t kModuleNiceList[] PROGMEM = {
#endif
#ifdef USE_EXS_DIMMER
EXS_DIMMER,
#endif
#ifdef USE_PWM_DIMMER
PWM_DIMMER,
#endif
H801, // Light Devices
MAGICHOME,
@ -2204,6 +2208,33 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
GPIO_USER, // GPIO14
0, // GPIO15
0, 0
},
{ "PWM Dimmer", // PWM_DIMMER - Support for Martin Jerry/acenx/Tessan/NTONPOWER SD0x PWM
// dimmer switches. The brightness of the load for these dimmers is
// controlled by a PWM GPIO pin. There are typically power, up & down
// buttons and 4 LED's. Examples are:
// https://www.amazon.com/dp/B07FXYSVR1
// https://www.amazon.com/dp/B07V26Q3VD
// https://www.amazon.com/dp/B07K67D43J
// https://www.amazon.com/dp/B07TTGFWFM
GPIO_KEY3, // GPIO00 Up button
GPIO_KEY2, // GPIO01 Down button
0, // GPIO02
GPIO_LED4_INV, // GPIO03 Level 5 LED
GPIO_LEDLNK_INV, // GPIO04 LED Link
GPIO_LED3_INV, // GPIO05 Level 4 LED
// GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_LED2_INV, // GPIO12 Level 3 LED
GPIO_PWM1, // GPIO13 Dimmer PWM
GPIO_LED1_INV, // GPIO12 Level 2 LED
GPIO_KEY1_INV, // GPIO15 Power button
GPIO_REL1_INV, // GPIO16 Power relay/Level 1 LED
0
}
};

View File

@ -20,7 +20,7 @@
#ifndef _TASMOTA_VERSION_H_
#define _TASMOTA_VERSION_H_
const uint32_t VERSION = 0x08010009;
const uint32_t VERSION = 0x0801000A;
// Lowest compatible version
const uint32_t VERSION_COMPATIBLE = 0x07010006;

View File

@ -1123,6 +1123,17 @@ void HandleRoot(void)
} // Settings.flag3.pwm_multi_channels
}
#endif // USE_LIGHT
#ifdef USE_PWM_DIMMER
if (PWM_DIMMER == my_module_type) {
WSContentSend_P(HTTP_MSG_SLIDER_GRADIENT, // Brightness - Black to White
"c", // c - Unique HTML id
"#000", "#fff", // Black to White
4, // sl4 - Unique range HTML id - Used as source for Saturation begin color
Settings.flag3.slider_dimmer_stay_on, 100, // Range 0/1 to 100%
Settings.light_dimmer,
'd', 0); // d0 - Value id is related to lc("d0", value) and WebGetArg("d0", tmp, sizeof(tmp));
}
#endif // USE_PWM_DIMMER
#ifdef USE_SHUTTER
if (Settings.flag3.shutter_mode) { // SetOption80 - Enable shutter support
for (uint32_t i = 0; i < shutters_present; i++) {

View File

@ -2588,6 +2588,8 @@ void CmndRgbwwTable(void)
ResponseCmndChar(scolor);
}
#endif // USE_LIGHT
#if defined(USE_LIGHT) || defined(USE_PWM_DIMMER)
void CmndFade(void)
{
// Fade - Show current Fade state
@ -2606,7 +2608,9 @@ void CmndFade(void)
#ifdef USE_DEVICE_GROUPS
if (XdrvMailbox.payload >= 0 && XdrvMailbox.payload <= 2) SendLocalDeviceGroupMessage(DGR_MSGTYP_UPDATE, DGR_ITEM_LIGHT_FADE, Settings.light_fade);
#endif // USE_DEVICE_GROUPS
#ifdef USE_LIGHT
if (!Settings.light_fade) { Light.fade_running = false; }
#endif // USE_LIGHT
ResponseCmndStateText(Settings.light_fade);
}
@ -2632,6 +2636,8 @@ void CmndSpeed(void)
}
ResponseCmndNumber(Settings.light_speed);
}
#endif // #if defined(USE_LIGHT) || defined(USE_PWM_DIMMER)
#ifdef USE_LIGHT
void CmndWakeupDuration(void)
{
@ -2664,7 +2670,10 @@ bool Xdrv04(uint8_t function)
bool result = false;
if (FUNC_MODULE_INIT == function) {
return LightModuleInit();
#ifdef USE_PWM_DIMMER
if (PWM_DIMMER != my_module_type)
#endif // USE_PWM_DIMMER
return LightModuleInit();
}
else if (light_type) {
switch (function) {

View File

@ -200,8 +200,8 @@ void HAssAnnounceRelayLight(void)
TryResponseAppend_P(HASS_DISCOVER_RELAY, command_topic, value_template, SettingsText(SET_STATE_TXT1), SettingsText(SET_STATE_TXT2));
TryResponseAppend_P(HASS_DISCOVER_DEVICE_INFO_SHORT, unique_id, ESP.getChipId(), WiFi.macAddress().c_str());
#ifdef USE_LIGHT
if (is_light)
#if defined(USE_LIGHT) || defined(USE_PWM_DIMMER)
if (is_light || PWM_DIMMER == my_module_type)
{
char *brightness_command_topic = stemp1;
@ -209,6 +209,7 @@ void HAssAnnounceRelayLight(void)
strncpy_P(stemp3, Settings.flag.not_power_linked ? PSTR("last") : PSTR("brightness"), sizeof(stemp3)); // SetOption20 - Control power in relation to Dimmer/Color/Ct changes
TryResponseAppend_P(HASS_DISCOVER_LIGHT_DIMMER, brightness_command_topic, state_topic, stemp3);
#ifdef USE_LIGHT
if (Light.subtype >= LST_RGB)
{
char *rgb_command_topic = stemp1;
@ -234,8 +235,9 @@ void HAssAnnounceRelayLight(void)
GetTopic_P(color_temp_command_topic, CMND, mqtt_topic, D_CMND_COLORTEMPERATURE);
TryResponseAppend_P(HASS_DISCOVER_LIGHT_CT, color_temp_command_topic, state_topic);
}
#endif // USE_LIGHT
}
#endif // USE_LIGHT
#endif // defined(USE_LIGHT) || defined(USE_PWM_DIMMER)
TryResponseAppend_P(PSTR("}"));
}
MqttPublish(stopic, true);

View File

@ -75,6 +75,7 @@ struct SHUTTER {
uint16_t max_close_pwm_frequency[MAX_SHUTTERS];// maximum of PWM frequency for closeing the shutter. depend on the motor and drivers
uint8_t skip_relay_change; // avoid overrun at endstops
int32_t accelerator[MAX_SHUTTERS]; // speed of ramp-up, ramp down of shutter
uint8_t start_reported = 0;
} Shutter;
void ShutterLogPos(uint32_t i)
@ -264,12 +265,15 @@ void ShutterReportPosition(bool always)
ShutterLogPos(i);
}
if (i) { ResponseAppend_P(PSTR(",")); }
ResponseAppend_P(JSON_SHUTTER_POS, i+1, (Settings.shutter_options[i] & 1) ? 100-position : position, Shutter.direction[i], ShutterRealToPercentPosition(Shutter.target_position[i], i));
uint32_t target = ShutterRealToPercentPosition(Shutter.target_position[i], i);
ResponseAppend_P(JSON_SHUTTER_POS, i+1, (Settings.shutter_options[i] & 1) ? 100-position : position, Shutter.direction[i],(Settings.shutter_options[i] & 1) ? 100-target : target );
}
ResponseJsonEnd();
if (always || (rules_flag.shutter_moving)) {
MqttPublishPrefixTopic_P(RESULT_OR_STAT, PSTR(D_PRFX_SHUTTER));
//XdrvRulesProcess(); //removed because to many exceptions and reboots.
}
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SHT: rules_flag.shutter_moving: %d, moved %d"), rules_flag.shutter_moving, rules_flag.shutter_moved);
}
@ -294,6 +298,11 @@ void ShutterUpdatePosition(void)
// Calculate position with counter. Much more accurate and no need for motordelay workaround
// adding some steps to stop early
Shutter.real_position[i] = ShutterCounterBasedPosition(i);
if (!Shutter.start_reported) {
ShutterReportPosition(true);
XdrvRulesProcess();
Shutter.start_reported = 1;
}
int32_t max_frequency = Shutter.direction[i] == 1 ? Shutter.max_pwm_frequency : Shutter.max_close_pwm_frequency[i];
int32_t max_freq_change_per_sec = Shutter.max_pwm_frequency*steps_per_second / (Shutter.motordelay[i]>0 ? Shutter.motordelay[i] : 1);
@ -303,11 +312,7 @@ void ShutterUpdatePosition(void)
int32_t next_possible_stop = Shutter.real_position[i] + minstopway ;
stop_position_delta =200 * Shutter.pwm_frequency[i]/max_frequency + Shutter.direction[i] * (next_possible_stop - Shutter.target_position[i]);
if (Shutter.time[i] == 1) {
ShutterReportPosition(true);
rules_flag.shutter_moving = 1;
XdrvRulesProcess();
}
//Shutter.accelerator[i] = tmin(tmax(max_freq_change_per_sec*(100-(Shutter.direction[i]*(Shutter.target_position[i]-next_possible_stop) ))/2000 , max_freq_change_per_sec*9/200), max_freq_change_per_sec*11/200);
//int32_t act_freq_change = max_freq_change_per_sec/20;
AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: time: %d, velocity %d, minstopway %d,cur_freq %d, max_frequency %d, act_freq_change %d, min_runtime_ms %d, act.pos %d, next_stop %d, target: %d"),Shutter.time[i],velocity,minstopway,
@ -415,10 +420,7 @@ void ShutterStartInit(uint32_t i, int32_t direction, int32_t target_pos)
Shutter.pwm_frequency[i] = 0;
analogWriteFreq(Shutter.pwm_frequency[i]);
analogWrite(pin[GPIO_PWM1+i], 0);
// can be operated without counter, but then not that acurate.
if (pin[GPIO_CNTR1+i] < 99) {
RtcSettings.pulse_counter[i] = 0;
}
RtcSettings.pulse_counter[i] = 0;
Shutter.accelerator[i] = Shutter.max_pwm_frequency / (Shutter.motordelay[i]>0 ? Shutter.motordelay[i] : 1);
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SHT: Ramp up: %d"), Shutter.accelerator[i]);
}
@ -429,6 +431,7 @@ void ShutterStartInit(uint32_t i, int32_t direction, int32_t target_pos)
Shutter.direction[i] = direction;
rules_flag.shutter_moving = 1;
rules_flag.shutter_moved = 0;
Shutter.start_reported = 0;
//AddLog_P2(LOG_LEVEL_DEBUG, PSTR("SHT: real %d, start %d, counter %d, max_freq %d, dir %d, freq %d"),Shutter.real_position[i], Shutter.start_position[i] ,RtcSettings.pulse_counter[i],Shutter.max_pwm_frequency , Shutter.direction[i] ,Shutter.max_pwm_frequency );
}
//AddLog_P2(LOG_LEVEL_INFO, PSTR("SHT: Start shutter: %d from %d to %d in directin %d"), i, Shutter.start_position[i], Shutter.target_position[i], Shutter.direction[i]);
@ -1155,9 +1158,11 @@ bool Xdrv27(uint8_t function)
break;
case FUNC_JSON_APPEND:
for (uint8_t i = 0; i < shutters_present; i++) {
uint8_t position = (Settings.shutter_options[i] & 1) ? 100 - Settings.shutter_position[i]: Settings.shutter_position[i];
uint8_t position = (Settings.shutter_options[i] & 1) ? 100 - Settings.shutter_position[i] : Settings.shutter_position[i];
uint8_t target = (Settings.shutter_options[i] & 1) ? 100 - ShutterRealToPercentPosition(Shutter.target_position[i], i) : ShutterRealToPercentPosition(Shutter.target_position[i], i);
ResponseAppend_P(",");
ResponseAppend_P(JSON_SHUTTER_POS, i+1, position, Shutter.direction[i]);
ResponseAppend_P(JSON_SHUTTER_POS, i+1, position, Shutter.direction[i],target);
#ifdef USE_DOMOTICZ
if ((0 == tele_period) && (0 == i)) {
DomoticzSensor(DZ_SHUTTER, position);

File diff suppressed because it is too large Load Diff

View File

@ -139,13 +139,16 @@ a_setoption = [[
"Reduced CT range for Alexa",
"Use FriendlyNames instead of ShortAddresses when possible",
"(AWS IoT) publish MQTT state to a device shadow",
"Enable Device Groups",
"PWM Dimmer Turn brightness LED's off 5 seconds after last change",
"PWM Dimmer Turn red LED on when powered off",
"PWM Dimmer Buttons control remote devices",
"",
"","","","",
"","","","",
"","","","",
"","","","",
"","","","",
"","","","",
"","","",""
]]
@ -193,7 +196,7 @@ a_features = [[
"USE_ARDUINO_SLAVE","USE_HIH6","USE_HPMA","USE_TSL2591",
"USE_DHT12","USE_DS1624","USE_GPS","USE_HOTPLUG",
"USE_NRF24","USE_MIBLE","USE_HM10","USE_LE01MR",
"USE_AHT1x","USE_WEMOS_MOTOR_V1","",""
"USE_AHT1x","USE_WEMOS_MOTOR_V1","USE_DEVICE_GROUPS","USE_PWM_DIMMER"
],[
"","","","",
"","","","",
@ -236,7 +239,7 @@ else:
obj = json.load(fp)
def StartDecode():
print ("\n*** decode-status.py v20200222 by Theo Arends and Jacek Ziolkowski ***")
print ("\n*** decode-status.py v20200227 by Theo Arends and Jacek Ziolkowski ***")
# print("Decoding\n{}".format(obj))