bitcraze / crazyflie-firmware

The main firmware for the Crazyflie Nano Quadcopter, Crazyflie Bolt Quadcopter and Roadrunner Positioning Tag.
GNU General Public License v3.0
1.19k stars 1.06k forks source link

Failed to modify the default effect of LED-ring deck #1360

Closed LIU-Xueming closed 6 months ago

LIU-Xueming commented 7 months ago

Hi, the default effect of LED-ring deck is ID: 6 (double spinner ). Now, i tried to add a new effect, named solidYellowEffect(), and set it to the default effect. But it failed, and I need some help.

  1. First, the static function is add in the file src/deck/drivers/src/ledring12.c
static void solidYellowEffect(uint8_t buffer[][3], bool reset)
{
  int i;

  if (reset)
  {
    for (i=0; i<CONFIG_DECK_LEDRING_NBR_LEDS; i++) {
      buffer[i][0] = 255;
      buffer[i][1] = 255;
      buffer[i][2] = 0;
    }
  }
}
  1. Then, this effect is added in the structure

    Ledring12Effect effectsFct[] =
    {
    blackEffect,
    whiteSpinEffect,
    colorSpinEffect,
    tiltEffect,
    brightnessEffect,
    spinEffect2,
    **_doubleSpinEffect,_**
    solidColorEffect,
    ledTestEffect,
    batteryChargeEffect,
    boatEffect,
    siren,
    gravityLight,
    virtualMemEffect,
    fadeColorEffect,
    rssiEffect,
    locSrvStatus,
    timeMemEffect,
    lighthouseEffect,
    
    **_solidYellowEffect,_**
    };
  2. Next, I modify the src/deck/drivers/src/Kconfig

    config DECK_LEDRING_DEFAULT_EFFECT
    int "Default light effect to use on the LED ring"
    depends on DECK_LEDRING
    default 19
    help
        Index of the default light effect that the LED ring should use
        after boot. Use zero to turn off the LEDs when booting. For more
        information about the LED ring effects see the parameter documentation
        on https://www.bitcraze.io/
  1. At last, I compiled and flashed the firmware follow the document https://www.bitcraze.io/documentation/repository/crazyflie-firmware/master/building-and-flashing/build/

However, after reboot, the default LED effect is still double spinner, e.g. ID:6.

If, I replace serial number in the structure, e.g.

Ledring12Effect effectsFct[] =
{
  blackEffect,
  whiteSpinEffect,
  colorSpinEffect,
  tiltEffect,
  brightnessEffect,
  spinEffect2,

  **_solidYellowEffect_**,

  **_doubleSpinEffect_**,
  solidColorEffect,
  ledTestEffect,
  batteryChargeEffect,
  boatEffect,
  siren,
  gravityLight,
  virtualMemEffect,
  fadeColorEffect,
  rssiEffect,
  locSrvStatus,
  timeMemEffect,
  lighthouseEffect,
};

The default LED effect changed as solidYellowEffect.

Thus, I guess there maybe somewhere in the file I also need to modify the default options, but I didn't find it. Can you help me see what the problem is? Thanks!

knmcguire commented 7 months ago

Ah thanks for reporting this! we'll need to find time to recreate this. I hope it is not blocking yo0u too much at the moment?

LIU-Xueming commented 7 months ago

Ah thanks for reporting this! we'll need to find time to recreate this. I hope it is not blocking yo0u too much at the moment?

Hi, thanks for your reply. I recently found an interesting problem. In fact, I bought crazyflie twice, over half a year apart.

Some crazyflies had the problem above. But others do not have these problems. Maybe this information can help someone.

ToveRumar commented 7 months ago

Hi!

Interesting issue. This looks indeed like some board discrepancy. I have not been able to reproduce the issue myself so far.

Could you tell me approximately how many of the boards you have purchased has this problem? Was the boards with this issue purchased at the same time?

ToveRumar commented 6 months ago

Hi @LIU-Xueming!

Since this looks like a board issue, could you please come back either by email or by starting a new issue if this is a problem for you.

I'm closing this issue for now since we can not reproduce with the current information.