Wish the web server handles route "/setup" with nav "" handler { html [subst { Folk setup

Folk setup

Displays

[HtmlWhen $::thisNode has display /display/ with /...opts/ { HtmlWhen the collected results for \ [list /someone/ wishes $::thisNode uses display $display with /...usingOpts/] \ are /results/ { set isUsingDisplay $([llength $results] >= 1) if {$isUsingDisplay} { set usingOpts [dict get [lindex $results 0] usingOpts] } set info [dict get $opts info] set displayName [dict get $info name] set modesByRegion [dict create] foreach mode [dict getdef $info modes [list]] { dict lappend modesByRegion $mode(visibleRegion) $mode } set regions [lsort -decreasing -integer -index 0 \ [dict keys $modesByRegion]] set displayId [string map {/ _} $display] subst {
[if {[llength $regions] > 0} { subst {
Select mode: [join [lmap region $regions { lassign $region width height set refreshRates [lmap mode [dict get $modesByRegion $region] \ {dict get $mode refreshRate}] set refreshRates [lsort -decreasing -integer $refreshRates] subst {
${width}x${height} [join [lmap refreshRate $refreshRates { subst { } }] \n]
} }] \n]
} }]
} }}]

Cameras

[HtmlWhen $::thisNode has camera /camera/ with /...opts/ { HtmlWhen the collected results for \ [list /someone/ wishes $::thisNode uses camera $camera with /...usingOpts/] \ are /results/ { set isUsingCamera $([llength $results] >= 1) if {$isUsingCamera} { set usingOpts [dict get [lindex $results 0] usingOpts] } set resolutions [list] foreach format [dict get $opts formats] { # For now, we only support MJPG. The more raw formats are # rarely used by cameras at even medium resolutions and # framerates, anyway, so it's only worth supporting MJPG. if {$format(fourcc) eq "MJPG"} { lappend resolutions {*}$format(resolutions) } } set resolutions [lsort -command {apply {{a b} { expr {[dict get $b width] - [dict get $a width]} }}} $resolutions] if {[llength $resolutions] == 0} { # Cameras often have extra camera devices with no formats (or no # MJPG, at least) for some reason. Not very useful for us. subst {
$camera ([dict getdef $opts card ""])
(no supported formats)
} } else { set cameraId [string map {/ _} $camera] subst {
Select resolution: [join [lmap resolution $resolutions { subst {
${resolution(width)}x${resolution(height)} [join [lmap framerate $resolution(framerates) { subst { } }] \n]
} }] \n]
[if {$isUsingCamera} { set iframeWidth 600 set iframeHeight [expr {int(600.0 * $usingOpts(height) / $usingOpts(width))}] subst {
} }]
} } }}]

Projector-camera calibration

Select one display and one or more cameras to calibrate:

Display (projector) [HtmlWhen /someone/ wishes $::thisNode uses display /display/ with /...opts/ { subst {
} }]
Cameras [HtmlWhen /someone/ wishes $::thisNode uses camera /camera/ with /...opts/ { subst {
} }]
}] }