Skip to content

Conversation

@DedeHai
Copy link
Collaborator

@DedeHai DedeHai commented Oct 19, 2025

There are frequent questions on why the welcome page shows in AP or ETH mode. The current workaround is to change the wifi network name, which is not intuitive.
This PR adds a secondary condition: if the config backup exists, the welcome page is also skiped, meaning the config was saved at least once.
This can still be changed to an actual config parameter in the future if better control is needed.

Summary by CodeRabbit

  • New Features
    • Added configuration backup detection capability, allowing the system to check for existing backup files.
    • Modified welcome page behavior: no longer displayed when a configuration backup is present.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 19, 2025

Walkthrough

Two new backup verification functions are introduced: checkBackupExists() in file.cpp and configBackupExists() in cfg.cpp, with corresponding public declarations added to fcn_declare.h. The welcome page display logic in wled.cpp is modified to suppress the welcome page if a config backup exists.

Changes

Cohort / File(s) Summary
Backup checking utilities
wled00/file.cpp, wled00/cfg.cpp
Adds checkBackupExists(const char* filename) to verify backup file existence using the backup path format, and configBackupExists() to check for config backup existence via delegation.
Public API declarations
wled00/fcn_declare.h
Declares two new public functions: configBackupExists() and checkBackupExists(const char* filename) for external use.
Welcome page logic
wled00/wled.cpp
Modifies the welcome page display condition to additionally require configBackupExists() to be false before showing the welcome page.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • #4793: Introduces the backup/restore file utilities and configuration verification that these new functions extend and depend upon.

Suggested reviewers

  • netmindz
  • blazoncek

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title "Improvement to 'Welcome Page' check" accurately reflects the primary functional change in the changeset. The main modification is to the welcome page logic in wled00/wled.cpp, where a secondary condition has been added: if a config backup exists, the welcome page will be skipped. The supporting changes—the addition of helper functions to check backup existence—are secondary and serve to implement this core logic improvement. The title is clear, concise, and specific enough that a teammate scanning the project history would understand that the PR modifies how the welcome page check works.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ca5debe and 43eb2d6.

📒 Files selected for processing (4)
  • wled00/cfg.cpp (1 hunks)
  • wled00/fcn_declare.h (2 hunks)
  • wled00/file.cpp (1 hunks)
  • wled00/wled.cpp (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
wled00/**/*.cpp

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use 2-space indentation for C++ source files (.cpp)

Files:

  • wled00/cfg.cpp
  • wled00/file.cpp
  • wled00/wled.cpp
wled00/**/!(html_*)*.h

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use 2-space indentation for non-generated C++ header files (.h)

Files:

  • wled00/fcn_declare.h
🧬 Code graph analysis (3)
wled00/cfg.cpp (1)
wled00/file.cpp (2)
  • checkBackupExists (560-564)
  • checkBackupExists (560-560)
wled00/fcn_declare.h (2)
wled00/cfg.cpp (2)
  • configBackupExists (780-782)
  • configBackupExists (780-780)
wled00/file.cpp (2)
  • checkBackupExists (560-564)
  • checkBackupExists (560-560)
wled00/wled.cpp (1)
wled00/cfg.cpp (2)
  • configBackupExists (780-782)
  • configBackupExists (780-780)
🪛 Clang (14.0.6)
wled00/fcn_declare.h

[error] 30-30: unknown type name 'bool'

(clang-diagnostic-error)

🔇 Additional comments (5)
wled00/cfg.cpp (1)

780-782: LGTM! Clean wrapper function.

The implementation correctly delegates to checkBackupExists() and is appropriately placed alongside related config utility functions.

wled00/file.cpp (1)

560-564: LGTM! Consistent with existing backup functions.

The implementation correctly follows the established pattern from backupFile() and restoreFile(). Buffer size is adequate, and the logic is straightforward and side-effect-free.

wled00/fcn_declare.h (2)

30-30: LGTM! Declaration correctly placed and matches implementation.

The function declaration is properly located in the //cfg.cpp section and matches the implementation in cfg.cpp.

Note: The static analysis error about "unknown type name 'bool'" is a false positive. The bool type is standard in C++ and this header is included after the necessary standard headers in the implementation files.


107-107: LGTM! Declaration correctly placed and matches implementation.

The function declaration is properly located in the //file.cpp section and matches the implementation in file.cpp.

wled00/wled.cpp (1)

477-478: Logic correctly implements the stated objective—verified and approved.

The condition correctly suppresses the welcome page when a configuration backup exists, preventing the page from displaying during device resets or configuration upgrades. The implementation properly handles all scenarios:

  • First-time users (fresh install): default SSID + no backup → welcome page displays
  • Existing users (upgrade/reconnect): custom SSID OR backup exists → welcome page suppressed
  • Factory-reset users: default SSID + backup persists → welcome page suppressed (restoring user's prior config)

The checkBackupExists() function (file.cpp:560-564) correctly detects backup files via the /bkp.cfg.json naming convention. Indentation follows the 2-space requirement for C++ files.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@netmindz
Copy link
Member

I want to overhaul the whole onboarding process, but this is definitely an improvement until then

@netmindz netmindz merged commit b60313e into wled:main Oct 22, 2025
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants