-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Remove bus type restrictions and add reboot handling for LED settings #4964
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: DedeHai <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix this.
wled00/data/settings_leds.htm
Outdated
function checkBusChanges() { | ||
// check if bus configuration has changed | ||
let buses = d.Sf.querySelectorAll("#mLC select[name^=LT]"); | ||
let currentBusCount = buses.length; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is redundant, if bus count increases, the below check for value will catch it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the redundant bus count check. The bus type comparison now catches both type changes and additions/removals. Fixed in commit 7dba246.
wled00/data/settings_leds.htm
Outdated
|
||
// check if any bus type changed | ||
for (let i = 0; i < buses.length; i++) { | ||
if (parseInt(buses[i].value) != originalBusTypes[i]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exempt virtual and network buses
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added exemption for virtual and network buses using isVir() and isNet() functions. These buses are hardware-independent and don't require reboot. Fixed in commit 7dba246.
wled00/data/settings_leds.htm
Outdated
// check for bus changes that require reboot | ||
checkBusChanges(); | ||
if (busChanged) { | ||
var msg = "LED hardware configuration changed. A reboot is required for changes to take effect.\n\nDo you want to continue and reboot after saving?"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shorten the string but keep the meaning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shortened the confirmation message to "LED hardware changed. Reboot required to apply changes.\n\nContinue and reboot after saving?" while keeping the meaning clear. Fixed in commit 7dba246.
@copilot please fix the review comments. |
…tual/network buses, shorten dialog message Co-authored-by: DedeHai <[email protected]>
@copilot originalBusCount is now unused |
Co-authored-by: DedeHai <[email protected]>
Fixed Bus Type Change Restrictions with Reboot Handling
Successfully implemented the solution to allow bus type changes while prompting for reboot instead of restricting them, with all reviewer feedback addressed.
Changes Completed:
settings_leds.htm
to removes.disabled = true
for non-last busesbusChanged
,originalBusTypes
captureInitialBusState()
andcheckBusChanges()
functionscheckBusChanges()
is called when:onchange="checkBusChanges();UI(true)"
addLEDs()
function modificationtrySubmit()
to show confirmation dialog whenbusChanged=true
RBT
parameter handling inset.cpp
forSUBPAGE_LEDS
originalBusCount
variableTechnical Details:
Frontend Changes (
settings_leds.htm
):if (i < LTs.length-1) s.disabled = true;
restrictionoriginalBusCount
)RBT=1
field when reboot is requiredBackend Changes (
set.cpp
):if (request->hasArg(F("RBT"))) doReboot = true;
inSUBPAGE_LEDS
User Experience:
This resolves the confusing restriction behavior and provides a user-friendly approach to handling hardware changes that require reboot, with improved logic and clean code structure based on all reviewer feedback.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.