Hi, I have a problem with the gpio switch. When I triggered switch OFF -> ON esp fail . Before it failled switch has change pin from LOW -> HIGH. Monochromatic light work correctly.
void setup() {
App.set_name("xxx");
App.init_log()->set_global_log_level(ESPHOMELIB_LOG_LEVEL_INFO);
App.init_log(115200, 1024);
App.init_wifi("xxx", "xxx");
App.init_mqtt("xxx", "xx", "xxx");
App.make_gpio_switch("K pump", D2);
App.make_monochromatic_light("Led", new led_output(new GPIOOutputAnalogPin(D3)));
App.setup();
}
void loop() {
App.loop();
}
[env:d1_mini]
platform = espressif8266
board = d1_mini
framework = arduino
lib_deps = esphomelib
build_flags = -DESPHOMELIB_LOG_LEVEL=ESPHOMELIB_LOG_LEVEL_INFO
static const char *TAG = "led_output";
led_output::led_output(GPIOOutputAnalogPin *pin) {
this->pin = pin;
this->pin->setup();
}
unsigned long last = 0;
void led_output::write_state(float state) {
unsigned long i = millis();
auto stateLong = map(static_cast<long>(state * 255.0f), 0, 255, 0, 1024);
if (last + 1000 < i) {
last = i;
ESP_LOGD(TAG, "write power long %d float %f", stateLong, state);
}
if (lastValue != stateLong) {
lastValue = stateLong;
pin->writeAnalog(stateLong);
}
}
GPIOOutputAnalogPin::GPIOOutputAnalogPin(uint8_t pin, uint8_t mode, bool inverted) : GPIOPin(pin, mode, inverted) {
}
void GPIOOutputAnalogPin::writeAnalog(long value) {
analogWrite(pin_, value);
}
[0;32m[I][application:loop:73]: First loop finished successfully!�[0m
Panic /Users/petr/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/core_esp8266_main.cpp:99 __yield
ctx: sys
sp: 3ffffac0 end: 3fffffb0 offset: 01b0
>>>stack>>>
3ffffc70: 3fff5210 00000000 00000022 3ffe9e8c
3ffffc80: 3ffea360 000000c4 3fff2df8 4020272d
3ffffc90: 00000001 3fff452c 3ffffcf0 40207ad3
3ffffca0: 00000000 00000000 00000001 40216582
3ffffcb0: 00000000 3ffffd54 3fff4994 40207201
3ffffcc0: 3fff4994 3fff4994 3ffffcf0 3fff5dec
3ffffcd0: 3fff4994 00000001 3fff4864 402084b2
3ffffce0: 7fffffff 00000001 3fff4864 4020903b
3ffffcf0: 3fff5210 3fff44c8 00000000 40208dc7
3ffffd00: 3fff4c34 00000001 3fff4c24 40203f6c
3ffffd10: 3fff4bd8 3ffffd54 3fff495c 4020941c
3ffffd20: 3ffeebf4 3ffffd50 3fff4994 40209172
3ffffd30: 3ffffd58 3fff4c54 3fff4c7c 402091dc
3ffffd40: 3fff5e14 3fff5de4 3fff5de4 4020781c
3ffffd50: 3fff5158 3fff4bd8 0000000f 40202554
3ffffd60: 3f000000 00000006 00000006 40207693
3ffffd70: 3ffffed0 3fff3344 00000000 00000000
3ffffd80: 3ffeebf4 3fff3354 00000000 4020cad4
3ffffd90: 00000002 3ffec010 3ffef1c4 4020257c
3ffffda0: 3fff4c54 0000000a 40207670 402077a8
3ffffdb0: 3f000000 3fff5048 3fff373c 40233478
3ffffdc0: 3fff3354 3fff477c 00000000 3ffed7e0
3ffffdd0: 3fff27d0 00000328 00000328 00000000
3ffffde0: 3ffffe50 00000002 3fff50fc 4020efc1
3ffffdf0: 00000002 00000000 00000002 00000000
3ffffe00: 3ffeebd2 00000024 3fff4598 4020dc0e
3ffffe10: 00000002 00000000 00000002 00000000
3ffffe20: 3ffeebd2 00000024 3fff4598 4020c8c9
3ffffe30: 3fff4bdc 3ffffed0 4020bc94 4020ef30
3ffffe40: 3fff4bcc 3ffffed0 4020bc4c 4020ef88
3ffffe50: 00000022 01006b65 4010572e 00080100
3ffffe60: 3fff4705 3fff50fc 7fffffff 00000001
3ffffe70: 4021ab49 000008d0 3ffef1c4 3fff45ec
3ffffe80: 00000001 3fff4c3c 3fff4598 4020c8fc
3ffffe90: 3ffebaf0 3fff3394 3fff4598 4020e639
3ffffea0: 3fff5044 00816277 4021f58e 3fff3394
3ffffeb0: 3fff3194 3fff31a0 00000006 3fff2dbc
3ffffec0: 3fff5044 3fff2dc4 3fff2dc0 4020e684
3ffffed0: 3fff5044 3fff2dc4 3fff2dc0 40236eac
3ffffee0: 00000024 6902a8c0 00000018 00000024
3ffffef0: 00000000 00000018 3ffee568 40106b18
3fffff00: 00000000 00000000 3ffee5b8 3fff3198
3fffff10: 3ffeebaa 3fff31a0 3fff4c3c 4023413d
3fffff20: 3fff2cc4 3fff373c 3fff373c 3ffec798
3fffff30: 00000000 3fff4c3c 0000001c 3fff373c
3fffff40: 3ffeeb9c 00000000 3fff4c3c 40233541
3fffff50: 6402a8c0 00000082 00000000 0000000c
3fffff60: 00000002 0000001a 40243077 3ffed0f0
3fffff70: 3ffeeb74 3fffdcc0 3ffedd08 3ffedd08
3fffff80: 40242fea 3fffdab0 00000000 3fff378c
3fffff90: 3fffdc80 00000000 3fff4c3c 4022c56b
3fffffa0: 40000f49 3fffdab0 3fffdab0 40000f49
<<<stack<<<
ets Jan 8 2013,rst cause:2, boot mode:(3,7)