Skip to content

Commit 83d13f3

Browse files
authored
Merge pull request #29 from deckerego/detect_i2s
Detect i2s
2 parents 9bee3a1 + 0034eef commit 83d13f3

File tree

7 files changed

+43
-34
lines changed

7 files changed

+43
-34
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ I'm assuming that you are starting with the Raspian Minimal Linux distribution.
2121
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`
2222
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
2323
3. Add the necessary Python and GStreamer dependencies using the command: `sudo apt-get install wiringpi python-bottle python-requests python-oauth2client python-httplib2 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 gstreamer0.10-plugins-ugly python-gst0.10`
24-
4. Install hack-clock via `wget https://github.com/deckerego/hack-clock/releases/download/2.1.6/python-hackclock_2.1.6-1_all.deb; sudo dpkg -i python-hackclock_2.1.6-1_all.deb`
24+
4. Install hack-clock via `wget https://github.com/deckerego/hack-clock/releases/download/2.1.7/python-hackclock_2.1.7-1_all.deb; sudo dpkg -i python-hackclock_2.1.7-1_all.deb`
2525
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
2626
6. Reboot your Pi to re-load modules and start the IDE web server
2727

@@ -62,6 +62,9 @@ commenting out the I2S interfaces and un-commenting the `audio=on` parameter. Fo
6262
#dtoverlay=hifiberry-dac
6363
#dtoverlay=i2s-mmap
6464

65+
Once you have commented out the I2S settings as shown above, subsequent upgrades should
66+
just skip the I2S changes so you don't need to keep re-commenting things out.
67+
6568
You will also need to remove the custom `/etc/asound.conf` configuration file on your Pi -
6669
it does not need to be present if you are using the headphone jack.
6770

debian/changelog

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
hackclock (2.1.6-1) stable; urgency=low
1+
hackclock (2.1.7-1) stable; urgency=low
22

3-
* Fixed IFTTT event name trigger
3+
* Detect if I2S is already _ignored_, then allow standard Pi audio to continue
4+
* Changed icons for "save" and "restore" in IDE
45

56
-- DeckerEgo <[email protected]> Tue, 01 Mar 2017 21:32:00 -0500

debian/python-hackclock.postinst

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,33 @@ chown -R pi:pi /home/pi/hack-clock
1010
echo "Installing missing Python modules..."
1111
pip install -r /usr/share/doc/hack-clock/requirements.txt
1212

13-
# Set the hifiberry-dac i2s module
14-
echo "Installing I2S audio..."
15-
if [ -e $BOOT_CONFIG ] && grep -q "^dtoverlay=hifiberry-dac$" $BOOT_CONFIG; then
16-
echo "hifiberry already installed"
13+
# If I2S audio is already ignored, don't insert the I2S overlays
14+
if [ -e /boot/config.txt ] && grep -q -E "^#.*dtoverlay=i2s-mmap" /boot/config.txt; then
15+
echo "I2S already ignored, skipping I2S overlay"
1716
else
18-
echo "dtoverlay=hifiberry-dac" | sudo tee -a $BOOT_CONFIG
19-
fi
20-
21-
# Enable (optional) i2s-mmap to get rid of popping and set volumes
22-
if [ -e $BOOT_CONFIG ] && grep -q "^dtoverlay=i2s-mmap$" $BOOT_CONFIG; then
23-
echo "i2s-mmap already installed"
24-
else
25-
echo "dtoverlay=i2s-mmap" | sudo tee -a $BOOT_CONFIG
26-
fi
27-
28-
# Make sure old audio is disabled
29-
if [ -e $BOOT_CONFIG ] && grep -q -E "^dtparam=audio=on$" $BOOT_CONFIG; then
30-
echo "Commenting out dtparam=audio=on in $BOOT_CONFIG"
31-
sudo sed -i "s|^dtparam=audio=on$|#dtparam=audio=on|" $BOOT_CONFIG &> /dev/null
32-
elif [ -e $MOD_CONFIG ] && grep -q "^snd-bcm2835" $MOD_CONFIG; then
33-
echo "Commenting out snd-bcm2835 in $MOD_CONFIG"
34-
sudo sed -i "s|^snd-bcm2835|#snd-bcm2835|" $MOD_CONFIG &> /dev/null
17+
# Set the hifiberry-dac i2s module
18+
echo "Installing I2S audio..."
19+
if [ -e $BOOT_CONFIG ] && grep -q "^dtoverlay=hifiberry-dac$" $BOOT_CONFIG; then
20+
echo "hifiberry already installed"
21+
else
22+
echo "dtoverlay=hifiberry-dac" | sudo tee -a $BOOT_CONFIG
23+
fi
24+
25+
# Enable (optional) i2s-mmap to get rid of popping and set volumes
26+
if [ -e $BOOT_CONFIG ] && grep -q "^dtoverlay=i2s-mmap$" $BOOT_CONFIG; then
27+
echo "i2s-mmap already installed"
28+
else
29+
echo "dtoverlay=i2s-mmap" | sudo tee -a $BOOT_CONFIG
30+
fi
31+
32+
# Make sure old audio is disabled
33+
if [ -e $BOOT_CONFIG ] && grep -q -E "^dtparam=audio=on$" $BOOT_CONFIG; then
34+
echo "Commenting out dtparam=audio=on in $BOOT_CONFIG"
35+
sudo sed -i "s|^dtparam=audio=on$|#dtparam=audio=on|" $BOOT_CONFIG &> /dev/null
36+
elif [ -e $MOD_CONFIG ] && grep -q "^snd-bcm2835" $MOD_CONFIG; then
37+
echo "Commenting out snd-bcm2835 in $MOD_CONFIG"
38+
sudo sed -i "s|^snd-bcm2835|#snd-bcm2835|" $MOD_CONFIG &> /dev/null
39+
fi
3540
fi
3641

3742
# Boot upon start

package.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ rm home/pi/hack-clock/backups/blocks_clock.*
77

88
cd ..
99
echo "Compressing file..."
10-
tar Jcf hackclock_2.1.6.orig.tar.xz hack-clock/
10+
tar Jcf hackclock_2.1.7.orig.tar.xz hack-clock/
1111

1212
cd hack-clock
1313
dpkg-buildpackage -rfakeroot -uc -us

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def all_files(newroot, oldroot):
2727

2828
setup(
2929
name='HackClock',
30-
version='2.1.6',
30+
version='2.1.7',
3131
description='A hackable alarm clock for the Raspberry Pi',
3232
author='DeckerEgo',
3333
author_email='[email protected]',

srv/hackclock/views/blocks/editor.tpl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@
2929
<div class="btn-group btn-group-lg" role="group" >
3030
<button type="button" class="btn btn-default" aria-label="Save" onClick="saveBlocks(workspace, saveCallback);">
3131
% if status == "Saved":
32-
<span class="glyphicon glyphicon-floppy-saved" aria-hidden="true"></span>
32+
<span class="glyphicon glyphicon-play" aria-hidden="true"></span>
3333
% elif status == "Failed":
34-
<span class="glyphicon glyphicon-floppy-remove" aria-hidden="true"></span>
34+
<span class="glyphicon glyphicon-play" aria-hidden="true"></span>
3535
% else:
36-
<span class="glyphicon glyphicon-floppy-save" aria-hidden="true"></span>
36+
<span class="glyphicon glyphicon-play" aria-hidden="true"></span>
3737
% end
3838
</button>
3939
<button type="button" class="btn btn-default" aria-label="Restore" onClick="window.location='/blocks/backups';">
40-
<span class="glyphicon glyphicon-floppy-open" aria-hidden="true"></span>
40+
<span class="glyphicon glyphicon-folder-open" aria-hidden="true"></span>
4141
</button>
4242
<button type="button" class="btn btn-default" aria-label="Refresh" onClick="restartClock(this, 'runstatus');">
4343
<span class="glyphicon glyphicon-refresh" aria-hidden="true"></span>

srv/hackclock/views/python/editor.tpl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@
3232
<div class="btn-group btn-group-lg" role="group" >
3333
<button type="button" class="btn btn-default" aria-label="Save" onClick="savePython(editor.getValue(), saveCallback);">
3434
% if status == "Saved":
35-
<span class="glyphicon glyphicon-floppy-saved" aria-hidden="true"></span>
35+
<span class="glyphicon glyphicon-play" aria-hidden="true"></span>
3636
% elif status == "Failed":
37-
<span class="glyphicon glyphicon-floppy-remove" aria-hidden="true"></span>
37+
<span class="glyphicon glyphicon-play" aria-hidden="true"></span>
3838
% else:
39-
<span class="glyphicon glyphicon-floppy-save" aria-hidden="true"></span>
39+
<span class="glyphicon glyphicon-play" aria-hidden="true"></span>
4040
% end
4141
</button>
4242
<button type="button" class="btn btn-default" aria-label="Restore" onClick="window.location='/python/backups';">
43-
<span class="glyphicon glyphicon-floppy-open" aria-hidden="true"></span>
43+
<span class="glyphicon glyphicon-folder-open" aria-hidden="true"></span>
4444
</button>
4545
<button type="button" class="btn btn-default" aria-label="Refresh" onClick="restartClock(this, 'runstatus');">
4646
<span class="glyphicon glyphicon-refresh" aria-hidden="true"></span>

0 commit comments

Comments
 (0)