Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problem adding light support #366

Closed
xoseperez opened this issue Jan 4, 2018 · 5 comments
Closed

problem adding light support #366

xoseperez opened this issue Jan 4, 2018 · 5 comments

Comments

@xoseperez
Copy link
Owner

Originally reported by: blue (Bitbucket: bluexp, GitHub: bluexp)


I am trying to add 3 channel RGB light support to NODEMCU board. I've added following lines to hardware.h:

#!arduino

    #define LIGHT_PROVIDER      LIGHT_PROVIDER_DIMMER
    #define LIGHT_CHANNELS      3
    #define LIGHT_CH1_PIN       12      // GREEN
    #define LIGHT_CH2_PIN       13      // BLUE
    #define LIGHT_CH3_PIN       15      // WHITE
    #define LIGHT_CH1_INVERSE   0
    #define LIGHT_CH2_INVERSE   0
    #define LIGHT_CH3_INVERSE   0

But the module threw exception and rebooted several time and web ui stopped working.
Am I doing it right? what is the problem?

I also want to know what is the purpose and use of LED1 and LED_WIFI?

@xoseperez
Copy link
Owner Author

It would be nice to know what exception it threw, maybe decoding it to know the place in code that failed. When the firmware is unstable (reboots 5 times in a row) it enters "safe mode", creates an WIFI AP and only TELNET and OTA are available, no web interface. It's a feature to allow the user to recover from a not working image (reflashing via OTA with a stable version).

On your settings you probably want to add a dummy relay to toggle light on and off:

    #define RELAY_PROVIDER      RELAY_PROVIDER_LIGHT
    #define DUMMY_RELAY_COUNT   1

LED_WIFI is deprecated and should not be in the code, I'm removing its references. LED1_### is meant to control onboard LEDs, typically used for notifications.

@xoseperez
Copy link
Owner Author

Original comment by blue (Bitbucket: bluexp, GitHub: bluexp):


Thanks for your guide, here is the log reported when activating light_provider:

#!arduino

[SETTINGS] Settings size: 1104 bytes


[INIT] ESPURNA 1.11.2
[INIT] xose.perez@gmail.com
[INIT] http://tinkerman.cat

[INIT] CPU chip ID: 0x391069
[INIT] CPU frequency: 80 MHz
[INIT] SDK version: 1.5.3(aec24ac9)
[INIT] Core version: 2_3_0
[INIT] Core revision: 

[INIT] Flash chip ID: 0x164020
[INIT] Flash speed: 40000000 Hz
[INIT] Flash mode: DIO

[INIT] Flash sector size:     4096 bytes
[INIT] Flash size (CHIP):  4194304 bytes
[INIT] Flash size (SDK):   4194304 bytes / 1024 sectors
[INIT] Firmware size:       485072 bytes /  119 sectors
[INIT] OTA size:            561152 bytes /  137 sectors
[INIT] SPIFFS size:              0 bytes /    0 sectors
[INIT] EEPROM size:           4096 bytes /    1 sectors
[INIT] Empty space:          16384 bytes /    4 sectors

[INIT] MANUFACTURER: NODEMCU
[INIT] DEVICE: LOLIN
[INIT] SUPPORT: ALEXA DEBUG_SERIAL DEBUG_TELNET DOMOTICZ HOMEASSISTANT MDNS NTP SENSOR TELNET TERMINAL WEB
[INIT] SENSORS: DALLAS DHTXX DIGITAL

[INIT] Last reset reason: External System
[INIT] Free heap: 28200 bytes
[INIT] Power: 2736 mV
[INIT] Power saving delay value: 10 ms

[TELNET] Listening on port 23
[WEBSERVER] Webserver running on port 80

Exception (3):
epc1=0x4022aa2f epc2=0x00000000 epc3=0x00000000 excvaddr=0x40226344 depc=0x00000000

ctx: cont 
sp: 3fff21d0 end: 3fff24b0 offset: 01a0

>>>stack>>>
3fff2370:  00000000 00000000 00000003 00000003  
3fff2380:  00002710 3fff2410 00000004 fffffecf  
3fff2390:  00000003 00000003 00000003 3fff0f74  
3fff23a0:  0000000f 3fff23d4 00000003 4020ff64  
3fff23b0:  60000804 00000003 0000000c 60000808  
3fff23c0:  00000003 0000000d 60000810 00000003  
3fff23d0:  0000000f 3fff5ca4 3fff55a4 401004d8  
3fff23e0:  3fff2450 3fff55a4 3fff2410 40226344  
3fff23f0:  00000000 00000000 00000000 402180a9  
3fff2400:  3fff2450 3fff55a4 3fff5ca4 40218282  
3fff2410:  00000000 00000000 00000000 40226944  
3fff2420:  3ffe8d28 3ffe895c 3fff0bb8 4020e256  
3fff2430:  3fff4cfc 3ffe895c 3fff0be0 4020b6bd  
3fff2440:  00000000 40226944 40226958 4020b74c  
3fff2450:  4020ebc0 00000000 40226908 3fff1484  
3fff2460:  3fffdad0 3ffe895c 0000000c 402113d0  
3fff2470:  00000000 00000000 00000000 00000000  
3fff2480:  00000000 00000000 feefeffe feefeffe  
3fff2490:  feefeffe 00000000 3fff147e 402264a8  
3fff24a0:  feefeffe feefeffe 3fff1490 40100718  
<<<stack<<<

 ets Jan  8 2013,rst cause:2, boot mode:(3,0)

load 0x4010f000, len 1384, room 16 
tail 8
chksum 0x2d
csum 0x2d
v09826c6d
~ld
[SETTINGS] EEPROM size: 4096 bytes
[SETTINGS] Settings size: 1104 bytes


[INIT] ESPURNA 1.11.2
[INIT] xose.perez@gmail.com
[INIT] http://tinkerman.cat

[INIT] CPU chip ID: 0x391069
[INIT] CPU frequency: 80 MHz
[INIT] SDK version: 1.5.3(aec24ac9)
[INIT] Core version: 2_3_0
[INIT] Core revision: 

[INIT] Flash chip ID: 0x164020
[INIT] Flash speed: 40000000 Hz
[INIT] Flash mode: DIO

[INIT] Flash sector size:     4096 bytes
[INIT] Flash size (CHIP):  4194304 bytes
[INIT] Flash size (SDK):   4194304 bytes / 1024 sectors
[INIT] Firmware size:       485072 bytes /  119 sectors
[INIT] OTA size:            561152 bytes /  137 sectors
[INIT] SPIFFS size:              0 bytes /    0 sectors
[INIT] EEPROM size:           4096 bytes /    1 sectors
[INIT] Empty space:          16384 bytes /    4 sectors

[INIT] MANUFACTURER: NODEMCU
[INIT] DEVICE: LOLIN
[INIT] SUPPORT: ALEXA DEBUG_SERIAL DEBUG_TELNET DOMOTICZ HOMEASSISTANT MDNS NTP SENSOR TELNET TERMINAL WEB
[INIT] SENSORS: DALLAS DHTXX DIGITAL

[INIT] Last reset reason: Exception
[INIT] Free heap: 28200 bytes
[INIT] Power: 2734 mV
[INIT] Power saving delay value: 10 ms

[TELNET] Listening on port 23
[WEBSERVER] Webserver running on port 80

Exception (3):
epc1=0x4022aa2f epc2=0x00000000 epc3=0x00000000 excvaddr=0x40226344 depc=0x00000000

ctx: cont 
sp: 3fff21d0 end: 3fff24b0 offset: 01a0

>>>stack>>>
3fff2370:  00000000 00000000 00000003 00000003  
3fff2380:  00002710 3fff2410 00000004 fffffecf  
3fff2390:  00000003 00000003 00000003 3fff0f74  
3fff23a0:  0000000f 3fff23d4 00000003 4020ff64  
3fff23b0:  60000804 00000003 0000000c 60000808  
3fff23c0:  00000003 0000000d 60000810 00000003  
3fff23d0:  0000000f 3fff5ca4 3fff55a4 401004d8  
3fff23e0:  3fff2450 3fff55a4 3fff2410 40226344  
3fff23f0:  00000000 00000000 00000000 402180a9  
3fff2400:  3fff2450 3fff55a4 3fff5ca4 40218282  
3fff2410:  00000000 00000000 00000000 40226944  
3fff2420:  3ffe8d28 3ffe895c 3fff0bb8 4020e256  
3fff2430:  3fff4cfc 3ffe895c 3fff0be0 4020b6bd  
3fff2440:  00000000 40226944 40226958 4020b74c  
3fff2450:  4020ebc0 00000000 40226908 3fff1484  
3fff2460:  3fffdad0 3ffe895c 0000000c 402113d0  
3fff2470:  00000000 00000000 00000000 00000000  
3fff2480:  00000000 00000000 feefeffe feefeffe  
3fff2490:  feefeffe 00000000 3fff147e 402264a8  
3fff24a0:  feefeffe feefeffe 3fff1490 40100718  
<<<stack<<<

 ets Jan  8 2013,rst cause:2, boot mode:(3,0)

load 0x4010f000, len 1384, room 16 
tail 8
chksum 0x2d
csum 0x2d
v09826c6d
~ld
[SETTINGS] EEPROM size: 4096 bytes
[SETTINGS] Settings size: 1104 bytes


[INIT] ESPURNA 1.11.2
[INIT] xose.perez@gmail.com
[INIT] http://tinkerman.cat

[INIT] CPU chip ID: 0x391069
[INIT] CPU frequency: 80 MHz
[INIT] SDK version: 1.5.3(aec24ac9)
[INIT] Core version: 2_3_0
[INIT] Core revision: 

[INIT] Flash chip ID: 0x164020
[INIT] Flash speed: 40000000 Hz
[INIT] Flash mode: DIO

[INIT] Flash sector size:     4096 bytes
[INIT] Flash size (CHIP):  4194304 bytes
[INIT] Flash size (SDK):   4194304 bytes / 1024 sectors
[INIT] Firmware size:       485072 bytes /  119 sectors
[INIT] OTA size:            561152 bytes /  137 sectors
[INIT] SPIFFS size:              0 bytes /    0 sectors
[INIT] EEPROM size:           4096 bytes /    1 sectors
[INIT] Empty space:          16384 bytes /    4 sectors

[INIT] MANUFACTURER: NODEMCU
[INIT] DEVICE: LOLIN
[INIT] SUPPORT: ALEXA DEBUG_SERIAL DEBUG_TELNET DOMOTICZ HOMEASSISTANT MDNS NTP SENSOR TELNET TERMINAL WEB
[INIT] SENSORS: DALLAS DHTXX DIGITAL

[INIT] Last reset reason: Exception
[INIT] Free heap: 28200 bytes
[INIT] Power: 2734 mV
[INIT] Power saving delay value: 10 ms

[TELNET] Listening on port 23
[WEBSERVER] Webserver running on port 80

Exception (3):
epc1=0x4022aa2f epc2=0x00000000 epc3=0x00000000 excvaddr=0x40226344 depc=0x00000000

ctx: cont 
sp: 3fff21d0 end: 3fff24b0 offset: 01a0

>>>stack>>>
3fff2370:  00000000 00000000 00000003 00000003  
3fff2380:  00002710 3fff2410 00000004 fffffecf  
3fff2390:  00000003 00000003 00000003 3fff0f74  
3fff23a0:  0000000f 3fff23d4 00000003 4020ff64  
3fff23b0:  60000804 00000003 0000000c 60000808  
3fff23c0:  00000003 0000000d 60000810 00000003  
3fff23d0:  0000000f 3fff5ca4 3fff55a4 401004d8  
3fff23e0:  3fff2450 3fff55a4 3fff2410 40226344  
3fff23f0:  00000000 00000000 00000000 402180a9  
3fff2400:  3fff2450 3fff55a4 3fff5ca4 40218282  
3fff2410:  00000000 00000000 00000000 40226944  
3fff2420:  3ffe8d28 3ffe895c 3fff0bb8 4020e256  
3fff2430:  3fff4cfc 3ffe895c 3fff0be0 4020b6bd  
3fff2440:  00000000 40226944 40226958 4020b74c  
3fff2450:  4020ebc0 00000000 40226908 3fff1484  
3fff2460:  3fffdad0 3ffe895c 0000000c 402113d0  
3fff2470:  00000000 00000000 00000000 00000000  
3fff2480:  00000000 00000000 feefeffe feefeffe  
3fff2490:  feefeffe 00000000 3fff147e 402264a8  
3fff24a0:  feefeffe feefeffe 3fff1490 40100718  
<<<stack<<<

 ets Jan  8 2013,rst cause:2, boot mode:(3,0)

load 0x4010f000, len 1384, room 16 
tail 8
chksum 0x2d
csum 0x2d
v09826c6d
~ld
[MAIN] System UNSTABLE
[SETTINGS] EEPROM size: 4096 bytes
[SETTINGS] Settings size: 1104 bytes


[INIT] ESPURNA 1.11.2
[INIT] xose.perez@gmail.com
[INIT] http://tinkerman.cat

[INIT] CPU chip ID: 0x391069
[INIT] CPU frequency: 80 MHz
[INIT] SDK version: 1.5.3(aec24ac9)
[INIT] Core version: 2_3_0
[INIT] Core revision: 

[INIT] Flash chip ID: 0x164020
[INIT] Flash speed: 40000000 Hz
[INIT] Flash mode: DIO

[INIT] Flash sector size:     4096 bytes
[INIT] Flash size (CHIP):  4194304 bytes
[INIT] Flash size (SDK):   4194304 bytes / 1024 sectors
[INIT] Firmware size:       485072 bytes /  119 sectors
[INIT] OTA size:            561152 bytes /  137 sectors
[INIT] SPIFFS size:              0 bytes /    0 sectors
[INIT] EEPROM size:           4096 bytes /    1 sectors
[INIT] Empty space:          16384 bytes /    4 sectors

[INIT] MANUFACTURER: NODEMCU
[INIT] DEVICE: LOLIN
[INIT] SUPPORT: ALEXA DEBUG_SERIAL DEBUG_TELNET DOMOTICZ HOMEASSISTANT MDNS NTP SENSOR TELNET TERMINAL WEB
[INIT] SENSORS: DALLAS DHTXX DIGITAL

[INIT] Last reset reason: Exception
[INIT] Free heap: 28200 bytes
[INIT] Power: 2733 mV
[INIT] Power saving delay value: 10 ms

[TELNET] Listening on port 23
[MAIN] Uptime: 0 seconds
[MAIN] Free heap: 27352 bytes
[MAIN] Power: 2734 mV
[MAIN] Time: Not set
[WIFI] Creating access point
[WIFI] MODE AP --------------------------------------
[WIFI] SSID SALAM_391069
[WIFI] PASS Admin1
[WIFI] IP   192.168.1.1
[WIFI] MAC  2E:3A:E8:39:10:69
[WIFI] ----------------------------------------------

@xoseperez
Copy link
Owner Author

Please update your code to 1.11.3, this bug was solved last week: issue #356 .

@xoseperez
Copy link
Owner Author

Original comment by blue (Bitbucket: bluexp, GitHub: bluexp):


Thanks, the problem is fixed after updating to 1.11.3.
one more question, is it possible to have normal switch/relay after adding DUMMY_RELAY_COUNT?

@xoseperez
Copy link
Owner Author

Not at the moment. But there are plans to allow defining new buttons and mapping them to relays or other options. That's a future feature :=)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant