mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-23 02:36:35 +00:00
Fixes
* Setting commands don't update if no data is sent * Didn't understand how pin mapping worked duh. Fixed.
This commit is contained in:
parent
bd33574ee7
commit
fb179c27af
@ -1893,6 +1893,7 @@ void CmndDriver(void)
|
|||||||
|
|
||||||
void CmndSetLedPwmOff(void)
|
void CmndSetLedPwmOff(void)
|
||||||
{
|
{
|
||||||
|
if (XdrvMailbox.data_len > 0) {
|
||||||
if (XdrvMailbox.payload < 0) {
|
if (XdrvMailbox.payload < 0) {
|
||||||
Settings.ledpwm_off = 0;
|
Settings.ledpwm_off = 0;
|
||||||
} else if (XdrvMailbox.payload > Settings.pwm_range) {
|
} else if (XdrvMailbox.payload > Settings.pwm_range) {
|
||||||
@ -1905,6 +1906,7 @@ void CmndSetLedPwmOff(void)
|
|||||||
|
|
||||||
void CmndSetLedPwmOn(void)
|
void CmndSetLedPwmOn(void)
|
||||||
{
|
{
|
||||||
|
if (XdrvMailbox.data_len > 0) {
|
||||||
if (XdrvMailbox.payload < 0) {
|
if (XdrvMailbox.payload < 0) {
|
||||||
Settings.ledpwm_on = 0;
|
Settings.ledpwm_on = 0;
|
||||||
} else if (XdrvMailbox.payload > Settings.pwm_range) {
|
} else if (XdrvMailbox.payload > Settings.pwm_range) {
|
||||||
@ -1912,5 +1914,6 @@ void CmndSetLedPwmOn(void)
|
|||||||
} else {
|
} else {
|
||||||
Settings.ledpwm_on = XdrvMailbox.payload;
|
Settings.ledpwm_on = XdrvMailbox.payload;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
ResponseCmndNumber(Settings.ledpwm_on);
|
ResponseCmndNumber(Settings.ledpwm_on);
|
||||||
}
|
}
|
||||||
|
@ -353,11 +353,19 @@ void SetLedPowerIdx(uint32_t led, uint32_t state)
|
|||||||
}
|
}
|
||||||
uint16_t led_pwm_set = 0;
|
uint16_t led_pwm_set = 0;
|
||||||
if (bitRead(led_inverted, led)) {
|
if (bitRead(led_inverted, led)) {
|
||||||
led_pwm_set = state ? Settings.pwm_range - Settings.ledpwm_on : Settings.pwm_range - Settings.ledpwm_off;
|
if (state) {
|
||||||
|
led_pwm_set = Settings.pwm_range - Settings.ledpwm_on;
|
||||||
} else {
|
} else {
|
||||||
led_pwm_set = state ? Settings.ledpwm_on : Settings.ledpwm_off;
|
led_pwm_set = Settings.pwm_range - Settings.ledpwm_off;
|
||||||
}
|
}
|
||||||
analogWrite(led, led_pwm_set);
|
} else {
|
||||||
|
if (state) {
|
||||||
|
led_pwm_set = Settings.ledpwm_on;
|
||||||
|
} else {
|
||||||
|
led_pwm_set = Settings.ledpwm_off;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
analogWrite(Pin(GPIO_LED1, led), led_pwm_set);
|
||||||
}
|
}
|
||||||
#ifdef USE_BUZZER
|
#ifdef USE_BUZZER
|
||||||
if (led == 0) {
|
if (led == 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user