Giter Site home page Giter Site logo

Comments (4)

algernon avatar algernon commented on May 30, 2024

I think I know why this happens, but I'm yet to verify it. We have this bit of code:

void SpaceCadetConfig::disableSpaceCadetIfUnconfigured() {
  if (Runtime.storage().isSliceUninitialized(settings_base_, sizeof(SpaceCadet::settings_)))
    ::SpaceCadet.disable();
}

It feels like this doesn't disable SpaceCadet. The function is getting called from the Model100's setup(), so the only way this can fail is if .isSliceUninitialized() returns false. Now why would it return false when we didn't touch any SpaceCadet configuration? Why would it return false only sometimes?

I believe the answer for that is sizeof(). SpaceCadet::settings_ is an uint8_t and an uint16_t. That's 3 bytes, but with padding, it's 4. So we end up checking one extra byte, and if that isn't 255, we will not disable SpaceCadet. Now, what comes after SpaceCadetConfig in the EEPROM layout in the Model 100 firmware? LEDPaletteTheme. If the first color in the palette is set to any color where the red component isn't 0, then that byte will trip the .isSliceUninitialized() setting over.

Unfortunately, SpaceCadet::settings_ does not appear in the size-map, so I'll have to check it some other way. But I'm fairly confident this is the case.

from chrysalis-firmware-bundle.

algernon avatar algernon commented on May 30, 2024

And indeed, sizeof(SpaceCadet::settings_) is 4... however, that is also the size we requested, so unfortunately this is a dead end.

from chrysalis-firmware-bundle.

algernon avatar algernon commented on May 30, 2024

Doing a factory reset and reconnecting with Chrysalis does not turn it on. Perhaps this is a remnant of the old corruption bug? If the eeprom is not properly cleared when upgrading from bad firmware to good, there's a very good chance that SpaceCadet would turn on.

from chrysalis-firmware-bundle.

algernon avatar algernon commented on May 30, 2024

Having looked at a number of cases where SpaceCadet ended up being turned on, I'm very confident that this is not a bug in SpaceCadetConfig, but a result of either corruption, or incomplete / missing storage layout migration, both of which are outside of the control of the plugin.

Closing.

from chrysalis-firmware-bundle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.