1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

SOLVED first led always on with arduino

Discussion in 'Software Support' started by NeeeeB, 2 January 2021.

  1. NeeeeB

    NeeeeB Active Member

    Messages:
    237
    Hardware:
    RPi3, +Arduino, +nodeMCU/ESP8266
  2. NeeeeB

    NeeeeB Active Member

    Messages:
    237
    Hardware:
    RPi3, +Arduino, +nodeMCU/ESP8266
    Well, after some examination I wonder if there is not something missing in this if statement, line 142 of the sketch :

    PHP:
    int ledCount MAX_LEDS;
    if (
    ANALOG_MODE == ANALOG_MODE_LAST_LED) {
       
    ledCount--;
    }
    Shouldn't it be :
    PHP:
    int ledCount MAX_LEDS;
    if 
    ANALOG_OUTPUT_ENABLED == true && ANALOG_MODE == ANALOG_MODE_LAST_LED {
       
    ledCount--;
    }
    Because even if I'm not using Analog mode, number of leds is reduced by 1...
     
  3. Lord-Grey

    Lord-Grey Moderator Staff Member Developer

    Messages:
    389
    Hardware:
    RPi3, 32/64bit
    That sounds reasonable.
     
  4. NeeeeB

    NeeeeB Active Member

    Messages:
    237
    Hardware:
    RPi3, +Arduino, +nodeMCU/ESP8266
    I'm gonna try my updated version as soon as possible (I've changed a bit the "boot" animation too).
    I made a mistake in my previous statement, it is the last led that is always white (my strip is counter clockwise).
     
  5. Lord-Grey

    Lord-Grey Moderator Staff Member Developer

    Messages:
    389
    Hardware:
    RPi3, 32/64bit
    I also recognised that with adalight the last LED was always off.
    I need to update my arduino and might test too....
     
    • Like Like x 1
  6. NeeeeB

    NeeeeB Active Member

    Messages:
    237
    Hardware:
    RPi3, +Arduino, +nodeMCU/ESP8266
    Ok that works, but I've had to put the if condition in a compiler directive otherwise I had a weird error...
    (Expected identifier before numeric constant) = sorry Old Delphi dev here, not used to the C++ syntax

    PHP:
    #if ANALOG_OUTPUT_ENABLED == true && ANALOG_MODE == ANALOG_MODE_LAST_LED
        
    ledCount--;
      
    #endif
     
  7. Lord-Grey

    Lord-Grey Moderator Staff Member Developer

    Messages:
    389
    Hardware:
    RPi3, 32/64bit
    You do

    Code:
      int ledCount = MAX_LEDS;
    
      if (ANALOG_OUTPUT_ENABLED == true && ANALOG_MODE == ANALOG_MODE_LAST_LED) {
        ledCount--;
      }
     
    • Like Like x 1
  8. Lord-Grey

    Lord-Grey Moderator Staff Member Developer

    Messages:
    389
    Hardware:
    RPi3, 32/64bit
    I will check it in into the Hyperion Repository
     
    • Like Like x 1
  9. Lord-Grey

    Lord-Grey Moderator Staff Member Developer

    Messages:
    389
    Hardware:
    RPi3, 32/64bit
    • Like Like x 1
  10. NeeeeB

    NeeeeB Active Member

    Messages:
    237
    Hardware:
    RPi3, +Arduino, +nodeMCU/ESP8266
    Great, thanks.
    I'll modify my sketch to remove the compiler directive and use the proper syntax.
    Even if it works as is, I prefer clean things ^^
    PS: I tried with () on both members of the statement as I'm used to in Delphi but didn't think to wrap the entire statement...lol, old habits
     
  11. forkless

    forkless New Member

    Messages:
    1
    Hardware:
    +Arduino
    Thanks for this fix. Works like a charm!