mtongnz / ESP8266_ArtNetNode_v2

ESP8266 based WiFi ArtNet to DMX, RDM and LED Pixels
GNU General Public License v3.0
611 stars 158 forks source link

Some work to get it stable #92

Open scamiv opened 6 years ago

scamiv commented 6 years ago

Hi, I spent some time fixing the major annoyances. In the WS2812 code i added a routine to halt the NMI while outputting the led data, this fixes the random flicker issue. ( from https://www.esp8266.com/viewtopic.php?f=9&t=3979&start=20 )

Webserver: I added the TCP cleanup code from esp8266/Arduino#1923 this fixes the biggest Memleak and helps against crashes. I modified the webserver to use ServeStatic this safes some heap and allows to send the files gzipped. This makes the interface more snappy while lowering the load on the heap some more. Added cache header.

The main loop now checks for low heap, if heap gets critical we do a reset. Didn't have a hard freeze since.

Changed a lot of strings over to PROGMEM.

Theres now a pwmports[] array, it defines pins that will be accessible for PWM at universe 10.

Still need to do some cleanup before a merge.

Compile options: CPU Frequency needs to be 160mhz, SDK 2.4.1 recommeded. Set lwIP to "V2 Lower Memory" Dont forget to upload SPIFFS (click on "ESP8266 Sketch Data Upload")

tohox commented 6 years ago

I believe this is a similar issue to what @Sine-Audio is experiencing in #66. I've compiled and ran your source on a Wemos D1 mini Pro with your recommended settings and it almost runs as expected. Webui and PWM outputs are working but as soon as I send something on the universe PORTA listens on the ESP crashes or restarts.

The only way to get it to run partially as it is now was to select the Wemos D1 R2 & mini board instead of the Wemos D1mini Pro board. I also had to select 4M (3M SPIFFS) instead of 16M (15M SPIFFS) in order for it to run.

scamiv commented 6 years ago

Not sure what your issue could be, can you get a stack trace via serial and decode it? https://github.com/me-no-dev/EspExceptionDecoder Did you select "Erase all flash Contents" on first flash? Does the issue also occur when you set the port to pixel mode?

Sine-Audio commented 6 years ago

@scamiv Thank you for responding! Im not getting any exceptions, only when I set flash mode wrong (but thats normal). Right now it just says ld~ on the serial monitor and shortly after that a backwards questionmark. It does start a hotspot but only the default one without encryption or anything. Cant connect to webgui. I did erase the modules with esptool erase_flash. It must be something stupid that I am missing but I cant figure it out. Like I said, it does work with the original firmware compiled from Arduino, so maybe I am missing a setting in code?

scamiv commented 6 years ago

Did you try setting the pwmports[] array in line 104 empty?

tohox commented 6 years ago

@scamiv Thanks for your reply.

With the serial monitor set to 115200 it outputs this twice when the ESP restarts:

ets Jan 8 2013,rst cause:4, boot mode:(3,6)

wdt reset load 0x4010f000, len 1384, room 16 tail 8 chksum 0x2d csum 0x2d v614f7c32 ~ld

I was expecting more information but anyway the current version of Exception Decoder appears to be broken or missing some tool chain elements.

Random notes of potential interest:

Sine-Audio commented 6 years ago

I just emptied the pwm ports. I'm getting this with the exception decoder:

Decoding stack results
0x40214c88: spiffs_hal_read(unsigned int, unsigned int, unsigned char*) at /Users/Main/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/cores/esp8266/spiffs_hal.cpp line 45
0x40214d44: spiffs_hal_write(unsigned int, unsigned int, unsigned char*) at /Users/Main/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/cores/esp8266/spiffs_hal.cpp line 102
0x40213559: String::copy(char const*, unsigned int) at /Users/Main/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/cores/esp8266/WString.cpp line 170
0x402135a6: String::String(char const*) at /Users/Main/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/cores/esp8266/WString.cpp line 36
0x40213e58: operator new(unsigned int) at /Users/Main/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/cores/esp8266/abi.cpp line 30
0x4020d5fb: ESP8266WebServer::serveStatic(char const*, fs::FS&, char const*, char const*) at /Users/Main/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/libraries/ESP8266WebServer/src/detail/RequestHandlersImpl.h line 68
0x40214b5f: SPIFFSImpl::begin() at /Users/Main/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/cores/esp8266/spiffs_api.h line 124
0x4020a70f: webStart() at /Users/Main/Downloads/ESP8266_ArtNetNode_v2-master/source/espArtnetNode_2.0.0_b5g/espArtnetNode_2.0.0_b5g.ino line 1036
0x40213f78: esp_yield() at /Users/Main/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/cores/esp8266/core_esp8266_main.cpp line 87
0x402013ee: delay at /Users/Main/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/cores/esp8266/core_esp8266_wiring.c line 54
0x4020aae4: setup() at /Users/Main/Downloads/ESP8266_ArtNetNode_v2-master/source/espArtnetNode_2.0.0_b5g/espArtnetNode_2.0.0_b5g.ino line 288
0x40213fbc: loop_wrapper() at /Users/Main/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/cores/esp8266/core_esp8266_main.cpp line 118
scamiv commented 6 years ago

@tohox Strange issue, i actually never used the dmx output, i will try to replicate your problem on the weekend if i get some time. The gibberish/Flickering is cause you are using one of the rx ports for PORTA, try using another available pin to get rid of that.

@Sine-Audio That's useful, so its failing when setting up the webservier/spiffs.? Did you upload it?(click on "ESP8266 Sketch Data Upload") Requires: https://github.com/esp8266/arduino-esp8266fs-plugin

Sine-Audio commented 6 years ago

@scamiv Yes I did! It uploads both gz files with that plugin.. Its super weird, I tried it with different baud rates and same issue..

tohox commented 6 years ago

@Sine-Audio I had problems getting this branch running initially and it was because I still had old versions of the espArtnetRDM and espDMX_RDM libraries in the Arduino directory. Copying the versions which came with @scamiv version solved that.

Sine-Audio commented 6 years ago

@tohox Just tried that, no change in behaviour, still the same. @scamiv This is my log part of the spiffs upload, nothing out of the ordinary I guess? Just tried it with a Wemos D1 R2 board instead of NodeMCU, but its exactly the same. I tried a different machine with everything completely clean installed (Arduino 1.8.5, latest Arduino JSON library, libraries included with your version and SPIFFS plugin). Super weird! [SPIFFS] data : /Users/Main/Downloads/ESP8266_Artnet/espArtnetNode_2.0.0_b5g/data [SPIFFS] size : 3052 [SPIFFS] page : 256 [SPIFFS] block : 8192 /index.htm.gz /style.css.gz [SPIFFS] upload : /var/folders/5n/zz8qxgrs5fz9fktwb4ht354h0000gn/T/arduino_build_946917/espArtnetNode_2.0.0_b5g.spiffs.bin [SPIFFS] address: 0x100000 [SPIFFS] reset : nodemcu [SPIFFS] port : /dev/cu.SLAB_USBtoUART [SPIFFS] speed : 115200

tohox commented 6 years ago

Hi @scamiv

Any time to try the DMX output and replicate the issuesI've been seeing with the Wemos boards?

Thanks!

mrv96 commented 4 years ago

Hi, this fork doesn't work for me. After flashing, sometimes ESP8266 led turn on, but it doesn't appear any WiFi AP available.