Can esp32 with EspEasy not multitask?

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
power-dodge
Normal user
Posts: 19
Joined: 02 Jun 2018, 22:02

Can esp32 with EspEasy not multitask?

#1 Post by power-dodge » 15 Jul 2018, 08:39

Helo,

Try on as 4 pin's at the same time. I have not found a way.

I send via MQTT 4 commands e.g. PWM, 23,1023,1000 and so on.
Unfortunately, the ESP32 waits until the dimming is completed, then only the new pin is controlled. And so on.
The web interface is the same, only when the dimming is finished, you can first enter another command.

With dimming 0 seconds, it will take about 200ms before the next pin is switched.

Is it possible to change this somehow?
Is it the ESP32 or EspEasy?

Thank you

wim16
Normal user
Posts: 88
Joined: 01 May 2017, 20:35

Re: Can esp32 with EspEasy not multitask?

#2 Post by wim16 » 15 Jul 2018, 11:33

I think it's EspEasy, see viewtopic.php?t=2530#p13672

power-dodge
Normal user
Posts: 19
Joined: 02 Jun 2018, 22:02

Re: Can esp32 with EspEasy not multitask?

#3 Post by power-dodge » 15 Jul 2018, 21:39

oh thanks, its not good. :cry:

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Can esp32 with EspEasy not multitask?

#4 Post by TD-er » 18 Jul 2018, 21:35

I am working on changing just this kind of behavior.
But it is going to take some time to get it all done.

For a first impression what's already changed, see: https://github.com/letscontrolit/ESPEas ... t-29741043

power-dodge
Normal user
Posts: 19
Joined: 02 Jun 2018, 22:02

Re: Can esp32 with EspEasy not multitask?

#5 Post by power-dodge » 18 Jul 2018, 22:07

Hello,

Thank you for the effort. Looks better.

Will it later work like that when just a pin is at its blot when new command on mqtt comes in. that the previous ferb is aborted?
So similar:?

Code: Select all

/*
 * hell -> LED aus, PIR ohne Funktion
 * dunkel - innerhalb Zeitspanne -> LED = Helligkeit von Wert des LDR, mit PIR LED=155
 * dunkel - außerhalb Zeitspanne -> LED 0, mit PIR 155
 */

void dimmen_t(byte status, uint16_t helligkeit, bool zspanne) {
  static uint32_t altMillisDimmen;
  static byte fade = 0;
  byte ziel = 0;

  if (aktMillis - altMillisDimmen >= intervallDimmen) {
    altMillisDimmen = aktMillis;
    switch (status) {
      case AUS:
        ziel = 0;
        break;
      case MIN:
        if (zspanne) {
          ziel = map(helligkeit, helligkeitsschwelle, 1023, zielwertMin2, zielwertMin1);
        } else {
          ziel = 0;
        }
        break;
      case MAX:
        ziel = zielwertMax;
        break;
    }
    if (fade < ziel) {
      fade++;
      Serial.print("fade Treppe ");
      Serial.println(fade);
    }
    if (fade > ziel) {
      fade--;
      Serial.print("fade Treppe ");
      Serial.println(fade);
    }
    analogWrite(pinLEDt, fade);
  }
}
Thank you

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Can esp32 with EspEasy not multitask?

#6 Post by TD-er » 18 Jul 2018, 22:19

power-dodge wrote: 18 Jul 2018, 22:07 Hello,

Thank you for the effort. Looks better.

Will it later work like that when just a pin is at its blot when new command on mqtt comes in. that the previous ferb is aborted?
So similar:?
[...]
One of the first things I want to change is the long pulse.
That command should be split into several scheduled actions and being dealt with by the new scheduler.

The same could then be done for the dimmer. And the funny thing is, when it is using the same "scheduler ID" for a new given command, it should replace the already scheduled one.
Since a schedule-ID can only be set once in the queue. (made that on purpose, for reasons like these)
So the general idea is that a dimmer command would re-schedule itself when executed by setting its own ID in the scheduler. When called it knows what the new value must be and just set it.

power-dodge
Normal user
Posts: 19
Joined: 02 Jun 2018, 22:02

Re: Can esp32 with EspEasy not multitask?

#7 Post by power-dodge » 19 Jul 2018, 09:02

Hello,

that would be great!

Had used only for the lighting arduino, since switching worked in ms range.
Unfortunately EspEasy does not yet do that, waiting for a command to finish.

I'm curious how EspEasy32 is developing, this chip has so much potential!

Had thought even before first to look at the one without the EspEasy first to MQTT and looks at what's going on there.

greeting

power-dodge
Normal user
Posts: 19
Joined: 02 Jun 2018, 22:02

Re: Can esp32 with EspEasy not multitask?

#8 Post by power-dodge » 21 Jul 2018, 21:33

Hello,

I have 1 problem with GPIO 17 and GPIO 16 found.

When switching on the ESP you can switch off the outputs with PWM with rules. PWM, 16,0

Later, however, if you use the pin you can take any value but not zero. There is an answer from ESP but it will not be executed.
Let's say GPIO 16 was at 500,
if you send PWM, 16,0, then the pin will still be set to 500 although the following is answered in the web front:

Code: Select all

{
"log": "GPIO 16 Set PWM to 0",
"plugin": 1,
"pin": 16,
"mode": "PWM",
"state": 0
}
GPIO,16,0 works dont

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Can esp32 with EspEasy not multitask?

#9 Post by TD-er » 23 Jul 2018, 21:31

power-dodge wrote: 21 Jul 2018, 21:33 Hello,

I have 1 problem with GPIO 17 and GPIO 16 found.

When switching on the ESP you can switch off the outputs with PWM with rules. PWM, 16,0

Later, however, if you use the pin you can take any value but not zero. There is an answer from ESP but it will not be executed.
Let's say GPIO 16 was at 500,
if you send PWM, 16,0, then the pin will still be set to 500 although the following is answered in the web front:

Code: Select all

{
"log": "GPIO 16 Set PWM to 0",
"plugin": 1,
"pin": 16,
"mode": "PWM",
"state": 0
}
GPIO,16,0 works dont
GPIO16 differs in functionality from the rest.

The ESP8266 has 17 GPIO pins (0...16).
6 of them (GPIO 6 ...11) are connected to the flash and are thus not useable.
GPIO 1 & 3 are connected to hardware serial port.

GPIO 16 can be used to wake up from sleep. But you have to consider the internal resistors, since it has no pull-up resistor, but pull-down instead.
Should be connected to RST to wake up.

power-dodge
Normal user
Posts: 19
Joined: 02 Jun 2018, 22:02

Re: Can esp32 with EspEasy not multitask?

#10 Post by power-dodge » 25 Jul 2018, 20:03

Thanks for the answer.

It's about ESP32.
He has a lot more pins, so 16 and 17 not normal with PWM usable?

Thank you

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Can esp32 with EspEasy not multitask?

#11 Post by TD-er » 26 Jul 2018, 18:28

power-dodge wrote: 25 Jul 2018, 20:03 Thanks for the answer.

It's about ESP32.
He has a lot more pins, so 16 and 17 not normal with PWM usable?

Thank you
Oh sorry, I missed that part about the ESP32.
I have not performed a lot of tests with ESP32.
So maybe there could be some "ESP8266-logic" left in the code about what pins to use and what not.

power-dodge
Normal user
Posts: 19
Joined: 02 Jun 2018, 22:02

Re: Can esp32 with EspEasy not multitask?

#12 Post by power-dodge » 27 Jul 2018, 15:22

Hello,

yes, the bad functioität the pin control I can confirm again.

Some pins can not be set to 0 via PWM and GPIO.

If you set the pins to 0 by rules when starting, then there are sporadically other pins that can not be set to 0.

These pins they can not go but put on PWM 1. But it's easy for consumers to shine.

This behavior I have also on several ESP32 and quite edentisch.

greeting

LisaM
Normal user
Posts: 513
Joined: 11 Apr 2017, 18:29

Re: Can esp32 with EspEasy not multitask?

#13 Post by LisaM » 02 Aug 2018, 22:49

power-dodge wrote: 27 Jul 2018, 15:22 Hello,

yes, the bad functioität the pin control I can confirm again.

Some pins can not be set to 0 via PWM and GPIO.

If you set the pins to 0 by rules when starting, then there are sporadically other pins that can not be set to 0.

These pins they can not go but put on PWM 1. But it's easy for consumers to shine.

This behavior I have also on several ESP32 and quite edentisch.

greeting
The ESP32 is NOT an extra size ESP8266, but behaves completely different. Some pins cannot be programmed to be input and others cannot be programmed to be output. I fell into that trap, ruining my prototype (scratched the pcb and started over again).
For pwm it’s the same, some pins can do pwm while others cannot. Just like I2C: some pins are hardware I2C, while others are software I2C (hw is twice the speed).
Take a look at an ESP32 pinout like this one (wroom32 type): https://goo.gl/images/RXWicF
You’ll need to understand what each label on every pin means! If not you’ll be searching what went wrong for a very long time.

Cheers,

Lisa

power-dodge
Normal user
Posts: 19
Joined: 02 Jun 2018, 22:02

Re: Can esp32 with EspEasy not multitask?

#14 Post by power-dodge » 04 Aug 2018, 13:04

Helo,

thanks for answer.

I will use ESP01 with mcp23017, i hope this have more speed and works with PWM. (Dimming)
Or funktional it on ESP32 good?

Thanks

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 33 guests