Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Ice Tube firmware - GPS w/ DST
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Ice Tube firmware - GPS w/ DST

by wbp on Thu May 12, 2011 11:55 am

I've made several mods to the "ice tube clock" firmware. I've rewritten the DST mod and incorporated it with the GPS mod. The DST rules default to current US rules, but they are now in the menu, so they can be easily changed to match your locale. The DST offset calculation is done once a minute, so it will set the offset correctly any time the clock is started up from scratch. Display of latitude and longitude was added to the menu. The clock powers up with "ice tube" in the display. Autodim option is now a separate menu item, with low and high brightness levels in the menu.

It's been fun working on this - I hope you like it!
William
Attachments
ice tube.110511wm.zip
(54.89 KiB) Downloaded 215 times

wbp
 
Posts: 260
Joined: Mon Mar 07, 2011 1:18 pm

Re: Ice Tube firmware - GPS w/ DST

by adafruit on Thu May 12, 2011 12:43 pm

thanks!

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

Re: Ice Tube firmware - GPS w/ DST

by revnull on Thu May 19, 2011 7:58 pm

Great firmware! It has all the features I wanted. To get rid of the "testmode", I assume I just comment out the #define FEATURE_TESTMODE in the in.h file?

Thanks!

revnull
 
Posts: 22
Joined: Mon Aug 30, 2010 10:06 pm

Re: Ice Tube firmware - GPS w/ DST

by wbp on Thu May 19, 2011 10:01 pm

That should do it. I have not tested it with testmode removed so if you have problems let me know and I'll take care of it

I'm working on a progressive alarm feature now...

William

wbp
 
Posts: 260
Joined: Mon Mar 07, 2011 1:18 pm

Re: Ice Tube firmware - GPS w/ DST

by revnull on Fri May 20, 2011 1:17 am

Yeah, looks like it's broken. Make fails.

Code: Select all | TOGGLE FULL SIZE
> "make.exe" all
set -e; avr-gcc -MM -mmcu=atmega168 -I. -g -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -DF_CPU=8000000 `perl timedef.pl` -Wa,-adhlns=util.lst  -std=gnu99 util.c \
   | sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > util.d; \
   [ -s util.d ] || rm -f util.d
set -e; avr-gcc -MM -mmcu=atmega168 -I. -g -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -DF_CPU=8000000 `perl timedef.pl` -Wa,-adhlns=iv.lst  -std=gnu99 iv.c \
   | sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > iv.d; \
   [ -s iv.d ] || rm -f iv.d

-------- begin --------
avr-gcc (WinAVR 20100110) 4.3.3
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Compiling: iv.c
avr-gcc -c -mmcu=atmega168 -I. -g -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -DF_CPU=8000000 `perl timedef.pl` -Wa,-adhlns=iv.lst  -std=gnu99 -DTXMODE=   iv.c -o iv.o
In file included from iv.c:51:
iv.h:244: error: 'TESTMODE' undeclared here (not in a function)
In file included from iv.c:52:
util.h:62:1: warning: "nop" redefined
In file included from iv.c:51:
iv.h:338:1: warning: this is the location of the previous definition
In file included from iv.c:53:
fonttable.h:30: warning: pointer targets in initialization differ in signedness
fonttable.h:51: warning: pointer targets in initialization differ in signedness
iv.c:129: warning: pointer targets in initialization differ in signedness
iv.c:137: warning: pointer targets in initialization differ in signedness
make.exe: *** [iv.o] Error 1

> Process Exit Code: 2
> Time Taken: 00:00


It looks like it's dumping on:
iv.h:244: error: 'TESTMODE' undeclared here (not in a function)

revnull
 
Posts: 22
Joined: Mon Aug 30, 2010 10:06 pm

Re: Ice Tube firmware - GPS w/ DST

by wbp on Fri May 20, 2011 3:17 am

Yep - I goofed. In iv.h, around line 242, change this:
Code: Select all | TOGGLE FULL SIZE
   TESTMODE
#endif
};
const int n_modes = TESTMODE + 1;


to this:

Code: Select all | TOGGLE FULL SIZE
   TESTMODE,
#endif
   n_modes      // # of menu items, must be last
};


That will make "n_modes" part of the enum and remove the dependency on TESTMODE. I'll see if I can post an updated zip file from here.

wbp
 
Posts: 260
Joined: Mon Mar 07, 2011 1:18 pm

Re: Ice Tube firmware - GPS w/ DST

by wbp on Fri May 20, 2011 3:33 am

OK, here's an updated zip file.

Question: should Auto Dim be named "adim" or "abrt" in the menu? "abrt" seems easier to read...
Attachments
ice tube.110520wm.zip
fix for error if TESTMODE not defined
(55.26 KiB) Downloaded 222 times

wbp
 
Posts: 260
Joined: Mon Mar 07, 2011 1:18 pm

Re: Ice Tube firmware - GPS w/ DST

by revnull on Fri May 20, 2011 11:33 am

The new version works great. It compiled fine this time. To me, the 'adim' is easier to read. I actually had to read the source to figure out what 'abrt' was. :D You may also want to update the 'about' version/date.

Thanks for your work!

revnull
 
Posts: 22
Joined: Mon Aug 30, 2010 10:06 pm

Re: Ice Tube firmware - GPS w/ DST

by pasmith0 on Wed Jul 06, 2011 6:54 pm

I concur, I'm running with the GPS and photocell mods and this firmware is working great. The clock is even able to receive the GPS satellite signal in my basement a good two feet away from the closest window.

Thanks William.

pasmith0
 
Posts: 1
Joined: Tue Nov 17, 2009 1:40 pm
Location: Broomfield, CO

Re: Ice Tube firmware - GPS w/ DST

by asa on Sun Nov 06, 2011 12:53 pm

I have been running this firmware with a GPS module and DST enabled, an it has been working fine until today. It was supposed to go back an hour according to the default DST rules, it doesn't.
I know too little about programming to read the code and understand why it isn't working.
asa
 
Posts: 1
Joined: Sun Nov 06, 2011 12:44 pm

Re: Ice Tube firmware - GPS w/ DST

by wbp on Sun Nov 06, 2011 1:34 pm

Yep, it's a bug. I tested all this but something got thru the cracks. Looking at it now.
William

wbp
 
Posts: 260
Joined: Mon Mar 07, 2011 1:18 pm

Re: Ice Tube firmware - GPS w/ DST

by wbp on Tue Nov 08, 2011 1:18 pm

OK, I've got a fix for the "end of DST" bug now. Interesting problem. Simple bug, really, doing a subtract on a uint and testing for a negative value doesn't work. Once that was fixed it exposed another problem, which took a bit longer to fix. I've tested DST onset and end, both with and without GPS, it all works as expected now...

I can post an updated version if anyone needs it now. I'm working on a "progressive alarm" feature, where it starts out beeping slowly and speeds up over time - I'd like to finish that before I post a new version.

William

wbp
 
Posts: 260
Joined: Mon Mar 07, 2011 1:18 pm

Re: Ice Tube firmware - GPS w/ DST

by wbp on Thu Nov 17, 2011 7:34 pm

While I was working on an update to fix the bug I found, I observed an interesting "bug", which leads me to ask if someone can explain something to me...

Given these definitions:
uint16_t t1, t2;

Why would one code this:
if ( ( 0 > (int16_t)( t1 - t2 ) )

instead of this:
if ( t2 > t1)

Thanks,
William

wbp
 
Posts: 260
Joined: Mon Mar 07, 2011 1:18 pm

Re: Ice Tube firmware - GPS w/ DST

by revnull on Tue Dec 13, 2011 10:19 pm

Any updates for your firmware yet? I would love to update my clock.

Thanks!

revnull
 
Posts: 22
Joined: Mon Aug 30, 2010 10:06 pm

Re: Ice Tube firmware - GPS w/ DST

by wbp on Fri Dec 16, 2011 2:01 pm

OK, here's my latest. Includes the following:

1) fix for end of DST bug
2) flash display when alarming
3) increase brightness for rightmost digit
4) added clicks when incrementing time, date

Enjoy!
William
Attachments
ice tube.111216wm.zip
Fixes error at end of DST, other improvements.
(56.79 KiB) Downloaded 293 times

wbp
 
Posts: 260
Joined: Mon Mar 07, 2011 1:18 pm

Please be positive and constructive with your questions and comments.