View Single Post
Old 05-28-2019, 08:45 AM   #117
BloodRagg
Zealot
BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.BloodRagg ought to be getting tired of karma fortunes by now.
 
BloodRagg's Avatar
 
Posts: 128
Karma: 842196
Join Date: Feb 2019
Device: none
Proof of concept script

That was a nice little challenge but it works like a charm

Here is a proof of concept: (see attachment below)
Code:
#!/bin/sh
trap './fbink -cq' 0 1

IFS=$'\n;';export $(./fbink -c -qe);IFS=
./fbink -cqm -y1 "Testing '-E' flag by BloodRagg"

touched(){
  IFS=$'\n;';local $1;IFS=
  [ $ntxRotaQuirk -eq 1 ] && { x=$((screenHeight-x)) ; y=$((screenWidth-y));}
  [ $x -ge $lastRect_Left -a $x -le $(( lastRect_Left + lastRect_Width )) ] || return 1
  [ $y -ge $lastRect_Height -a $y -le $(( lastRect_Top  + lastRect_Height )) ] || return 1
  echo true;return 0
}

get_touch_event(){
  dd if=/dev/input/event1 count=2 2>/dev/null|\
   hexdump -ve '8/2 "%d " "\n"'|\
   awk '{if ($6==0 && $7!=0) {print "x="$7}};{if ($6==1) {print "y="$7}}'
}

ON=$(./fbink -E -x1 -M -S6 "ON")
OFF=$(./fbink -E -x-4 -M -S6 "OFF")
EXIT=$(./fbink -E -x-5 -y-2 -S6 "EXIT")

while true ;do
  eval $(get_touch_event)
  case true in
    $(touched $ON)) ./fbink -qg file=lamp_on.jpeg,halign=CENTER,valign=CENTER;;
    $(touched $OFF)) ./fbink -qg file=lamp_off.jpeg,halign=CENTER,valign=CENTER;;
    $(touched $EXIT)) exit;;
  esac
done
Attached Files
File Type: zip fbink_E-flag_script.zip (306.6 KB, 22 views)
BloodRagg is offline   Reply With Quote