From 3593ce20b39bb1874f99a056aeb8becc5f4c2d1f Mon Sep 17 00:00:00 2001 From: fvanroie <15969459+fvanroie@users.noreply.github.com> Date: Sun, 23 May 2021 23:32:10 +0200 Subject: [PATCH] Native fixes for millis and dimmer --- src/main_sdl2.cpp | 2 +- src/sys/gpio/hasp_gpio.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main_sdl2.cpp b/src/main_sdl2.cpp index 99d6eea5..2955cd3b 100644 --- a/src/main_sdl2.cpp +++ b/src/main_sdl2.cpp @@ -138,7 +138,7 @@ void setup() gpioSetup(); #endif - mainLastLoopTime = millis() - 1000; // reset loop counter + mainLastLoopTime = millis(); // - 1000; // reset loop counter printf("%s %d\n", __FILE__, __LINE__); // delay(250); } diff --git a/src/sys/gpio/hasp_gpio.cpp b/src/sys/gpio/hasp_gpio.cpp index adf483ae..30062077 100644 --- a/src/sys/gpio/hasp_gpio.cpp +++ b/src/sys/gpio/hasp_gpio.cpp @@ -324,7 +324,9 @@ void gpioSetup(void) gpioSavePinConfig(0, 3, hasp_gpio_type_t::POWER_RELAY, 0, -1, false); gpioSavePinConfig(1, 4, hasp_gpio_type_t::LIGHT_RELAY, 0, -1, false); gpioSavePinConfig(2, 13, hasp_gpio_type_t::LED, 0, -1, false); + gpioConfig[2].max = 255; gpioSavePinConfig(3, 14, hasp_gpio_type_t::DAC, 0, -1, false); + gpioConfig[2].max = 4095; gpioSavePinConfig(4, 5, hasp_gpio_type_t::MOTION, 0, -1, false); } IRAM_ATTR void gpioLoop(void) @@ -490,7 +492,7 @@ static bool gpio_set_output_value(hasp_gpio_config_t* gpio, bool power, uint16_t gpio->power = val == 0 ? 0 : power; // Only update the current value if power set to 1, otherwise retain previous value - if(power) gpio->val = gpio_limit(val, 0, gpio->max); + if(val != 0) gpio->val = gpio_limit(val, 0, gpio->max); switch(gpio->type) { case hasp_gpio_type_t::POWER_RELAY: