From c8eb9d8d0ff9d9d824682cf5cbac07b24778e114 Mon Sep 17 00:00:00 2001 From: Omar Rizwan Date: Fri, 29 Mar 2024 16:10:05 -0400 Subject: folk-live hacks: 1-1 default calibration, fault localhost->folk0. --- virtual-programs/programs.folk | 3 ++- virtual-programs/tags-and-calibration.folk | 17 +++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) (limited to 'virtual-programs') diff --git a/virtual-programs/programs.folk b/virtual-programs/programs.folk index 7c98632b..135299c7 100644 --- a/virtual-programs/programs.folk +++ b/virtual-programs/programs.folk @@ -8,8 +8,9 @@ When (non-capturing) /type/ /obj/ has a program { if {[file exists "$::env(HOME)/folk-printed-programs/$obj.folk.temp"]} { set fd [open "$::env(HOME)/folk-printed-programs/$obj.folk.temp" r] } else { + # HACK: localhost is folk-live for now. idk why. if {![file exists "$::env(HOME)/folk-printed-programs/$obj.folk"] && - ($::thisNode eq "folk-beads" || $::thisNode eq "folk-convivial")} { + ($::thisNode eq "folk-beads" || $::thisNode eq "folk-convivial" || $::thisNode eq "localhost")} { # HACK: 'Page fault' to folk0, try getting page from # there. Ideally we would have some general (Avahi?) # way of finding the 'authoritative' node on the local diff --git a/virtual-programs/tags-and-calibration.folk b/virtual-programs/tags-and-calibration.folk index dbe58f16..9c80772a 100644 --- a/virtual-programs/tags-and-calibration.folk +++ b/virtual-programs/tags-and-calibration.folk @@ -17,14 +17,8 @@ When the display /display/ has width /displayWidth/ height /displayHeight/ &\ puts "Evaluating calibration for $camera ($cameraWidth x $cameraHeight)" # camera (tag) point -> projection point # calibration for Hex - if [catch {source "/home/folk/generated-calibration.tcl"}] { - set points { - {622 404 1706 1051} - {624 650 1661 51} - {1031 669 8 44} - {1024 403 13 1146} - } - } else { + try { + source "/home/folk/generated-calibration.tcl" set points [list] foreach correspondence $generatedCalibration::points { lassign $correspondence cx cy dx dy @@ -33,6 +27,13 @@ When the display /display/ has width /displayWidth/ height /displayHeight/ &\ [expr {double($dx)/$generatedCalibration::displayWidth*$displayWidth}] \ [expr {double($dy)/$generatedCalibration::displayHeight*$displayHeight}]] } + } on error e { + set points [subst { + {0 0 0 0} + {$cameraWidth 0 $displayWidth 0} + {0 $cameraHeight 0 $displayHeight} + {$cameraWidth $cameraHeight $displayWidth $displayHeight} + }] } if {[llength $points] < 4} { puts stderr "tags-and-calibration: Calibration isn't valid (not enough points). Stopping Folk." -- cgit v1.2.3