Skip to content

Commit

Permalink
Bugfixes for terminating code and weather code generation
Browse files Browse the repository at this point in the history
  • Loading branch information
deckerego committed Jan 27, 2017
1 parent 60257b3 commit 3c877e3
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 34 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ I'm assuming that you are starting with the Raspian Minimal Linux distribution.
1. Make sure your Raspberry Pi is up to date with the latest packages & firmware with `sudo apt-get update; sudo apt-get dist-upgrade`
2. Enable I2C by executing `sudo raspi-config` as described in Adafruit's tutorial: https://learn.adafruit.com/adafruits-raspberry-pi-lesson-4-gpio-setup/configuring-i2c
3. Add the necessary Python and GStreamer dependencies using `sudo apt-get install wiringpi python-bottle python-setuptools python-pip python-dev python-dateutil python-smbus gstreamer0.10-x gstreamer-tools gstreamer0.10-plugins-base gstreamer0.10-plugins-good gstreamer0.10-plugins-bad python-gst0.10`
4. Install hack-clock via `wget https://github.com/deckerego/hack-clock/releases/download/2.0-BETA/python-hackclock_2.0-pre-1_all.deb; sudo dpkg -i python-hackclock_2.0-pre-1_all.deb`
4. Install hack-clock via `wget https://github.com/deckerego/hack-clock/releases/download/2.0-BETA/python-hackclock_2.0-pre-2_all.deb; sudo dpkg -i python-hackclock_2.0-pre-2_all.deb`
5. Tweak `/etc/hack-clock.conf` and `/etc/default/hack-clock` to fit your needs (GPIO pins, correct weather station, etc.). A list of observed weather stations is available at http://forecast.weather.gov/stations.php
6. Reboot your Pi to re-load modules and start the IDE web server

Expand Down
3 changes: 2 additions & 1 deletion debian/changelog
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
hackclock (2.0-pre-1) unstable; urgency=low
hackclock (2.0-pre-2) unstable; urgency=low

* I2C audio
* Raspberry Pi Zero support
* Programming by blocks (using Blockly)
* Multiple simultaneous buttons (input pins)
* Support for switches (output pins)
* Debian packaging for ease of installation
* Fixed bugs when re-starting terminating code

-- DeckerEgo <[email protected]> Tue, 24 Jan 2017 22:00:00 -0500
23 changes: 0 additions & 23 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,3 @@ Package: python-hackclock
Architecture: all
Depends: ${misc:Depends}, ${python:Depends}, ntp, python-bottle, wiringpi, python-setuptools, python-pip, python-dev, python-dateutil, python-smbus, gstreamer0.10-x, gstreamer-tools, gstreamer0.10-plugins-base, gstreamer0.10-plugins-good, gstreamer0.10-plugins-bad, python-gst0.10
Description: A hackable alarm clock for the Raspberry Pi
The Hackable Clock
==================
.
A hackable alarm clock, made for experimentation in order to build programming skills as well as the basics of circuit building.
.
Lessons and tutorials are currently a work-in-progress, however drafts are available at http://hackclock.deckerego.net/
.
.
Building the Hardware
---------------------
.
Step-by-step instructions for creating your clock are available at http://hackaday.io/project/3413-hack-ready-alarm-clock
.
A suggested list of hardware you might need to buy is saved as a wishlist at Adafruit: https://www.adafruit.com/wishlists/413935
.
Installation
------------
.
I'm assuming that you are starting with the Raspian Minimal Linux distribution. NOOBS or the like also works, but Raspian Minimal is small enough to fit on a 2GB microSD card. To install the hack-clock distribution on top of it:
.



6 changes: 3 additions & 3 deletions etc/init.d/hack-clock
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ do_start()
pip_check
gpio_init

start-stop-daemon --start --quiet --chdir $WEB_DIR --chuid $DAEMON_USER --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
start-stop-daemon --start --quiet --chdir $WEB_DIR --chuid $DAEMON_USER --make-pidfile --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
|| return 1
start-stop-daemon --background --start --quiet --chdir $WEB_DIR --chuid $DAEMON_USER --pidfile $PIDFILE --exec $DAEMON -- \
start-stop-daemon --background --start --quiet --chdir $WEB_DIR --chuid $DAEMON_USER --make-pidfile --pidfile $PIDFILE --exec $DAEMON -- \
$DAEMON_ARGS \
|| return 2
}
Expand All @@ -105,7 +105,7 @@ do_stop()
{
gpio_destroy

start-stop-daemon --stop --quiet --chdir $WEB_DIR --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
start-stop-daemon --stop --quiet --chdir $WEB_DIR --retry=TERM/30/KILL/5 --remove-pidfile --pidfile $PIDFILE --name $NAME
RETVAL="$?"
[ "$RETVAL" = 2 ] && return 2
start-stop-daemon --stop --quiet --oknodo --chdir $WEB_DIR --retry=0/30/KILL/5 --exec $DAEMON
Expand Down
2 changes: 1 addition & 1 deletion home/pi/hack-clock/lessons/5/blocks_clock.xml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<xml xmlns="http://www.w3.org/1999/xhtml"><block type="procedures_defnoreturn" id="Q:r]TyI-_k!Bd{^2kZ^|" x="29" y="-124"><field name="NAME">showCurrentTime</field><comment pinned="false" h="80" w="160">Describe this function...</comment><statement name="STACK"><block type="variables_set" id="AASS|_`eNq)!M[T)R;I}"><field name="VAR">Is Evening</field><value name="VALUE"><block type="logic_compare" id="4:@m^:jN-8716_qopLyy"><field name="OP">GT</field><value name="A"><block type="current_hour" id="/4CW/Hx+O=-q0`27e8/%"></block></value><value name="B"><block type="math_number" id="$1|6SjC,H$j8#XY/UZ}D"><field name="NUM">12</field></block></value></block></value><next><block type="set_display_hours" id="SMD!#?E~YIT-1?wVzUVD"><value name="display"><block type="led_display" id="6M^2{+[7-MsL7rbzG;]="></block></value><value name="hours"><block type="logic_ternary" id="N0P8.WU(`1R,#(6^o~e;"><value name="IF"><block type="variables_get" id="Zftqy$4g~vHRF}^[W}}r"><field name="VAR">Is Evening</field></block></value><value name="THEN"><block type="math_arithmetic" id="wgMgVfk]VD4U_wpeqIs$"><field name="OP">MINUS</field><value name="A"><block type="current_hour" id="i^S`B[oiTaHwh0GVUsAL"></block></value><value name="B"><block type="math_number" id="y83PFr|XI#t8wl/CIkJ9"><field name="NUM">12</field></block></value></block></value><value name="ELSE"><block type="current_hour" id=":zh8|shD=(BQdY#[zO1M"></block></value></block></value><next><block type="set_colon" id="ZU@i=glM5=c)8%`p-g6B"><value name="display"><block type="led_display" id="rwI.^ZP2)druh1QY@;Yc"></block></value><value name="enabled"><block type="logic_boolean" id="mv$:e@TXM~KoF(d%qIP-"><field name="BOOL">TRUE</field></block></value><next><block type="is_evening" id="V5@xea]yfOk:E`qvI2sH"><value name="display"><block type="led_display" id="S)s;OST=:vK0NgBOJ}W#"></block></value><value name="enabled"><block type="variables_get" id="[iV%55:IWUcHl6Umvs:X"><field name="VAR">Is Evening</field></block></value><next><block type="set_display_minutes" id="FW`:U6CbXWxc_D9vYl3T"><value name="display"><block type="led_display" id="5.Vlb-Oy,AM1c|Qdj?f2"></block></value><value name="minutes"><block type="current_minute" id="*W?bMT94PJ9Ce93UGZ9R"></block></value></block></next></block></next></block></next></block></next></block></statement></block><block type="clock_tick" id="!jJp=/!i9`e(6IX~`?_9" x="621" y="-128"><value name="clock"><block type="clock" id="_DhhGLuTN[UwwgA:QNX/"></block></value><statement name="on_tick_function"><block type="procedures_callnoreturn" id="mfd5?iV]0}!KUWq3X2in"><mutation name="showCurrentTime"></mutation></block></statement><next><block type="set_display_brightness" id="#NAJg|Bu}/K4#-;U@@.s"><field name="brightness">13</field><value name="display"><block type="led_display" id="omz/D*N+T4XEQ`|1Gc%;"></block></value></block></next></block><block type="procedures_defnoreturn" id="GLH[8S/lyPNnYxL.1|l^" x="29" y="192"><field name="NAME">playMusic</field><comment pinned="false" h="80" w="160">Play audio files through the speaker</comment><statement name="STACK"><block type="play_list" id="FAdbiNHO$f[[z+?9j(*i"><value name="speaker"><block type="speaker" id="|ezP#a2Ks@L]2?I.4atb"></block></value><value name="songs"><block type="lists_create_with" id="Zu.Jvi{Zy/Ik/WN/:6Hf"><mutation items="2"></mutation><value name="ADD0"><block type="AmicusMeus.ogg" id="i|Ubis^+FiTQxoG|=xM5"></block></value><value name="ADD1"><block type="TestTrack.ogg" id="i!+JY-!W18`uWyZ$l}+X"></block></value></block></value></block></statement></block><block type="clock_run_at" id="Eaw|zqK_9_ZZC|D,77wH" x="639" y="189"><value name="hour"><block type="math_number" id="ut+Qq7N!teM-s(^k23@/"><field name="NUM">8</field></block></value><value name="minute"><block type="math_number" id="|11d;-kaCUt`(uy|$W5@"><field name="NUM">30</field></block></value><value name="clock"><block type="clock" id="?fl.(w]+`knN_x4WvJ/Z"></block></value><statement name="at_time_function"><block type="procedures_callnoreturn" id="Tn_RVANezPTbVf8u^28)"><mutation name="playMusic"></mutation></block></statement></block><block type="procedures_defnoreturn" id="lAh0z]xL-jyfl)k^_|cL" x="44" y="344"><field name="NAME">switchWeatherStations</field><comment pinned="false" h="80" w="160">Describe this function...</comment><statement name="STACK"><block type="set_colon" id="UE$-oVKHZPJFcP;fHswG"><value name="display"><block type="led_display" id="8Bl{i[l(s:Ioc_0g,qL/"></block></value><value name="enabled"><block type="logic_boolean" id="=yOI`lA=K:GR%#svRDy]"><field name="BOOL">FALSE</field></block></value><next><block type="is_evening" id="LQ]FkrswuRVh~pVR4`2~"><value name="display"><block type="led_display" id="W@H=!Rq;Unc_nyMzyzSa"></block></value><value name="enabled"><block type="logic_boolean" id="u3]!2eC1uhW`Qagg;xRx"><field name="BOOL">FALSE</field></block></value><next><block type="set_display_minutes" id=")$KuB4j$~drz(?f~IA33"><value name="display"><block type="led_display" id="Ze|dZ,-_b{nDeaF!G=4?"></block></value><value name="minutes"><block type="math_number" id="TY[J-/e=;ceC.B?od}K,"><field name="NUM">0</field></block></value><next><block type="set_display_minutes" id="_l%r1U?6-]?dN]MN|?!,"><value name="display"><block type="led_display" id=")Ab?n+@{glOb0Y`I2Psk"></block></value><value name="minutes"><block type="math_number" id="jL;2a#rf.^fb{77a7b.^"><field name="NUM">0</field></block></value><next><block type="clock_wait" id="h|So@!qkk[gaznmTXHKh"><value name="clock"><block type="clock" id="*,#HJY;VreS5(s;+)4JS"></block></value><value name="seconds"><block type="math_number" id="w/8D5_UvA:{7knTYZ0ar"><field name="NUM">3</field></block></value></block></next></block></next></block></next></block></next></block></statement></block><block type="when_pressed" id="T+cupoQ-msB%kTz)AY|p" x="635" y="345"><value name="button"><block type="gpio_24" id="r!Mp`Hq1Oh#01=x@izF2"></block></value><statement name="pressed_function"><block type="procedures_callnoreturn" id="j;s`=0zqW,q|qxJ^%3ll"><mutation name="switchWeatherStations"></mutation></block></statement></block></xml>
<xml xmlns="http://www.w3.org/1999/xhtml"><block type="procedures_defnoreturn" id="Q:r]TyI-_k!Bd{^2kZ^|" x="29" y="-124"><field name="NAME">showCurrentTime</field><comment pinned="false" h="80" w="160">Describe this function...</comment><statement name="STACK"><block type="variables_set" id="AASS|_`eNq)!M[T)R;I}"><field name="VAR">Is Evening</field><value name="VALUE"><block type="logic_compare" id="4:@m^:jN-8716_qopLyy"><field name="OP">GT</field><value name="A"><block type="current_hour" id="/4CW/Hx+O=-q0`27e8/%"></block></value><value name="B"><block type="math_number" id="$1|6SjC,H$j8#XY/UZ}D"><field name="NUM">12</field></block></value></block></value><next><block type="set_display_hours" id="SMD!#?E~YIT-1?wVzUVD"><value name="display"><block type="led_display" id="6M^2{+[7-MsL7rbzG;]="></block></value><value name="hours"><block type="logic_ternary" id="N0P8.WU(`1R,#(6^o~e;"><value name="IF"><block type="variables_get" id="Zftqy$4g~vHRF}^[W}}r"><field name="VAR">Is Evening</field></block></value><value name="THEN"><block type="math_arithmetic" id="wgMgVfk]VD4U_wpeqIs$"><field name="OP">MINUS</field><value name="A"><block type="current_hour" id="i^S`B[oiTaHwh0GVUsAL"></block></value><value name="B"><block type="math_number" id="y83PFr|XI#t8wl/CIkJ9"><field name="NUM">12</field></block></value></block></value><value name="ELSE"><block type="current_hour" id=":zh8|shD=(BQdY#[zO1M"></block></value></block></value><next><block type="set_colon" id="ZU@i=glM5=c)8%`p-g6B"><value name="display"><block type="led_display" id="rwI.^ZP2)druh1QY@;Yc"></block></value><value name="enabled"><block type="logic_boolean" id="mv$:e@TXM~KoF(d%qIP-"><field name="BOOL">TRUE</field></block></value><next><block type="is_evening" id="V5@xea]yfOk:E`qvI2sH"><value name="display"><block type="led_display" id="S)s;OST=:vK0NgBOJ}W#"></block></value><value name="enabled"><block type="variables_get" id="[iV%55:IWUcHl6Umvs:X"><field name="VAR">Is Evening</field></block></value><next><block type="set_display_minutes" id="FW`:U6CbXWxc_D9vYl3T"><value name="display"><block type="led_display" id="5.Vlb-Oy,AM1c|Qdj?f2"></block></value><value name="minutes"><block type="current_minute" id="*W?bMT94PJ9Ce93UGZ9R"></block></value></block></next></block></next></block></next></block></next></block></statement></block><block type="clock_tick" id="!jJp=/!i9`e(6IX~`?_9" x="621" y="-128"><value name="clock"><block type="clock" id="_DhhGLuTN[UwwgA:QNX/"></block></value><statement name="on_tick_function"><block type="procedures_callnoreturn" id="mfd5?iV]0}!KUWq3X2in"><mutation name="showCurrentTime"></mutation></block></statement><next><block type="set_display_brightness" id="#NAJg|Bu}/K4#-;U@@.s"><field name="brightness">13</field><value name="display"><block type="led_display" id="omz/D*N+T4XEQ`|1Gc%;"></block></value></block></next></block><block type="procedures_defnoreturn" id="GLH[8S/lyPNnYxL.1|l^" x="29" y="192"><field name="NAME">playMusic</field><comment pinned="false" h="80" w="160">Play audio files through the speaker</comment><statement name="STACK"><block type="play_list" id="FAdbiNHO$f[[z+?9j(*i"><value name="speaker"><block type="speaker" id="|ezP#a2Ks@L]2?I.4atb"></block></value><value name="songs"><block type="lists_create_with" id="Zu.Jvi{Zy/Ik/WN/:6Hf"><mutation items="2"></mutation><value name="ADD0"><block type="AmicusMeus.ogg" id="i|Ubis^+FiTQxoG|=xM5"></block></value><value name="ADD1"><block type="TestTrack.ogg" id="i!+JY-!W18`uWyZ$l}+X"></block></value></block></value></block></statement></block><block type="clock_run_at" id="Eaw|zqK_9_ZZC|D,77wH" x="639" y="189"><value name="hour"><block type="math_number" id="ut+Qq7N!teM-s(^k23@/"><field name="NUM">8</field></block></value><value name="minute"><block type="math_number" id="|11d;-kaCUt`(uy|$W5@"><field name="NUM">30</field></block></value><value name="clock"><block type="clock" id="?fl.(w]+`knN_x4WvJ/Z"></block></value><statement name="at_time_function"><block type="procedures_callnoreturn" id="Tn_RVANezPTbVf8u^28)"><mutation name="playMusic"></mutation></block></statement></block><block type="procedures_defnoreturn" id="lAh0z]xL-jyfl)k^_|cL" x="44" y="344"><field name="NAME">switchWeatherStations</field><comment pinned="false" h="80" w="160">Describe this function...</comment><statement name="STACK"><block type="set_colon" id="UE$-oVKHZPJFcP;fHswG"><value name="display"><block type="led_display" id="8Bl{i[l(s:Ioc_0g,qL/"></block></value><value name="enabled"><block type="logic_boolean" id="=yOI`lA=K:GR%#svRDy]"><field name="BOOL">FALSE</field></block></value><next><block type="is_evening" id="LQ]FkrswuRVh~pVR4`2~"><value name="display"><block type="led_display" id="W@H=!Rq;Unc_nyMzyzSa"></block></value><value name="enabled"><block type="logic_boolean" id="u3]!2eC1uhW`Qagg;xRx"><field name="BOOL">FALSE</field></block></value><next><block type="set_display_hours" id="gCB~!70$^U)ti7@mnb_F"><value name="display"><block type="led_display" id="Ze|dZ,-_b{nDeaF!G=4?"></block></value><value name="hours"><block type="math_number" id="TY[J-/e=;ceC.B?od}K,"><field name="NUM">0</field></block></value><next><block type="set_display_minutes" id="_l%r1U?6-]?dN]MN|?!,"><value name="display"><block type="led_display" id=")Ab?n+@{glOb0Y`I2Psk"></block></value><value name="minutes"><block type="math_number" id="jL;2a#rf.^fb{77a7b.^"><field name="NUM">0</field></block></value><next><block type="clock_wait" id="h|So@!qkk[gaznmTXHKh"><value name="clock"><block type="clock" id="*,#HJY;VreS5(s;+)4JS"></block></value><value name="seconds"><block type="math_number" id="w/8D5_UvA:{7knTYZ0ar"><field name="NUM">3</field></block></value></block></next></block></next></block></next></block></next></block></statement></block><block type="when_pressed" id="T+cupoQ-msB%kTz)AY|p" x="635" y="345"><value name="button"><block type="gpio_24" id="r!Mp`Hq1Oh#01=x@izF2"></block></value><statement name="pressed_function"><block type="procedures_callnoreturn" id="j;s`=0zqW,q|qxJ^%3ll"><mutation name="switchWeatherStations"></mutation></block></statement></block></xml>
Loading

0 comments on commit 3c877e3

Please sign in to comment.