Plugwise xPL interface for v2 firmware

So, I needed a few more Plugwise Circles to automate some devices at home. I’m using the very cool Perl toolkit by Mark Hindess to create an xPL compliant interface towards the devices on an NSLU2. Problem: the interface I used was only compatible with firmware v1, and of course the new Circles ship with a newer (and incompatible) firmware. Time to upgrade!

Thanks to the preparatory work of Maarten Damen and Roheve I didn’t have to reverse engineer the protocol myself. Credits to you guys! I upgraded the existing xpl-plugwise code that was originally developed by Jfn and I have put it in a git repository. It is available here.

Continue reading Plugwise xPL interface for v2 firmware

Incremental backup script with daily delta

This script enables a ‘Time Machine alike’ backup of folders on a computer to a remote server. The script keeps daily snapshots by saving the deltas compared to the previous backup. The rest of the info is symlinked so you don’t end up using 7 times the required amount of disk space on the server.

I’ve been using this script quite some time to backup my Linux desktop to an NSLU2. I found it back during the spring clean of my archives and save it here for future reference.

#!/bin/sh

# This script does personal backups to a rsync backup server. You will end up
# with a 7 day rotating incremental backup. The incrementals will go
# into subdirectories named after the day of the week, and the current
# full backup goes into a directory called "current"
# Credits: tridge@linuxcare.com

# directory to backup
BDIR_LIST="/home /usr/share/jalbum"

# excludes file - this contains a wildcard pattern per line of files to exclude
EXCLUDES=excludes

# the name of the backup machine
BSERVER=hydra

# your password on the backup server
export RSYNC_PASSWORD=<insert_password_here>


########################################################################
# --exclude-from=$EXCLUDES  
BACKUPDIR=`date +%A`
OPTS="--force --ignore-errors --delete-excluded 
      --delete --backup --backup-dir=$BACKUPDIR -a --exclude-from=$EXCLUDES"

export PATH=$PATH:/bin:/usr/bin:/usr/local/bin

# the following line clears the last weeks incremental directory
[ -d $HOME/emptydir ] || mkdir $HOME/emptydir
echo "Clearing last weeks incremental directory..."
rsync -vv --delete -a $HOME/emptydir/ backup@$BSERVER::backup/$BACKUPDIR
rmdir $HOME/emptydir

# now the actual transfer
echo "Starting actual backup..."
for BDIR in $BDIR_LIST; do
	rsync -vv $OPTS $BDIR backup@$BSERVER::backup/current
done

echo "Backup completed!"

Easy Time Capsule repair

Ok, so the power supply of my Apple Time Capsule got fried due to a not-so-efficient cooling strategy of the designer. Basically the built-in power supply stops working and all of a sudden the Time Capsule does not power on any more.

Several fixes were already proposed, but they all focussed on replacing the built-in power supply. The problem with that is that the 3.5″ internal hard drive needs both a 12V and a 5V rail. So either you fix the original supply, you connect an ATX power supply or you take a 12V supply and build your own DCDC convertor to generate the 5V net from the 12V of the supply.

I was looking for a more simple solution and came up with this…

Continue reading Easy Time Capsule repair

PSOC Designer 5.0 code porting

Cypress switched back to the ImageCraft compiler, and now we’re left with the task of fixing our existing codebase that was developed with the HiTech compiler.

Not too problematic. The only thing that bothers me a bit is the lack of good/up-to-date documentation. I spent an hour to figure our how to get the printf’s that I used in my code compiling again. Once you know how to do it, it is simple…

Example code:


printf("Test printf without parameters\n");

Compiling your HiTech code with the ImageCraft compiler, the printf fails with the following error:


type error in argument 1 to `printf'; found `pointer to __flash char' expected `pointer to char'

Seems that in for ImageCraft you need to use another printf function if the strings are in ROM. And this function is called… tada: cprintf.

Replace the existing printf with cprintf and you’re up and running again. I guess it would have need nice if this info was added to the ‘migrating from HiTech to ImageCraft’ document that is bundled with PSOC Designer. Maybe eventually, it will be…

Also notice: to get the ImageCraft printf functions working, you need to replace the ‘putch’ helper function for printf by:

// Helper function for the printf function.
int putchar(char c) {
 // Send characters to the Lantronix interface
 LTRX_PutChar(c);
 return 1;
}

Finally, if you fancy some more advanced printf functionality like modifiers, or support for long/float, you’ll need to update your ‘local.mk’ (‘Project’ -> open local.mk) and add the option

CODECOMPRESSOR:=$(CODECOMPRESSOR) -lfpm8c // For floating

CODECOMPRESSOR:=$(CODECOMPRESSOR) -llpm8c // For long support

Hope this helps you saving some time until the documentation gets updated!