| Author |
Message |
davids45

Joined: 26 Nov 2006 Posts: 580 Location: Chatswood, NSW
|
Posted: Sun 15 Aug 2010, 00:20 Post subject:
|
|
G'day 01micko,
| Quote: | | Hey davids45... see what you started |
Well, I did want this for an 'el cheapo' start clock - a fully blown beeping+LED start clock (Norwegian - G'day zigbert) is costing my orienteering club over AU$3000 by the time we get it through our customs.
.
I'm hoping to give the 'el cheapo' a try this Wednesday at some night orienteering in Chatswood (Lowanna Park, 7-8pm). A discount will be offered for any Puppy Linux users, and free use of our First Aid kit .
And thanks for everyone's interest and input.
David S.
|
|
Back to top
|
|
 |
01micko

Joined: 11 Oct 2008 Posts: 7017 Location: qld
|
Posted: Sun 15 Aug 2010, 00:32 Post subject:
|
|
| Quote: | | I'm hoping to give the 'el cheapo' a try this Wednesday at some night orienteering in Chatswood (Lowanna Park, 7-8pm). A discount will be offered for any Puppy Linux users, and free use of our First Aid kit |
bit far for me mate, but maybe cthisbear or jamesbond can make it.
Cheers
_________________ keep the faith .. 
|
|
Back to top
|
|
 |
zigbert

Joined: 29 Mar 2006 Posts: 5240 Location: Valåmoen, Norway
|
Posted: Sun 15 Aug 2010, 02:48 Post subject:
|
|
| davids45 wrote: | | a fully blown beeping+LED start clock (Norwegian - G'day zigbert) is costing my orienteering club over AU$3000 by the time we get it through our customs. | Sounds like a reasonable price......after all it's not more than we have to pay for 1 kg marinated kangaroo meat
| davids45 wrote: | I'm hoping to give the 'el cheapo' a try this Wednesday at some night orienteering in Chatswood (Lowanna Park, 7-8pm). A discount will be offered for any Puppy Linux users, and free use of our First Aid kit .
| I would really like to come.......
I have Germany on my agenda this year. - But Australia.......sounds like a dream to me.
Sigmund
_________________ Stardust resources
|
|
Back to top
|
|
 |
Béèm

Joined: 21 Nov 2006 Posts: 11782 Location: Brussels IBM Thinkpad R40, 256MB, 20GB, WiFi ipw2100. Frugal Lin'N'Win
|
Posted: Sun 15 Aug 2010, 04:51 Post subject:
|
|
| 01micko wrote: | Béèm
Did you be sure to add -a option to the shebang?
Have fun!
Cheers | Well I took the script where you told davids45 'there has been an update 20 minutes ago' and there was no -a in it.
I now took your latest and it's working.
Now I think the next question from people would be to start this clock when the screen locks.
_________________ Time savers:
Find packages in a snap and install using Puppy Package Manager (Menu).
Consult Wikka
Use peppyy's puppysearch
|
|
Back to top
|
|
 |
ken geometrics
Joined: 23 Jan 2009 Posts: 76 Location: California
|
Posted: Sun 15 Aug 2010, 13:38 Post subject:
|
|
| 01micko wrote: | Would you like a config gui with that? Perhaps sound choice, colour choice?
|
The bell function did not work on my PC. Here is a replacement that does work but is less than ideal. I was going to make it phase lock the delay timing to get exactly onto the minutes roll over but I had an attack of the lazies.
It dings on the minute roll over plus just a smidge. It also doesn't loop every 0.5 seconds while waiting. It does some math to work out the delay that is needed then does that delay.
| Code: |
function BELL (){
PREVDING="`date +%M`"
until [ -f /tmp/killclock ] ; do
THISDING="`date +%M`"
THISTICK="`date +%S`"
THISTICK=`expr 60 - $THISTICK`
if [ "$THISDING" != "$PREVDING" ] ; then
aplay $NOISE
PREVDING="$THISDING"
fi
sleep ${THISTICK}.3
done
}
|
|
|
Back to top
|
|
 |
abushcrafter

Joined: 30 Oct 2009 Posts: 1447 Location: England
|
Posted: Mon 16 Aug 2010, 10:10 Post subject:
Update |
|
Sorry Haven't Applied the lupu yaf-splash bug fix. I don't have the time at the moment. I also don't use lupu currently. in version 0.4 and 0.5 (This one.) I added the exit command at the end of each function. Are they need?
| Code: | #!/bin/sh -a
#ChangeLog
#2010-08-14 Alexander S.T. Ross (abushcrafter) <http://www.google.com/recaptcha/mailhide/d?k=01uNeUuXxeNm9FA3Zciuoqzw==&c=nVfKeb7kjqZVVIQanqJwEC2DP5zrALkSERTopYvj_pU=>
# * Version=0.4
# * Applied zigbert's proper full screen clock code.
# * I also got rid of the kill sound button so when you click on the yaf-splash clock to close it kills the sound with it.
#2010-08-16 Alexander S.T. Ross (abushcrafter) <http://www.google.com/recaptcha/mailhide/d?k=01uNeUuXxeNm9FA3Zciuoqzw==&c=nVfKeb7kjqZVVIQanqJwEC2DP5zrALkSERTopYvj_pU=>
# * Version=0.5
# * Applied ken geometrics rewritten Bell function.
# * Changed "echo "Finished. Will Now Exit."" to "echo "Exited"".
rm -f /tmp/killclock
if [ -f $HOME/.bigclockrc ];then . $HOME/.bigclockrc
fi
HEIGHT=`xwininfo -root | grep -m 1 '\geometry' | cut -f4 -d ' ' | cut -f2 -d 'x' | cut -f1 -d '+'`
WIDTH=`xwininfo -root | grep -m 1 '\geometry' | cut -f4 -d ' ' | cut -f1 -d 'x'`
SIZE=$((HEIGHT/44*10))
function YAF (){
echo BG="\"$BG\"" >$HOME/.bigclockrc
echo FG="\"$FG\"" >>$HOME/.bigclockrc
echo NOISE="\"$NOISE\"" >>$HOME/.bigclockrc
yaf-splash -font "-misc-dejavu sans-bold-r-normal--$SIZE-0-0-0-p-0-iso10646-1" -geometry ${WIDTH}x${HEIGHT} -bg $BG -fg $FG -outline 0 -clock
echo "" > /tmp/killclock &
exit
}
function BELL (){
PREVDING="`date +%M`"
until [ -f /tmp/killclock ] ; do
THISDING="`date +%M`"
THISTICK="`date +%S`"
THISTICK=`expr 60 - $THISTICK`
if [ "$THISDING" != "$PREVDING" ] ; then
aplay $NOISE
PREVDING="$THISDING"
fi
sleep ${THISTICK}.3
done
rm -v -f /tmp/killclock
echo ""
echo "Exited"
exit
}
function KILLCLOCKGUI (){
kill `ps|grep "clockgui"|awk '{print $1}'`
exit
}
clockgui="
<vbox>
<hbox>
<text><label>Enter a colour for background</label></text>
<entry>
<variable>BG</variable>
<input>echo \"$BG\"</input>
</entry>
</hbox>
<hbox>
<text><label>Enter a colour for foreground</label></text>
<entry>
<variable>FG</variable>
<input>echo \"$FG\"</input>
</entry>
</hbox>
<hbox>
<text><label>Enter the path to a sound</label></text>
<entry>
<variable>NOISE</variable>
<input>echo $NOISE</input>
</entry>
</hbox>
<hbox>
<button>
<label>Sound</label>
<input file stock=\"gtk-directory\"></input>
<action>exec rox /usr/share/audio &</action>
</button>
<button>
<label>Colour</label>
<input file stock=\"gtk-select-color\"></input>
<action>exec gcolor2 &</action>
</button>
<button>
<label>Go!</label>
<input file stock=\"gtk-yes\"></input>
<action>YAF &</action>
<action>BELL &</action>
<action>KILLCLOCKGUI &</action>
</button>
</hbox>
</vbox>"
gtkdialog3 -p clockgui
unset clockgui
|
_________________ adobe flash is rubbish!
My Quote:"Humans are stupid, though some are clever but stupid." http://www.dependent.de/media/audio/mp3/System_Syn_Heres_to_You.zip http://www.systemsyn.com/
|
|
Back to top
|
|
 |
davids45

Joined: 26 Nov 2006 Posts: 580 Location: Chatswood, NSW
|
Posted: Fri 10 Dec 2010, 19:54 Post subject:
A working START clock Subject description: using Puppy and a lap-top |
|
G'day again,
I've slowly been playing with this idea to set up a lap-top as a beeping starting clock for sporting activities like orienteering and time trial races where individual starts are spaced apart at regular intervals (e.g every minute).
The commercial clocks cost several thousand dollars/euros but Puppy on an old lap-top with a reasonable sound system would be a good alternative for the un-rich.
Thanks to all those earlier in this thread who provided scripts for such a beeping digital clock concept.
By trial & error script butchery, I added a second beeping sound into the options so that now the clock gives shorts beeps for the five seconds leading up to the whole minute whereupon a longer different pitch beep is played. In my experience, this is exactly to way the commercial clocks operate.
Precise synchronising of the beep sound with the display was a bit tricky (setting the sleep value so the beep sounded precisely as the seconds display changed). This may have something to do with the length of the beep and the particular computer's hardware.
The battery life or cell-number of the lap-top is important if the clock has to run for a couple of hours away from any mains or back-up power (inverter, generator).
Anyway, here is my current script. Please suggest any improvements.
| Code: | #!/bin/sh -a
YAFSPLASH="/usr/X11R7/bin/yaf-splash"
rm -f /tmp/killclock
if [ -f $HOME/.bigclockrc ];then . $HOME/.bigclockrc
fi
HEIGHT=`xwininfo -root | grep -m 1 '\geometry' | cut -f4 -d ' ' | cut -f2 -d 'x' | cut -f1 -d '+'`
WIDTH=`xwininfo -root | grep -m 1 '\geometry' | cut -f4 -d ' ' | cut -f1 -d 'x'`
SIZE=$((HEIGHT/5))
SIZE=`expr $HEIGHT / 4`
if [ $RATIO -gt 140 ]; then
MARGINGET=`expr $HEIGHT \* 1`
MARGIN=`expr $MARGINGET / 3`
else MARGIN=20
fi
function YAF (){
echo BG="\"$BG\"" >$HOME/.bigclockrc
echo FG="\"$FG\"" >>$HOME/.bigclockrc
echo NOISE="\"$NOISE\"" >>$HOME/.bigclockrc
echo START="\"$START\"" >>$HOME/.bigclockrc
$YAFSPLASH -font "-misc-dejavu sans-bold-r-normal--$SIZE-0-0-0-p-0-iso10646-1" -bg $BG -fg $FG -outline 0 -clock -geometry $((WIDTH+PLACEMENT_X))x$((HEIGHT+PLACEMENT_Y))+0+0
#$YAFSPLASH -font "-misc-dejavu sans-bold-r-normal--$SIZE-0-0-0-p-0-iso10646-1" -margin $MARGIN -bg $BG -fg $FG -outline 0 -clock
}
function BELL (){
#ZEROTIME=`date +%T|cut -d ':' -f3`
until [ -f /tmp/killclock ]
do
if [ "`date +%T|cut -d ':' -f3`" = "00" ];then aplay $START ; sleep 0.75 ;fi
if [ "`date +%T|cut -d ':' -f3`" = "59" ];then aplay $NOISE ; sleep 0.75 ;fi
if [ "`date +%T|cut -d ':' -f3`" = "58" ];then aplay $NOISE ; sleep 0.75 ;fi
if [ "`date +%T|cut -d ':' -f3`" = "57" ];then aplay $NOISE ; sleep 0.75 ;fi
if [ "`date +%T|cut -d ':' -f3`" = "56" ];then aplay $NOISE ; sleep 0.75 ;fi
if [ "`date +%T|cut -d ':' -f3`" = "55" ];then aplay $NOISE ; sleep 0.75 ;fi
# sleep 0.75
# sleep time seems critical in synchronising display with beeps - could depend on length of beep?
# could add intermediate warning sounds or speech file, say at 30 and 20 seconds to go? Wish I had a working microphone.
done
}
function KILLSWITCH (){
kill `ps|grep "clockgui"|awk '{print $1}'`
export killswitch='
<window decorated="false">
<vbox>
<hbox>
<button>
<label>KILLSWITCH</label>
<input file>/usr/share/doc/puppylogo96.png</input>
<action>echo "" > /tmp/killclock &</action>
<action>exit:Exit</action>
</button>
</hbox>
</vbox>
</window>'
gtkdialog3 -p killswitch
unset killswitch
}
clockgui="
<vbox>
<hbox>
<text><label>Enter a colour for background</label></text>
<entry>
<variable>BG</variable>
<input>echo \"$BG\"</input>
</entry>
</hbox>
<hbox>
<text><label>Enter a colour for foreground</label></text>
<entry>
<variable>FG</variable>
<input>echo \"$FG\"</input>
</entry>
</hbox>
<hbox>
<text><label>Enter the path to a short sound</label></text>
<entry>
<variable>NOISE</variable>
<input>echo $NOISE</input>
</entry>
</hbox>
<hbox>
<text><label>Enter the path to the START sound</label></text>
<entry>
<variable>START</variable>
<input>echo $START</input>
</entry>
</hbox>
<hbox>
<button>
<label>Sound</label>
<input file stock=\"gtk-directory\"></input>
<action>exec rox /usr/share/audio &</action>
</button>
<button>
<label>Colour</label>
<input file stock=\"gtk-select-color\"></input>
<action>exec gcolor2 &</action>
</button>
<button>
<label>Go!</label>
<input file stock=\"gtk-yes\"></input>
<action>YAF &</action>
<action>BELL &</action>
<action>KILLSWITCH &</action>
</button>
</hbox>
</vbox>"
gtkdialog3 -p clockgui
unset clockgui |
Thanks again to all those who contributed.
David S.
|
|
Back to top
|
|
 |
01micko

Joined: 11 Oct 2008 Posts: 7017 Location: qld
|
Posted: Fri 10 Dec 2010, 20:08 Post subject:
|
|
David...
I wonder what would happen if you forked the $NOISE calls ie, add '&' on each call...
I'll let you experiment
Cheers
_________________ keep the faith .. 
|
|
Back to top
|
|
 |
abushcrafter

Joined: 30 Oct 2009 Posts: 1447 Location: England
|
Posted: Sun 19 Dec 2010, 11:52 Post subject:
|
|
| 01micko wrote: | David...
I wonder what would happen if you forked the $NOISE calls ie, add '&' on each call...
I'll let you experiment
Cheers | That does not work. You end up with all the sounds being played at the next min.
I really would love the feature of being able to set multiple sounds to be played for every specified amount of times. E.G for every 3 sec play alarm or for each 1/2 hour play a piece of audio and for every 10 secs play a piece audio. Hopefully you get the idea.
_________________ adobe flash is rubbish!
My Quote:"Humans are stupid, though some are clever but stupid." http://www.dependent.de/media/audio/mp3/System_Syn_Heres_to_You.zip http://www.systemsyn.com/
|
|
Back to top
|
|
 |
npierce
Joined: 28 Dec 2009 Posts: 622
|
Posted: Mon 03 Jan 2011, 22:47 Post subject:
|
|
| davids45 wrote: | | Precise synchronising of the beep sound with the display was a bit tricky . . . |
| davids45 wrote: | | . . . Anyway, here is my current script. Please suggest any improvements. |
The key thing to remember is that you don't want it to beep whenever the seconds count is 55 (or 56, 57, etc.). You want it to just beep when the seconds count becomes 55 (or 56, 57, etc.).
You are testing for 55, so if aplay takes less than a second to make the beep, the seconds count will still be 55 when it finishes, so if it tests for 55 again it will beep again.
To avoid multiple beeps you have put the script to sleep for a fraction of a second. But, as you have discovered, if that fraction is too short, you get an extra beep, and if it is too long you delay the beep for the next second.
So it is a race. Which will happen first? Will the clock tick to the next second, or will the script awaken from its sleep?
(Perhaps it is fitting that there is a race condition in a script used to time races.)
I would suggest wrapping your tests in another if/fi that only executes when the second count changes. To do so add these two lines after the do in the BELL() function:
| Code: | NOW=`date +%T|cut -d ':' -f3`
if [ "$NOW" != "$THEN" ] ; then |
And add these two lines just before the done:
You can now eliminate the calls to sleep. And since you now have $NOW, you can use it in place of `date +%T|cut -d ':' -f3` in your tests.
That should keep the beeps in sync without the need to fine tune a sleep value. But I have one more suggestion.
The script now spends most of its time polling the clock. It does this as often as it can. Except for the six times you put it to sleep, it is running at full-tilt, which is putting a big load on the system. It is likely that your laptop's fan comes on often when you run the script.
If you give it a vacation of, say, 0.05 seconds each time through the loop, it should run cooler. So you could add this line just before done:
(If you wanted to get fancy, you could write something in C that would wait for the next second to arrive, and call it from your script instead of sleep, but calling sleep should be adequate for your needs.)
So now your BELL() function will look something like this:
| Code: | function BELL (){
until [ -f /tmp/killclock ]
do
NOW=`date +%T|cut -d ':' -f3`
if [ "$NOW" != "$THEN" ] ; then
if [ "$NOW" = "00" ];then aplay $START ; fi
if [ "$NOW" = "59" ];then aplay $NOISE ; fi
if [ "$NOW" = "58" ];then aplay $NOISE ; fi
if [ "$NOW" = "57" ];then aplay $NOISE ; fi
if [ "$NOW" = "56" ];then aplay $NOISE ; fi
if [ "$NOW" = "55" ];then aplay $NOISE ; fi
fi
THEN=$NOW
sleep 0.05
done
} |
| davids45 wrote: | | The battery life or cell-number of the lap-top is important if the clock has to run for a couple of hours away from any mains or back-up power (inverter, generator). |
Good point. And you should find that the little sleep 0.05 vacations added above will cause the script to drain your battery more slowly than previously.
|
|
Back to top
|
|
 |
abushcrafter

Joined: 30 Oct 2009 Posts: 1447 Location: England
|
Posted: Mon 24 Jan 2011, 14:15 Post subject:
|
|
@npierce That does not work also.
_________________ adobe flash is rubbish!
My Quote:"Humans are stupid, though some are clever but stupid." http://www.dependent.de/media/audio/mp3/System_Syn_Heres_to_You.zip http://www.systemsyn.com/
|
|
Back to top
|
|
 |
davids45

Joined: 26 Nov 2006 Posts: 580 Location: Chatswood, NSW
|
Posted: Mon 24 Jan 2011, 19:27 Post subject:
|
|
G'day abushcrafter,
npierce's modification worked well for me, in giving good beep and display synchronicity.
I just cut and pasted his code into the script over the older section.
David S.
|
|
Back to top
|
|
 |
davids45

Joined: 26 Nov 2006 Posts: 580 Location: Chatswood, NSW
|
Posted: Tue 15 Feb 2011, 22:08 Post subject:
FatDog - sound but no display |
|
G'day,
Just had a successful beeping clock use, sending off individually about 200 Sydney-siders to orienteer around the Sydney suburb of Dundas. Being daylight, the major problem was the high reflectivity of the laptop screen - a black numbers on white background had best visibility. But most people just waited for the on-the-minute long beep as the signal to start.
I was using Wary 5.0 via a Windows Installer v1.1 inside a Windows 7 partition.
In playing with putting other Pups onto the laptop, I installed FatDog-5.10 which runs very well on the 64bit laptop.
However, when I run the beeping clock script, I get no full-screen clock display, just the small "Killbutton". The sound is working as the beeps occur at the required times.
Is there someway to get this script to display in 64bit FatDog?
Thanks.
David S.
|
|
Back to top
|
|
 |
abushcrafter

Joined: 30 Oct 2009 Posts: 1447 Location: England
|
Posted: Wed 23 Feb 2011, 20:23 Post subject:
|
|
I worked out my confusion and have done some work on it and put it into a PET .
| Code: | #ChangeLog --------------------------------------------------------------------
# 2011/02/22 22:53:17 abushcrafter Email=http://www.google.com/recaptcha/mailhide/d?k=01uNeUuXxeNm9FA3Zciuoqzw==&c=nVfKeb7kjqZVVIQanqJwEC2DP5zrALkSERTopYvj_pU=
# * 0.9: Uses a different font for clock because previous one was squashed in the 5 series of Puppy GNU/Linux.
# * 0.9: Added sounds for every 10 secs.
# * 0.9: Sound player is set by "defaultsoundplayer". However it has been overrider by a function for this reason: "Mplayer does not work well for the last 5 secs with a sound for each sec of a min, if the sounds are more than 1 sec long.".
# * 0.9: No longer kills the setup GUI. It now closes properly.
# * 0.9: Added window title.
# * 0.9: Added cancel button.
# * 0.9: Removed kill sound button.
# * 0.9: Improved full-screen.
# * 0.9: Added comments like a changelog at the top of this script.
# * 0.9: Tweaked Setup GUI text. |
For the icon in the menu to work. You need to add a some paths to a XML config file.
Strings to add: | Code: | <IconPath>/usr/share/icons</IconPath>
<IconPath>/usr/share/icons/locolor/16x16/apps</IconPath>
<IconPath>/usr/share/icons/locolor/48x48/apps</IconPath>
<IconPath>/usr/share/icons/hicolor/16x16/apps</IconPath>
<IconPath>/usr/share/icons/hicolor/48x48/apps</IconPath> |
XML config file to add string to: | Code: | | /etc/xdg/templates/_root_.jwmrc |
The section you need to add it to:
| Code: | <!-- <Icons> -->
<!-- <IconPath>$HOME/.icons</IconPath> -->
<IconPath>/usr/local/lib/X11/mini-icons</IconPath>
<IconPath>/usr/local/lib/X11/pixmaps</IconPath>
<IconPath>/usr/share/pixmaps</IconPath>
<IconPath>/usr/local/share/pixmaps</IconPath>
<!-- </Icons> --> |
The results you are aiming for:
| Code: | <!-- <Icons> -->
<!-- <IconPath>$HOME/.icons</IconPath> -->
<IconPath>/usr/local/lib/X11/mini-icons</IconPath>
<IconPath>/usr/local/lib/X11/pixmaps</IconPath>
<IconPath>/usr/local/share/pixmaps</IconPath>
<IconPath>/usr/share/pixmaps</IconPath>
<IconPath>/usr/share/icons</IconPath>
<IconPath>/usr/share/icons/locolor/16x16/apps</IconPath>
<IconPath>/usr/share/icons/locolor/48x48/apps</IconPath>
<IconPath>/usr/share/icons/hicolor/16x16/apps</IconPath>
<IconPath>/usr/share/icons/hicolor/48x48/apps</IconPath>
<!-- </Icons> --> |
| Description |
|

Download |
| Filename |
FullScreenClockWithAlarm-0.9.pet |
| Filesize |
3.26 KB |
| Downloaded |
145 Time(s) |
_________________ adobe flash is rubbish!
My Quote:"Humans are stupid, though some are clever but stupid." http://www.dependent.de/media/audio/mp3/System_Syn_Heres_to_You.zip http://www.systemsyn.com/
|
|
Back to top
|
|
 |
|