-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Add Pin Info page #5361
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
Merged
+327
−3
Merged
Add Pin Info page #5361
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
fb46770
Add pin manager feature with serializePins() API and UI
Copilot 3be3b13
Address code review feedback: improve readability and polling interval
Copilot 583b508
Remove accidentally committed codeql symlink
Copilot 1609269
Address feedback: show button types, only allocated pins, remove HIGH…
Copilot adf9ba9
Fix pin display: show available pins, fix touch button state, add Mul…
Copilot 8237c66
Fix touch button state display: add fallback for non-touch-capable pi…
Copilot a075d6b
Fix touch button state display: add fallback for button-owned pins no…
Copilot a697e6a
Use usermod names from controller, consolidate JS for smaller flash size
Copilot 2a0aa2c
Move Pin Manager UI to separate settings_pins.htm page, remove from i…
Copilot b926ab5
Use isButtonPressed() from button.cpp and simplify pin capabilities d…
Copilot 5bd7e03
Use existing s.js?p=2 for touch capability, extend appendGPIOinfo()
Copilot c887379
Fix button handling for new Button struct vector API
Copilot 31155a1
Fix ESP8266 GPIO17, add touch raw value (right-shift on S2/S3)
Copilot eaabd5e
major improvements of the AI code, cleanup
DedeHai 1e7c8b9
omit ADC2 pins as analog, fixed some pin definitions on ESP8266
DedeHai ee983d9
rename to pininfo, rename booloader to flash boot
DedeHai 11f93e5
Move pin owner name lookup to firmware, pass as string in JSON
Copilot 8689b5b
Revert button type lookup to UI, keep only owner lookup in firmware
Copilot e357fb4
cleanup AI slack, minor improvements to UI, add sequential resource l…
DedeHai 4f97755
fix rabbit suggestions
DedeHai 227d539
rename and bugfix
DedeHai 815b557
add analog button raw value display
DedeHai 8396135
minor fixes
DedeHai 73e9fd6
fix indentation, explicit ESP32 #ifdef, remove A0 for ESP8266 as not …
DedeHai 634d30f
update comment about ESP8266 A0 deficiency
DedeHai dfd540c
moved pin capabilities to pinmanager
DedeHai 9cad9d3
Merge branch 'main' into pinInfo
DedeHai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="utf-8"> | ||
| <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport"> | ||
| <title>Pin Info</title> | ||
| <script> | ||
| // load common.js with retry on error | ||
| (function loadFiles() { | ||
| const l = document.createElement('script'); | ||
| l.src = 'common.js'; | ||
| l.onload = () => loadResources(['style.css'], S); // load style.css then call S() | ||
| l.onerror = () => setTimeout(loadFiles, 100); | ||
| document.head.appendChild(l); | ||
| })(); | ||
| var pinsTimer=null, gpioInfo={}; | ||
| function S() { | ||
| getLoc(); | ||
| loadJS(getURL('/settings/s.js?p=11'), false, ()=>{ | ||
| d.um_p = []; | ||
| d.rsvd = []; | ||
| d.ro_gpio = []; | ||
| d.max_gpio = 50; | ||
| d.touch = []; | ||
| }, ()=>{ | ||
| // Load extended GPIO info and start pin polling | ||
| loadPins(); | ||
| pinsTimer = setInterval(loadPins, 250); | ||
| }); | ||
| } | ||
|
|
||
| function B(){window.open(getURL('/settings'),'_self');} // back button | ||
|
|
||
| function getOwnerName(o,t,n) { | ||
| // Use firmware-provided name if available | ||
| if(n) return n; | ||
| if(!o) return "System"; // no owner provided | ||
| if(o===0x85){ return getBtnTypeName(t); } // button pin | ||
| return "UM #"+o; | ||
| } | ||
| function getBtnTypeName(t) { | ||
| var n=["None","Reserved","Push","Push Inv","Switch","PIR","Touch","Analog","Analog Inv","Touch Switch"]; | ||
| var label = n[t] || "?"; | ||
| return 'Button <span style="font-size:10px;color:#888">'+label+'</span>'; | ||
| } | ||
| function getCaps(p,c) { | ||
| var r=[]; | ||
| // Use touch info from settings endpoint | ||
| if(d.touch && d.touch.includes(p)) r.push("Touch"); | ||
| if(d.ro_gpio && d.ro_gpio.includes(p)) r.push("Input Only"); | ||
| // Use other caps from JSON (Analog, Boot, Input Only) | ||
| if(c&0x02) r.push("Analog"); | ||
| if(c&0x08) r.push("Flash Boot"); | ||
| if(c&0x10) r.push("Bootstrap"); | ||
| return r.length?r.join(", "):"-"; | ||
| } | ||
| function loadPins() { | ||
| fetch(getURL('/json/pins'),{method:'get'}) | ||
| .then(r=>r.json()) | ||
| .then(j=>{ | ||
| var cn="",pins=j.pins||[]; | ||
| if(!pins.length) { | ||
| cn="No pins available."; | ||
| }else{ | ||
| cn='<table><tr><th>Pin</th><th>Used by</th><th>Pin Notes</th></tr>'; | ||
| for(var p of pins){ | ||
| var st=""; // button state indicator | ||
| var rv=""; // raw value (touch / analog) | ||
| if(typeof p.s!=='undefined'){ | ||
| st='<span class="bs" style="background:'+(p.s?'#0B4':'#666')+'"></span> '; // button state dot, gray=off, green=on | ||
| if(typeof p.r!=='undefined') rv=' <span class="rv">'+p.r+'</span>'; // add raw touch reading if available | ||
| } | ||
| var ow=p.a?getOwnerName(p.o, p.t, p.n):(d.um_p && d.um_p.includes(p.p)) ? "Usermod":'<span style="color:#08d">Available</span>'; | ||
| //if(typeof p.u!=='undefined')ow+=p.u?' (PU)':' (No PU)'; | ||
| cn+='<tr><td>GPIO'+p.p+'</td><td>'+st+ow+rv+'</td><td>'+getCaps(p.p,p.c||0)+'</td></tr>'; | ||
| } | ||
| cn+='</table>'; | ||
| } | ||
| gId('pins').innerHTML=cn; | ||
| }) | ||
| .catch(e=>{gId('pins').innerHTML='Error loading pin info';}); | ||
| } | ||
| </script> | ||
| <style> | ||
| body{text-align:center;background:#222;margin:auto;padding:10px;max-width: 550px} | ||
| table{width:100%;border-collapse:collapse;margin:10px 0;font-size:14px;border-radius:6px;overflow:hidden;} | ||
| th,td{padding:8px;border:3px solid #444;color:#fff} | ||
| th{background:#444} | ||
| tr:nth-child(even){background:#222} | ||
| tr:nth-child(odd){background:#111} | ||
| .bs{display:inline-block;width:14px;height:14px;border-radius:50%} /* button state dot */ | ||
| .rv{display:inline-block;font-size:10px;color:#888;min-width:6ch;text-align:right;} /* raw value (touch / analog) */ | ||
| </style> | ||
| </head> | ||
| <body> | ||
| <button type="button" onclick="B()">Back</button> | ||
| <h2>Pin Info</h2> | ||
| <div id="pins">Loading...</div> | ||
| <button type="button" onclick="B()">Back</button> | ||
| </body> | ||
| </html> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.