Skip to content

Commit 5795c93

Browse files
committed
Merge branch 'main' into bidirectional-web-editor
2 parents a1e6cb3 + e6671c6 commit 5795c93

File tree

3 files changed

+20
-9
lines changed

3 files changed

+20
-9
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ if flashing from a Mac] -- Ubuntu doesn't have a good kernel for Pi 5)
6060
If no `folk` user, then:
6161

6262
sudo useradd -m folk; sudo passwd folk;
63+
64+
After creating `folk` user, then:
65+
6366
for group in adm dialout cdrom sudo audio video plugdev games users input tty render netdev lpadmin gpio i2c spi; do sudo usermod -a -G $group folk; done; groups folk
6467

6568
1. `sudo apt update`

virtual-programs/calibrate/calibrate.folk

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -487,22 +487,26 @@ Wish the web server handles route "/calibrate$" with handler [list apply {{UNIT_
487487
});
488488

489489
function advanceCamera() {
490-
cameraFrame.src = cameraFrame.src + '0'
490+
cameraFrame.src = '/camera-frame?' + Math.random()
491491
}
492492
</script>
493493

494494
<p>Use this camera preview to debug why printed and/or projected tags aren't being recognized (maybe overexposure, maybe your camera isn't in a good position): <button id="refreshButton" onclick="advanceCamera()">Refresh Preview</button> <input type="checkbox" value="true" id="auto-refresh-checkbox" checked>
495-
<label for="auto-refresh-checkbox">Automatically refresh preview (May not work well during calibration)</label> </p><br> <img src="/camera-frame?0" id="cameraFrame" style="max-width: 100%">
495+
<label for="auto-refresh-checkbox">Automatically refresh preview</label> </p><br> <img src="/camera-frame" id="cameraFrame" style="max-width: 100%">
496496

497497
<script>
498498
const refreshButton = document.getElementById('refreshButton');
499499
const autoRefreshCheckbox = document.getElementById('auto-refresh-checkbox');
500-
setInterval(() => {
501-
if (autoRefreshCheckbox.checked) {
502-
refreshButton.click()
503-
}
504-
console.log("checked?", autoRefreshCheckbox.checked)
505-
}, 100)
500+
cameraFrame.addEventListener('load', () => {
501+
if (autoRefreshCheckbox.checked) {
502+
advanceCamera();
503+
}
504+
});
505+
autoRefreshCheckbox.addEventListener('change', () => {
506+
if (autoRefreshCheckbox.checked) {
507+
advanceCamera();
508+
}
509+
});
506510
</script>
507511

508512

virtual-programs/camera-usb.folk

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,11 @@ When /someone/ wishes $::thisNode uses camera /cameraPath/ with /...options/ {
349349
set camera [Camera::new $cameraPath $width $height $bufferCount]
350350

351351
# TODO: report actual width and height from v4l2
352-
Claim camera $cameraPath has width $width height $height
352+
if {[info exists crop]} {
353+
Claim camera $cameraPath has width [dict get $crop width] height [dict get $crop height]
354+
} else {
355+
Claim camera $cameraPath has width $width height $height
356+
}
353357

354358
puts "camera-usb: $cameraPath ($options) (tid [getTid]) booted at [clock milliseconds]"
355359

0 commit comments

Comments
 (0)