Skip to content
This repository has been archived by the owner on Apr 28, 2022. It is now read-only.

I cannot make it work #357

Closed
scordal opened this issue Mar 10, 2019 · 16 comments
Closed

I cannot make it work #357

scordal opened this issue Mar 10, 2019 · 16 comments

Comments

@scordal
Copy link

scordal commented Mar 10, 2019

I am a novice in NodeMcu and Arduino things, but I am learning littlñe by little.
I am an electronic freak and I am trying to make this work. Yesterday was omehow possible but since yesterday I cannot finish the installation part.
I have been struggling with this since two days and seems that today there was a code change that makes impossible to install the index.html
The feedback from Serail COM3 is following:

FS Usage: 0/957314 bytes

Coudnt find config.json
Coudnt find config.json
WiFiManager config FS Read failure!
*WM: Adding parameter
*WM: host
*WM: Adding parameter
*WM: port
*WM: Adding parameter
*WM: user
*WM: Adding parameter
*WM: pass
*WM: Adding parameter
*WM: strip_size
*WM: Adding parameter
*WM: led_pin
*WM: 
*WM: AutoConnect
*WM: Connecting as wifi client...
*WM: Using last saved values, should be faster
*WM: Connection result: 
*WM: 0
Entered config mode
192.168.4.1
McLighting01
*WM: 
*WM: Configuring access point... 
*WM: McLighting01
*WM: AP IP address: 
*WM: 192.168.4.1
*WM: HTTP server started
Saving Strip cfg: {"pixel_pount":300,"rgb_order":82,"pin":14}
*WM: Request redirected to captive portal
*WM: Request redirected to captive portal
*WM: Request redirected to captive portal
*WM: Request redirected to captive portal
*WM: Request redirected to captive portal
*WM: Request redirected to captive portal
*WM: Request redirected to captive portal
*WM: Request redirected to captive portal
*WM: Handle root
*WM: Request redirected to captive portal
*WM: Handle root
*WM: Request redirected to captive portal
*WM: Handle root
*WM: Request redirected to captive portal
*WM: Request redirected to captive portal
*WM: Request redirected to captive portal
*WM: Handle root
*WM: Handle root
*WM: Handle root
*WM: Handle root
*WM: Handle root
*WM: Request redirected to captive portal
*WM: Request redirected to captive portal
*WM: Request redirected to captive portal
*WM: Handle root
*WM: Request redirected to captive portal
*WM: Request redirected to captive portal
*WM: Request redirected to captive portal
*WM: Handle root
*WM: Request redirected to captive portal
*WM: Sent config page
*WM: Request redirected to captive portal
*WM: Request redirected to captive portal
*WM: Request redirected to captive portal
*WM: Request redirected to captive portal
*WM: Handle root
*WM: Request redirected to captive portal
*WM: Handle root
*WM: Request redirected to captive portal
*WM: Request redirected to captive portal
*WM: WiFi save
*WM: Parameter
*WM: host
*WM: 192.168.1.130
*WM: Parameter
*WM: port
*WM: 1883
*WM: Parameter
*WM: user
*WM: xxxxxxxx
*WM: Parameter
*WM: pass
*WM: xxxxxxxx
*WM: Parameter
*WM: strip_size
*WM: 300
*WM: Parameter
*WM: led_pin
*WM: 14
*WM: Sent wifi save page
*WM: Connecting to new AP
*WM: Connecting as wifi client...
*WM: Connection result: 
*WM: 3
Should save config
Saving config: {"mqtt_host":"192.168.1.130","mqtt_port":"1883","mqtt_user":"mysuser","mqtt_pass":"mypassword"}WiFiManager config FS Save success!
connected...yeey :)
Arduino OTA activated.

Connecting to MQTT...
Open http://192.168.1.12/ to open McLighting.
Use http://McLighting01.local/ when you have Bonjour installed.
New users: Open http://192.168.1.12/upload to upload the webpages first.

E1.31 mode setup complete.
Couldn't find "/stripstate.json"
 Failure!
*WM: freeing allocated params!
SET_MODE: 0 0

Soft WDT reset

>>>stack>>>

ctx: cont
sp: 3fff2af0 end: 3fff2d50 offset: 01b0
3fff2ca0:  00000000 000000ff 40100220 0004951d  
3fff2cb0:  00000000 3fff34d4 3fff350c 00000210  
3fff2cc0:  3fff31bc 3fff2fbc 00000523 40223ad8  
3fff2cd0:  4022c2a0 00000000 00000000 0004951d  
3fff2ce0:  3fff31bc 00000000 3fff2fbc 40223788  
3fff2cf0:  ffffff80 3fff0b24 3fff2fbc 402236fd  
3fff2d00:  3fff2fbc 3fff0b24 3fff2fbc 3fff15a0  
3fff2d10:  3fff2fbc 3fff0b24 3ffe8550 40210551  
3fff2d20:  feefeffe feefeffe feefeffe 3fff18a8  
3fff2d30:  3fffdad0 00000000 3fff1878 40228b98  
3fff2d40:  feefeffe feefeffe 3ffe86c0 40100b6d  
<<<stack<<<

 ets Jan  8 2013,rst cause:2, boot mode:(1,6)


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

wdt reset

Seems that after setting up the wifi, the device resets itself and therefore I cannot continue.

My definition.h contents are:

//#define USE_WS2812FX_DMA       // LED_PIN is ignored & set to RX/GPIO3  Uses WS2812FX, see: https://github.com/kitesurfer1404/WS2812FX
//#define USE_WS2812FX_UART1     // LED_PIN is ignored & set to D4/GPIO2  Uses WS2812FX, see: https://github.com/kitesurfer1404/WS2812FX
//#define USE_WS2812FX_UART2     // LED_PIN is ignored & set to TX/GPIO1  Uses WS2812FX, see: https://github.com/kitesurfer1404/WS2812FX

// Neopixel
#define LED_PIN 14       // LED_PIN (14 / D5) where neopixel / WS2811 strip is attached
#define NUMLEDS 300       // Number of leds in the strip
#define LED_TYPE_WS2811  // Uncomment if LED type uses 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
#define BUILTIN_LED 2    // ESP-12F has the built in LED on GPIO2, see https://github.com/esp8266/Arduino/issues/2192
#define BUTTON 4         // Input pin (4 / D2) for switching the LED strip on / off, connect this PIN to ground to trigger button.

#define HOSTNAME "McLighting01"   // Friedly hostname

#define HTTP_OTA             // If defined, enable ESP8266HTTPUpdateServer OTA code.
#define ENABLE_OTA         // If defined, enable Arduino OTA code.
#define ENABLE_AMQTT         // If defined, enable Async MQTT code, see: https://github.com/marvinroger/async-mqtt-client
//#define ENABLE_MQTT        // If defined, enable MQTT client code, see: https://github.com/toblum/McLighting/wiki/MQTT-API
#define ENABLE_HOMEASSISTANT // If defined, enable Homeassistant integration, ENABLE_MQTT or ENABLE_AMQTT must be active
#define ENABLE_BUTTON        // If defined, enable button handling code, see: https://github.com/toblum/McLighting/wiki/Button-control
#define MQTT_HOME_ASSISTANT_SUPPORT // If defined, use AMQTT and select Tools -> IwIP Variant -> Higher Bandwidth
#define ENABLE_LEGACY_ANIMATIONS // Dont disbale this for now
#define ENABLE_E131              // E1.31 implementation
#define USE_HTML_MIN_GZ             //comment for using index.htm & edit.htm from SPIFFs instead of PROGMEM
//#define CUSTOM_WS2812FX_ANIMATIONS  //uncomment and put animations in "custom_ws2812fx_animations.h" 

#ifdef ENABLE_E131
  #define START_UNIVERSE 1                    // First DMX Universe to listen for
  #define END_UNIVERSE 2                      // Last Universe to listen for, starting at UNIVERSE
                                              // MUST: END_UNIVERSE >= START_UNIVERSE
#endif

//#define WIFIMGR_PORTAL_TIMEOUT 180
//#define WIFIMGR_SET_MANUAL_IP

#ifdef WIFIMGR_SET_MANUAL_IP
  uint8_t _ip[4] = {192,168,0,128};
  uint8_t _gw[4] = {192,168,0,1};
  uint8_t _sn[4] = {255,255,255,0};
#endif

#ifdef MQTT_HOME_ASSISTANT_SUPPORT
  #define MQTT_HOME_ASSISTANT_0_87_SUPPORT // Comment if using HA version < 0.87
#endif

#if defined(USE_WS2812FX_DMA) and defined(USE_WS2812FX_UART)
#error "Cant have both DMA and UART method."
#endif
#if defined(ENABLE_MQTT) and defined(ENABLE_AMQTT)
#error "Cant have both PubSubClient and AsyncMQTT enabled. Choose either one."
#endif
#if ( (defined(ENABLE_HOMEASSISTANT) and !defined(ENABLE_MQTT)) and (defined(ENABLE_HOMEASSISTANT) and !defined(ENABLE_AMQTT)) )
#error "To use HA, you have to either enable PubCubClient or AsyncMQTT"
#endif
#if ( !defined(ENABLE_HOMEASSISTANT) and defined(MQTT_HOME_ASSISTANT_SUPPORT) )
#error "To use HA support, you have to either enable Homeassistant component"
#endif

// parameters for automatically cycling favorite patterns
uint32_t autoParams[][4] = {  // color, speed, mode, duration (milliseconds)
  {0xff0000, 200,  1,  5000}, // blink red for 5 seconds
  {0x00ff00, 200,  3, 10000}, // wipe green for 10 seconds
  {0x0000ff, 200, 14,  5000}, // dual scan blue for 5 seconds
  {0x0000ff, 200, 45, 15000}  // fireworks for 15 seconds
};

#if defined(ENABLE_MQTT) or defined(ENABLE_AMQTT)

  const char mqtt_will_topic[] = HOSTNAME "/status";
  const char mqtt_will_payload[] = "ONLINE";
  const char mqtt_intopic[] = HOSTNAME "/in";
  const char mqtt_outtopic[] = HOSTNAME "/out";

  #ifdef ENABLE_MQTT
    #define MQTT_MAX_PACKET_SIZE 512
    #define MQTT_MAX_RECONNECT_TRIES 4

    int mqtt_reconnect_retries = 0;
    uint8_t qossub = 0; // PubSubClient can sub qos 0 or 1
  #endif

  #ifdef ENABLE_AMQTT
    uint8_t qossub = 0; // AMQTT can sub qos 0 or 1 or 2
    uint8_t qospub = 0; // AMQTT can pub qos 0 or 1 or 2
  #endif

  #ifdef ENABLE_HOMEASSISTANT
    const char mqtt_ha_state_in[] = "home/" HOSTNAME "_ha/state/in";
    const char mqtt_ha_state_out[] = "home/" HOSTNAME "_ha/state/out";

    const char* on_cmd = "ON";
    const char* off_cmd = "OFF";
    bool stateOn = false;
    bool animation_on = false;
    bool new_ha_mqtt_msg = false;
    uint16_t color_temp = 327; // min is 154 and max is 500
  #endif

  //#define ENABLE_MQTT_HOSTNAME_CHIPID          // Uncomment/comment to add ESPChipID to end of MQTT hostname
  #ifdef ENABLE_MQTT_HOSTNAME_CHIPID
    char mqtt_clientid[64];
  #else
    const char mqtt_clientid[] = HOSTNAME;
  #endif

  char mqtt_host[64] = "";
  char mqtt_port[6] = "";
  char mqtt_user[32] = "";
  char mqtt_pass[32] = "";
#endif


// ***************************************************************************
// Global variables / definitions
// ***************************************************************************
#define DBG_OUTPUT_PORT Serial  // Set debug output port

// List of all color modes
#ifdef ENABLE_LEGACY_ANIMATIONS
  #ifdef ENABLE_E131
    enum MODE { SET_MODE, HOLD, OFF, SETCOLOR, SETSPEED, BRIGHTNESS, WIPE, RAINBOW, RAINBOWCYCLE, THEATERCHASE, TWINKLERANDOM, THEATERCHASERAINBOW, TV, CUSTOM, E131 };
  #else
    enum MODE { SET_MODE, HOLD, OFF, SETCOLOR, SETSPEED, BRIGHTNESS, WIPE, RAINBOW, RAINBOWCYCLE, THEATERCHASE, TWINKLERANDOM, THEATERCHASERAINBOW, TV, CUSTOM };
  #endif
  MODE mode = RAINBOW;         // Standard mode that is active when software starts
  bool exit_func = false;      // Global helper variable to get out of the color modes when mode changes
#else
  enum MODE { SET_MODE, HOLD, OFF, SETCOLOR, SETSPEED, BRIGHTNESS, CUSTOM };
  MODE mode = SET_MODE;        // Standard mode that is active when software starts
#endif

MODE prevmode = mode;

int ws2812fx_speed = 196;   // Global variable for storing the delay between color changes --> smaller == faster
int brightness = 196;       // Global variable for storing the brightness (255 == 100%)

int ws2812fx_mode = 0;      // Helper variable to set WS2812FX modes

bool shouldSaveConfig = false;  // For WiFiManger custom config

struct ledstate             // Data structure to store a state of a single led
{
  uint8_t red;
  uint8_t green;
  uint8_t blue;
};

typedef struct ledstate LEDState;     // Define the datatype LEDState
LEDState ledstates[NUMLEDS];          // Get an array of led states to store the state of the whole strip
LEDState main_color = { 255, 0, 0 };  // Store the "main color" of the strip used in single color modes

#define ENABLE_STATE_SAVE_SPIFFS        // If defined, saves state on SPIFFS
//#define ENABLE_STATE_SAVE_EEPROM        // If defined, save state on reboot
#ifdef ENABLE_STATE_SAVE_EEPROM
  char current_state[32];               // Keeps the current state representation
  char last_state[32];                  // Save the last state as string representation
  unsigned long time_statechange = 0;   // Time when the state last changed
  int timeout_statechange_save = 5000;  // Timeout in ms to wait before state is saved
  bool state_save_requested = false;    // State has to be saved after timeout
#endif
#ifdef ENABLE_STATE_SAVE_SPIFFS
  bool updateStateFS = false;
#endif

// Button handling
#ifdef ENABLE_BUTTON
  #define BTN_MODE_SHORT "STA| 1|  0|245|196|255|255|255"   // Static white
  #define BTN_MODE_MEDIUM "STA| 1| 48|245|196|255|102|  0"    // Fire flicker
  #define BTN_MODE_LONG "STA| 1| 46|253|196|255|102|  0"  // Fireworks random

  unsigned long keyPrevMillis = 0;
  const unsigned long keySampleIntervalMs = 25;
  byte longKeyPressCountMax = 80;       // 80 * 25 = 2000 ms
  byte mediumKeyPressCountMin = 20;     // 20 * 25 = 500 ms
  byte KeyPressCount = 0;
  byte prevKeyState = HIGH;             // button is active low
  boolean buttonState = false;
#endif
@debsahu
Copy link
Collaborator

debsahu commented Mar 10, 2019

Could you decrypt the stack? https://github.com/me-no-dev/EspExceptionDecoder

@debsahu
Copy link
Collaborator

debsahu commented Mar 10, 2019

index.html is already packed in gzip form, so no need to upload anymore you can comment //#define USE_HTML_MIN_GZ to use uploaded index.html file in SPIFFs.

@scordal
Copy link
Author

scordal commented Mar 10, 2019

Hi Debsahu:

I did what you ask to comment the line and the stack results are:
Decoding stack results

0x40100220: millis at D:\Users\PC\Documents\ArduinoData\packages\esp8266\hardware\esp8266\2.5.0\cores\esp8266\core_esp8266_wiring.c line 183
0x40223a04: WS2812FX::mode_static() at D:\Users\PC\Documents\Arduino\libraries\WS2812FX-master\src\WS2812FX.cpp line 527
0x402236b4: WS2812FX::service() at d:\users\pc\documents\arduinodata\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-3-20ed2b9\xtensa-lx106-elf\include\c++\4.8.2\bits/stl_algobase.h line 222
0x40223629: WS2812FX::show() at D:\Users\PC\Documents\Arduino\libraries\WS2812FX-master\src\WS2812FX.cpp line 131
0x402104ed: loop() at D:\Users\PC\Downloads\McLighting-master\Arduino\McLighting/McLighting.ino line 1293
0x40228ac4: loop_wrapper() at D:\Users\PC\Documents\ArduinoData\packages\esp8266\hardware\esp8266\2.5.0\cores\esp8266\core_esp8266_main.cpp line 125

If I unpower and power the device, its connects and disconnects continuosly.
Stack results:

Decoding stack results
0x40100220: millis at D:\Users\PC\Documents\ArduinoData\packages\esp8266\hardware\esp8266\2.5.0\cores\esp8266\core_esp8266_wiring.c line 183
0x40223a04: WS2812FX::mode_static() at D:\Users\PC\Documents\Arduino\libraries\WS2812FX-master\src\WS2812FX.cpp line 527
0x402236b4: WS2812FX::service() at d:\users\pc\documents\arduinodata\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-3-20ed2b9\xtensa-lx106-elf\include\c++\4.8.2\bits/stl_algobase.h line 222
0x40223629: WS2812FX::show() at D:\Users\PC\Documents\Arduino\libraries\WS2812FX-master\src\WS2812FX.cpp line 131
0x402104ed: loop() at D:\Users\PC\Downloads\McLighting-master\Arduino\McLighting/McLighting.ino line 1293
0x40228ac4: loop_wrapper() at D:\Users\PC\Documents\ArduinoData\packages\esp8266\hardware\esp8266\2.5.0\cores\esp8266\core_esp8266_main.cpp line 125

@debsahu
Copy link
Collaborator

debsahu commented Mar 10, 2019

That looks like #309 Let me test this.

If you have flexibility in wiring, could you

  • use RX/GPIO3 pin and uncomment #define USE_WS2812FX_DMA
    OR
  • use D4/GPIO2 and uncomment #define USE_WS2812FX_UART1

These are DMA or UART hardware based method (exploits) that do a better job at shifting large number of RGB data.

@scordal
Copy link
Author

scordal commented Mar 10, 2019

Thanks. I could go thru all the steps now, I used the configuration with D4/GPIO2, I rewired but when I connect the light strip I got only a few led lit in white and 4 in blue.
I wonder what I did wrong

@scordal
Copy link
Author

scordal commented Mar 10, 2019

I tested al scenarios you proposed with no luck:

  • use RX/GPIO3 pin and uncomment #define USE_WS2812FX_DMA: did not work, the led strip lits a few leds in White and 6 in blue.
  • use D4/GPIO2 and uncomment #define USE_WS2812FX_UART1: lits all leds in White and nothing else.
  • using D5/gpio14 the unit restarts, and it disconnects from internet.

I give up for today, I will continue some other time. Thanks for your help.

@scordal
Copy link
Author

scordal commented Mar 10, 2019

Just for your reference I use a ws2811 led strip and a level shifter from the output to the DIN of the level strip.

@debsahu
Copy link
Collaborator

debsahu commented Mar 10, 2019

You have common ground? Could you share your wiring?

@Deinjo
Copy link

Deinjo commented Mar 15, 2019

Hello,

i have setup the project today, too.
Now I have completely the same issue with the same stack result (same module, same order, same rows)

i have also tested the scenarios above with the same results.

@debsahu
Copy link
Collaborator

debsahu commented Mar 16, 2019

@Deinjo Please share wiring, I'm not able to produce the error on empty esp8266 (no LEDs). Erase flash and upload sketch at (slow) 115200 baud speed.

@scordal
Copy link
Author

scordal commented Mar 23, 2019

debsahU.I made itr work, though I changed the wiring toi a different pin. I realized I was having problema with my Wifi that is saturated with many Wifi Connections and therefore did not start.

@HiranChaudhuri
Copy link

HiranChaudhuri commented Apr 15, 2019

My Wemos D1 mini would also continually reset itself after I entered WIFI configuration.
Then I installed an MQTT broker (Apache ActiveMQ-Artemis), and entered this information together with the WIFI configuration.

Now the device no longer resets. I can see in ActiveMQ that a queue has been created.
But I can neither access the device's homepage, nor the upload page.

Edit: Seems I am wrong. When I pressed the Wemos D1 mini builtin button (expecting to reset the device) the system started a steady reboot pattern again. But then on the console I saw some confirmation and ultimately an error message:

*WM: AutoConnect
*WM: Connecting as wifi client...
*WM: Using last saved values, should be faster
*WM: Connection result:
*WM: 3
*WM: IP Address:
*WM: 192.168.178.42
SaveConfig is False!
WiFiManager config FS Save failure!
connected...yeey :)
MQTT active: 192.168.178.52:1883
Open http://192.168.178.42/ to open McLighting.
Use http://McLighting01.local/ when you have Bonjour installed.
New users: Open http://192.168.178.42/upload to upload the webpages first.

E1.31 mode setup complete.
Couldn't find "/stripstate.json"
Failure!

So now I need to find out why stripstate.json is not found.

@debsahu
Copy link
Collaborator

debsahu commented Apr 15, 2019

Are you using the develop version? Of not please do as most of the reset issue is resolved there.

@HiranChaudhuri
Copy link

The constant restarts and the missing stripstate.json file seemed not connected.
I finally got rid of the restarts by turning off a lot of definitions in definitions.h (and thus reducing functionality). Once the controller was stable, I managed to upload index.htm which now gives me the control as demonstrated in the video.

As soon as I enable MQTT the system again gets unstable. AMQTT does not compile for me at all, I may still need to find some of the dependencies.

@HiranChaudhuri
Copy link

HiranChaudhuri commented Apr 15, 2019

Are you using the develop version? Of not please do as most of the reset issue is resolved there.

This is what I will have to track better now. Right now I just wanted to get it going. Now that I realize McLightning combines a wealth of libraries I will look into what I installed, and how. Also I want to check how hard it is to enhance the color wheel. My Hue lights not only pick color but also saturation.

But so far this controller looks superior to a number of others that I tested.

@HiranChaudhuri
Copy link

So I made a lot of functions work now. Compiled the cloned master branch with all the latest libraries that were available. It seems McLighting works like a charm, and I found only one feature (home assistant autodiscovery) to not work. Documentation of what I did is available on request.

I will open a separate issue for the autodiscovery part.

@toblum toblum closed this as completed Jul 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants