Skip to content

NaN appears when changing volume menu item #30

Description

@grahamwhaley

It has been reported, and I think I have seen, that changing the sgtl5000 headphone volume via the Volume menu item can show a 'NaN' error (Not-a-Number), which can then hang up and require a reboot.

I think this happens due to some sort of 'race'/sequence issue when first starting up with a blank eeprom. I have a feeling we then boot and load the default values into the RAM based settings, but then still try to load the volume setting from the eeprom, probably thus loading 0xffffffff into a float value, which then comes out as a NaN.

The quick fix is to do a 'factory reset' from the menu system. This then writes the default values to the eeprom, and from then on the volume value loading should work and the NaN problem 'goes away'.

The proper solution is either to:

  • not load the volume value from the eeprom if the eeprom does not contain valid data (bad eeprom signature)
  • potentially, write the default values to the eeprom on startup if no valid eeprom signature is found. This is a little destructive though, and may require a menu prompt to ask the user if they want the eeprom initialised, which might be a little tricky to code up.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions