Skip to content

Commit

Permalink
Merge pull request #38 from deckerego/klaxon
Browse files Browse the repository at this point in the history
Update audio config; reboot on kernel panic; klaxon sound
  • Loading branch information
deckerego authored Sep 26, 2017
2 parents 86f59a8 + 9ac9af6 commit b383f48
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ To install the hack-clock distribution on top of Raspian:
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 the command: `sudo apt-get install wiringpi ntp python-bottle python-requests python-oauth2client python-httplib2 python-setuptools python-pip python-dev python-dateutil python-smbus gstreamer0.10-x gstreamer0.10-alsa gstreamer-tools gstreamer0.10-plugins-base gstreamer0.10-plugins-good gstreamer0.10-plugins-ugly python-gst0.10`
4. Install hack-clock via `wget https://github.com/deckerego/hack-clock/releases/download/2.3.0/python-hackclock_2.3.0-1_all.deb; sudo dpkg -i python-hackclock_2.3.0-1_all.deb`
4. Install hack-clock via `wget https://github.com/deckerego/hack-clock/releases/download/2.3.1/python-hackclock_2.3.1-1_all.deb; sudo dpkg -i python-hackclock_2.3.1-1_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
10 changes: 5 additions & 5 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
hackclock (2.3.0-1) stable; urgency=low
hackclock (2.3.1-1) stable; urgency=low

* Migration to Raspian Stretch
* Reboot on kernel panic
* Fixed LICENSE to include copyright
* Added klaxon audio sample
* Configurable ALSA master channel
* Really added reboot on kernel panic this time

-- DeckerEgo <[email protected]> Mon, 25 Sep 2017 23:00:00 -0500
-- DeckerEgo <[email protected]> Mon, 25 Sep 2017 23:15:00 -0500
12 changes: 11 additions & 1 deletion debian/python-hackclock.postinst
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

BOOT_CONFIG=/boot/config.txt
SYS_CONFIG=/etc/sysctl.conf
MOD_CONFIG=/etc/modules

# Fix ownership in home directory after installing
Expand All @@ -10,8 +11,17 @@ chown -R pi:pi /home/pi/hack-clock
echo "Installing missing Python modules..."
pip install -r /usr/share/doc/hack-clock/requirements.txt

# Set sysctl parameters
if [ -e /boot/config.txt ] && grep -q -E "^#.*kernel.panic=" $SYS_CONFIG; then
echo "Not setting kernel panic reboot, already set"
else
# If we have a kernel panic, reboot in 5 seconds
echo "Setting reboot on kernel panic"
echo "kernel.panic=5" | sudo tee -a $SYS_CONFIG
fi

# If I2S audio is already ignored, don't insert the I2S overlays
if [ -e /boot/config.txt ] && grep -q -E "^#.*dtoverlay=i2s-mmap" /boot/config.txt; then
if [ -e /boot/config.txt ] && grep -q -E "^#.*dtoverlay=i2s-mmap" $BOOT_CONFIG; then
echo "I2S already ignored, skipping I2S overlay"
else
# Set the hifiberry-dac i2s module
Expand Down
4 changes: 4 additions & 0 deletions etc/default/hack-clock
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,9 @@ BUTTON_BCM_PIN=(23 24)
# The pins (using the Broadcom numbering scheme) to be used for switches (output)
SWITCH_BCM_PIN=(25)

# Master volume channel. With the Adafruit I2S amp this is 'Master',
# with the headphone jack on larger Raspberry Pi's this is 'PCM'
AUDIO_CHANNEL='Master'

# Volume level to feed to ALSA SoftVol
MASTER_VOLUME='65%'
7 changes: 5 additions & 2 deletions etc/init.d/hack-clock
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ SCRIPTNAME=/etc/init.d/$NAME

set_volume()
{
amixer set Master -- "$MASTER_VOLUME"
[[ -z $AUDIO_CHANNEL ]] && AUDIO_CHANNEL='Master'
[[ -z $MASTER_VOLUME ]] && MASTER_VOLUME='65%'
log_daemon_msg "Setting ALSA channel $AUDIO_CHANNEL to $MASTER_VOLUME"

amixer set "$AUDIO_CHANNEL" -- "$MASTER_VOLUME"
}

#
Expand Down Expand Up @@ -163,7 +167,6 @@ case "$1" in
esac
;;
*)
#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
exit 3
;;
Expand Down
Binary file added home/pi/hack-clock/audio/Klaxon.ogg
Binary file not shown.
14 changes: 13 additions & 1 deletion home/pi/hack-clock/audio/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,27 @@ Audio

The test audio files are available in the public domain.


AmicusMeus.ogg
--------------

"Amicus meus" by Tomás Luis de Victoria
License: Public Domain
Source: http://commons.wikimedia.org/wiki/File:AmicusMeus.ogg


Klaxon.ogg
----------

Recorded by the United States Navy. Freely available on the
U.S. Department of Defense media page.
License: Public Domain
Source: https://commons.wikimedia.org/wiki/File:WWII_submarine_dive_klaxon.ogg


TestTrack.ogg
--------------
-------------

A one-second click track for testing left and right channel audio. This was
created by myself and is released into the public domain.
License: Public Domain
2 changes: 1 addition & 1 deletion package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ rm home/pi/hack-clock/backups/blocks_clock.*

cd ..
echo "Compressing file..."
tar Jcf hackclock_2.3.0.orig.tar.xz hack-clock/
tar Jcf hackclock_2.3.1.orig.tar.xz hack-clock/

cd hack-clock
dpkg-buildpackage -rfakeroot -uc -us
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def all_files(newroot, oldroot):

setup(
name='HackClock',
version='2.3.0',
version='2.3.1',
description='A hackable alarm clock for the Raspberry Pi',
author='DeckerEgo',
author_email='[email protected]',
Expand Down

0 comments on commit b383f48

Please sign in to comment.