newsletters:2025-08
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
newsletters:2025-08 [2025/09/01 01:31] – [Folk gadget] osnr | newsletters:2025-08 [2025/09/01 01:46] (current) – [folk2 on the gadget] osnr | ||
---|---|---|---|
Line 67: | Line 67: | ||
If you're familiar with folk2, you might anticipate blinking problems here, because there' | If you're familiar with folk2, you might anticipate blinking problems here, because there' | ||
- | {{newsletters: | + | {{:newsletters: |
Line 206: | Line 206: | ||
=== Fasteners === | === Fasteners === | ||
- | Spent some time looking into fasteners to try to keep the AnyBeam projector from swiveling/ | + | Spent some time looking into fasteners to try to keep the AnyBeam projector from swiveling/ |
+ | I got some threadlocker glue, and these washers, which I haven' | ||
+ | |||
+ | {{: | ||
=== folk2 on the gadget === | === folk2 on the gadget === | ||
+ | folk2 is a surprisingly nice improvement for the gadget. The text is scaled to be a constant real-world size no matter where you hold the gadget, and the whole critical path of Folk runs faster, so even on this mediocre calibration, | ||
+ | {{: | ||
+ | It's hacky and not 100% correct, but to give you an idea of the differences, | ||
+ | |||
+ | < | ||
+ | < | ||
+ | < | ||
+ | # Copy this file to ~/ | ||
+ | # changes. | ||
+ | |||
+ | if {[llength [info commands Assert!]] == 0} { | ||
+ | # We're on folk1. | ||
+ | proc Assert! args { tailcall Assert {*}$args } | ||
+ | |||
+ | set fd [open |[list python3 "/ | ||
+ | fconfigure $fd -buffering line | ||
+ | fileevent $fd readable [list apply {{fd} { | ||
+ | if {[gets $fd line] < 0} { | ||
+ | if {[eof $fd]} { | ||
+ | close $fd | ||
+ | } | ||
+ | } | ||
+ | |||
+ | if {[regexp {Percent: | ||
+ | Hold battery {Claim the battery percentage is $percent} | ||
+ | } | ||
+ | }} $fd] | ||
+ | |||
+ | When display /disp/ has width /w/ height /h/ { | ||
+ | When the button is /state/ { | ||
+ | When the clock time is /t/ { | ||
+ | set color [expr {$state eq " | ||
+ | Wish to draw a dashed stroke with points \ | ||
+ | [list [list 0 0] \ | ||
+ | [list $w 0] \ | ||
+ | [list $w $h] \ | ||
+ | [list 0 $h] \ | ||
+ | [list 0 0]] \ | ||
+ | color $color width 10 dashlength 40 dashoffset [expr {fmod($t, 10)*-120}] | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | set cc [c create] | ||
+ | $cc include < | ||
+ | $cc proc gpioInit {} void { | ||
+ | // gpio mode 16 up | ||
+ | FOLK_ENSURE(wiringPiSetup() != -1); | ||
+ | pinMode(16, INPUT); | ||
+ | pullUpDnControl(16, | ||
+ | } | ||
+ | $cc proc gpioRead {} int { | ||
+ | // gpio read 16 | ||
+ | return digitalRead(16); | ||
+ | } | ||
+ | |||
+ | c loadlib / | ||
+ | $cc compile | ||
+ | exec sudo chmod 666 /dev/mem | ||
+ | |||
+ | gpioInit | ||
+ | When the clock time is /t/ { | ||
+ | set pressed [expr {![gpioRead]}] | ||
+ | Hold button \ | ||
+ | {Claim the button is [expr {$pressed ? " | ||
+ | } | ||
+ | puts stderr READY! | ||
+ | |||
+ | } else { | ||
+ | # We're on folk2. | ||
+ | |||
+ | exec v4l2-ctl --set-ctrl auto_exposure=1 | ||
+ | exec v4l2-ctl --set-ctrl exposure_time_absolute=1500 | ||
+ | |||
+ | When { | ||
+ | set fd [open |[list python3 "/ | ||
+ | fconfigure $fd -buffering line | ||
+ | while {[gets $fd line] >= 0} { | ||
+ | if {[eof $fd]} { | ||
+ | close $fd | ||
+ | } | ||
+ | |||
+ | if {[regexp {Percent: | ||
+ | Hold! -key battery \ | ||
+ | Claim the battery percentage is $percent | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | When display /disp/ has width /w/ height /h/ { | ||
+ | When the button is /state/ { | ||
+ | When the clock time is /t/ { | ||
+ | set color [expr {$state eq " | ||
+ | Wish (keep 10ms) to draw a dashed line with points \ | ||
+ | [list [list -1 -1] \ | ||
+ | [list 1 -1] \ | ||
+ | [list 1 1] \ | ||
+ | [list -1 1] \ | ||
+ | [list -1 -1]] \ | ||
+ | color $color width 0.05 dashlength 0.1 dashoffset [expr {fmod($t, 10)*-0.4}] | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | set cc [C] | ||
+ | $cc include < | ||
+ | $cc proc gpioInit {} void { | ||
+ | // gpio mode 16 up | ||
+ | FOLK_ENSURE(wiringPiSetup() != -1); | ||
+ | pinMode(16, INPUT); | ||
+ | pullUpDnControl(16, | ||
+ | } | ||
+ | $cc proc gpioRead {} int { | ||
+ | // gpio read 16 | ||
+ | return digitalRead(16); | ||
+ | } | ||
+ | |||
+ | $cc endcflags -L/ | ||
+ | set gpioLib [$cc compile] | ||
+ | exec sudo chmod 666 /dev/mem | ||
+ | |||
+ | $gpioLib gpioInit | ||
+ | When the clock time is /t/ { | ||
+ | set pressed [expr {![$gpioLib gpioRead]}] | ||
+ | Hold! -key button \ | ||
+ | Claim the button is [expr {$pressed ? " | ||
+ | } | ||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | Assert! $this wishes $::thisNode uses camera "/ | ||
+ | width 3200 height 1200 \ | ||
+ | crop {x 500 y 0 width 1000 height 800} | ||
+ | |||
+ | Assert! $this wishes $::thisNode uses display 0 | ||
+ | |||
+ | |||
+ | When the battery percentage is /percent/ { | ||
+ | Wish to draw text with text " | ||
+ | } | ||
+ | </ | ||
+ | </ | ||
==== Mason' | ==== Mason' | ||
- | Mason has been working on a proposal for a type system in Folk, for things like pixels, percentages, | + | Mason has been [[https:// |
+ | {{newsletters: | ||
==== Projects ==== | ==== Projects ==== | ||
- | * Rob Fielding created a full-fledged system for presenting slides that are fully controlled by programs in Folk: | + | * Rob Fielding |
* {{youtube> | * {{youtube> | ||
newsletters/2025-08.1756690310.txt.gz · Last modified: 2025/09/01 01:31 by osnr