mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-28 13:46:36 +00:00
Fix for PWM issue
This commit is contained in:
parent
36194b715d
commit
6eaf52f9b0
@ -48,6 +48,7 @@ static inline void gpio_update_group(uint8_t group, lv_obj_t* obj, bool power, i
|
||||
|
||||
#if defined(ARDUINO_ARCH_ESP32)
|
||||
#include "driver/uart.h"
|
||||
#include "driver/ledc.h"
|
||||
#include <driver/dac.h>
|
||||
|
||||
volatile bool touchdetected = false;
|
||||
@ -256,9 +257,9 @@ static void gpio_setup_pin(uint8_t index)
|
||||
gpio->power = gpio->inverted; // gpio is off, state is set to reflect the true output state of the gpio
|
||||
gpio->val = gpio->inverted ? 0 : gpio->max;
|
||||
#if defined(ARDUINO_ARCH_ESP32)
|
||||
if(pwm_channel < 16) {
|
||||
if(pwm_channel < LEDC_CHANNEL_MAX) {
|
||||
// configure LED PWM functionalitites
|
||||
ledcSetup(pwm_channel, 20000, 12);
|
||||
ledcSetup(pwm_channel, 20000, 10);
|
||||
// attach the channel to the GPIO to be controlled
|
||||
ledcAttachPin(gpio->pin, pwm_channel);
|
||||
gpio->channel = pwm_channel++;
|
||||
@ -445,7 +446,7 @@ static inline int32_t gpio_limit(int32_t val, int32_t min, int32_t max)
|
||||
static inline bool gpio_set_analog_value(hasp_gpio_config_t* gpio)
|
||||
{
|
||||
uint16_t val = 0;
|
||||
#if defined(ARDUINO_ARCH_ESP32)
|
||||
#if 0 && defined(ARDUINO_ARCH_ESP32)
|
||||
|
||||
if(gpio->max == 255)
|
||||
val = SCALE_8BIT_TO_12BIT(gpio->val);
|
||||
@ -458,7 +459,7 @@ static inline bool gpio_set_analog_value(hasp_gpio_config_t* gpio)
|
||||
ledcWrite(gpio->channel, val); // 12 bits
|
||||
return true; // sent
|
||||
|
||||
#elif defined(ARDUINO_ARCH_ESP8266)
|
||||
#elif defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_ESP8266)
|
||||
|
||||
if(gpio->max == 255)
|
||||
val = SCALE_8BIT_TO_10BIT(gpio->val);
|
||||
@ -801,7 +802,8 @@ bool gpioIsSystemPin(uint8_t gpio)
|
||||
// Serial GPIOs
|
||||
// Tasmota Client GPIOs
|
||||
|
||||
//NG. Remove the checks here since the is_system_pin function does the same check. Best to keep the code in 1 place only.
|
||||
// NG. Remove the checks here since the is_system_pin function does the same check. Best to keep the code in 1 place
|
||||
// only.
|
||||
/*
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
if((gpio >= 6) && (gpio <= 11)) return true; // integrated SPI flash
|
||||
@ -819,7 +821,6 @@ bool gpioIsSystemPin(uint8_t gpio)
|
||||
#endif
|
||||
*/
|
||||
|
||||
|
||||
if(haspDevice.is_system_pin(gpio)) return true;
|
||||
|
||||
#if defined(HASP_USE_CUSTOM)
|
||||
|
@ -127,7 +127,6 @@ board_build.partitions = user_setups/esp32/partitions_16MB.csv
|
||||
[arduino_esp32_v2]
|
||||
framework = arduino
|
||||
platform = https://github.com/tasmota/platform-espressif32
|
||||
platform_packages = framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#2.0.3-RC1
|
||||
board_build.embed_files =
|
||||
data/edit.htm.gz
|
||||
data/style.css.gz
|
||||
|
@ -6,7 +6,7 @@
|
||||
;***************************************************;
|
||||
|
||||
[env:esp32dev-mrb3511]
|
||||
extends = esp32_4mb
|
||||
extends = esp32_4mb_v2
|
||||
board = esp32dev
|
||||
|
||||
build_flags =
|
||||
|
@ -43,18 +43,18 @@ build_flags =
|
||||
lib_deps =
|
||||
${env.lib_deps}
|
||||
${esp32.lib_deps}
|
||||
${arduino_esp32_v1.lib_deps}
|
||||
${arduino_esp32_v2.lib_deps}
|
||||
${tft_espi.lib_deps}
|
||||
|
||||
lib_ignore =
|
||||
${env.lib_ignore}
|
||||
${esp32.lib_ignore}
|
||||
${arduino_esp32_v1.lib_ignore}
|
||||
${arduino_esp32_v2.lib_ignore}
|
||||
;endregion
|
||||
|
||||
|
||||
[env:freetouchdeck_4MB]
|
||||
extends = freetouchdeck, esp32_4mb
|
||||
extends = freetouchdeck, esp32_4mb_v2
|
||||
|
||||
[env:freetouchdeck_8MB]
|
||||
extends = freetouchdeck, esp32_8mb
|
||||
extends = freetouchdeck, esp32_8mb_v2
|
||||
|
@ -51,7 +51,7 @@ lib_ignore =
|
||||
;endregion
|
||||
|
||||
[env:wt32-sc01_4MB]
|
||||
extends = wt32-sc01, esp32_4mb
|
||||
extends = wt32-sc01, esp32s2_4mb_v2
|
||||
|
||||
[env:wt32-sc01_16MB]
|
||||
extends = wt32-sc01, esp32_16mb
|
||||
extends = wt32-sc01, esp32s2_16mb_v2
|
||||
|
@ -94,7 +94,7 @@ fspi =
|
||||
; -- The Arduino ESP32S2 v2.0.2 with 3 available flash sizes:
|
||||
[arduino_esp32s2_v2]
|
||||
framework = arduino
|
||||
platform = https://github.com/tasmota/platform-espressif32/releases/download/v2.0.3rc1/platform-espressif32-2.0.3.zip
|
||||
platform = https://github.com/tasmota/platform-espressif32
|
||||
board_build.embed_files =
|
||||
data/edit.htm.gz
|
||||
data/style.css.gz
|
||||
|
Loading…
x
Reference in New Issue
Block a user