mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-09 21:17:18 +03:00
fix expander as output (works now on 9535)
This commit is contained in:
@@ -181,9 +181,9 @@ bool led_config(int idx, gpio_num_t gpio, int onstate, int pwm) {
|
||||
leds[idx].onstate = onstate;
|
||||
leds[idx].pwm = -1;
|
||||
|
||||
if (pwm < 0) {
|
||||
gpio_pad_select_gpio(gpio);
|
||||
gpio_set_direction(gpio, GPIO_MODE_OUTPUT);
|
||||
if (pwm < 0 || gpio >= GPIO_NUM_MAX) {
|
||||
if (gpio < GPIO_NUM_MAX) gpio_pad_select_gpio(gpio);
|
||||
gpio_set_direction_u(gpio, GPIO_MODE_OUTPUT);
|
||||
} else {
|
||||
leds[idx].channel = pwm_system.base_channel++;
|
||||
leds[idx].pwm = pwm_system.max * powf(pwm / 100.0, 3);
|
||||
|
||||
@@ -43,12 +43,12 @@ void set_power_gpio(int gpio, char *value) {
|
||||
bool parsed = true;
|
||||
|
||||
if (!strcasecmp(value, "vcc") ) {
|
||||
gpio_pad_select_gpio(gpio);
|
||||
gpio_set_direction(gpio, GPIO_MODE_OUTPUT);
|
||||
if (gpio < GPIO_NUM_MAX) gpio_pad_select_gpio(gpio);
|
||||
gpio_set_direction_u(gpio, GPIO_MODE_OUTPUT);
|
||||
gpio_set_level_u(gpio, 1);
|
||||
} else if (!strcasecmp(value, "gnd")) {
|
||||
gpio_pad_select_gpio(gpio);
|
||||
gpio_set_direction(gpio, GPIO_MODE_OUTPUT);
|
||||
if (gpio < GPIO_NUM_MAX) gpio_pad_select_gpio(gpio);
|
||||
gpio_set_direction_u(gpio, GPIO_MODE_OUTPUT);
|
||||
gpio_set_level_u(gpio, 0);
|
||||
} else parsed = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user