Skip to content

Config: corrupted NVS JSON bricks the device in an infinite fatal loop #3

Description

@hurui200320

Found in whole-codebase review.

esp32/src/Config.cpp:

  1. Config::getSavedCameras() (~line 54): if the savedCameras JSON in NVS fails to parse, it calls NSG_LOG_FATAL, which loops forever printing the error. Since this is called from BleWorker::taskLoop at startup, a single corrupted NVS write permanently bricks normal mode until NVS is manually erased — with no recovery path and (on the WROOM board) nothing but serial output.
  2. Config::addToSavedCameras() (~line 106): the nvs.putString("savedCameras", ...) return value is ignored, so a truncated/failed write is never detected.

Proposal:

  • On JSON parse error: log the error, erase/reset the savedCameras key, and continue with an empty list instead of hanging.
  • Check the putString result and log on failure.

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