highaltitude.log.20080710

[00:05] Laurenceb (n=Laurence@host81-154-154-203.range81-154.btcentralplus.com) joined #highaltitude.
[00:05] <Laurenceb> hi
[00:05] <Laurenceb> natrium42: you about?
[00:05] <natrium42> yo
[00:06] <Laurenceb> hi, can I ask you about c ?
[00:06] <natrium42> sure
[00:06] <Laurenceb> I have 4 bytes, and want to convert to a float
[00:06] <Laurenceb> so I was using pointers, the code is on the wiki
[00:07] <Laurenceb> http://wiki.ukhas.org.uk/code:interrupt_driven_tsip
[00:07] <Laurenceb> I'm using memcpy
[00:08] <Laurenceb> is that a good way to go about it?
[00:09] <natrium42> not really
[00:10] <natrium42> since you are copying only one byte, right?
[00:10] <Laurenceb> yes
[00:10] <natrium42> memcpy is usually to copy arrays
[00:11] <Laurenceb> so I could do it direc tly using pointers?
[00:11] <natrium42> what is d?
[00:12] <natrium42> and why do you compare addresses of the variables like so:
[00:12] <natrium42> d==&gps.latitude
[00:12] <Laurenceb> to save ram
[00:12] <Laurenceb> d is a pointer to the float
[00:13] <natrium42> static u08 *d;\
[00:13] <Laurenceb> but I made it a char pointer so I could use it to move bytes
[00:13] <natrium42> it's a pointer to unsigned char
[00:13] <Laurenceb> bbl, sorry
[00:13] <natrium42> mkay
[00:13] <Laurenceb> (food)
[00:13] <natrium42> where are you setting d, though?
[00:15] <akawaka> don't know why you are assigning a pointer value to d and then checking that value and performing the memcpy
[00:15] <akawaka> why not just do it all in the switch statement?
[00:17] <akawaka> oh i see
[00:19] <akawaka> anyway, keep the switch statements, get rid of the ifs and just do:
[00:19] <akawaka> d[ placemarker & 0x3 ] = c;
[00:34] flowolf (n=flowolf@unaffiliated/flowolf) joined #highaltitude.
[00:35] <Laurenceb> back
[00:35] <Laurenceb> but d isnt an array
[00:36] <akawaka> its a pointer
[00:36] <akawaka> doesn't make any difference
[00:36] <akawaka> you can treat pointers like arrays
[00:36] <Laurenceb> oh
[00:36] <akawaka> *(d + ( placemarker & 0x3 ) ) = c;
[00:36] <Laurenceb> ah yes of course
[00:36] <akawaka> if you want
[00:37] <Laurenceb> I assign d with d=&gps.latitude;
[00:37] <akawaka> but yeah, no need for the if statements to compare the pointer values
[00:37] <Laurenceb> but I need to know where I am
[00:37] <Laurenceb> ie if I'm at latitude, longitude or altitude
[00:37] <akawaka> why?
[00:38] <Laurenceb> as its an ISR
[00:38] <Laurenceb> each time its called, it processes one char
[00:38] <akawaka> yeah, thats what placemarker is for
[00:38] <Laurenceb> well yes I could use range chacks on that
[00:39] <Laurenceb> but that uses more clock cycles?
[00:39] <akawaka> but you are only interested in the lower 2 bits of placemarker
[00:39] <Laurenceb> hmm
[00:39] <akawaka> because you've already determined what the higher bits are in the switch statement
[00:39] <akawaka> if placemarker is 4, d is set to longtitude
[00:40] <akawaka> placemarker & 0x3 is 0, so you write the first byte to lontitude
[00:40] <akawaka> if placemarker is 4, d has already been set to lontitude
[00:40] <akawaka> placemarker & 0x3 is 1 so you write the second byte of longtitude
[00:41] <Laurenceb> I kind of see where you're going
[00:42] <Laurenceb> but longitude has 4 bytes
[00:42] <akawaka> yeah
[00:43] <akawaka> placemarker == 4, d is set to longtitude, placemarker & 0x3 is 0, write first byte
[00:43] <akawaka> placemarker == 5, d is already set to longtitude, placemarker & 0x3 is 1, write second byte
[00:43] <akawaka> placemarker == 6, d is already set to longtitude, placemarker & 0x3 is 2, write third byte
[00:43] <akawaka> placemarker == 7, d is already set to longtitude, placemarker & 0x3 is 3, write forth byte
[00:43] <Laurenceb> oh yes
[00:43] <Laurenceb> genius
[00:43] <akawaka> placemarker == 8, d is set to altitude, placemarker & 0x3 is 0, write first byte
[00:44] <Laurenceb> this gets rid of a fair bit of code :P
[00:44] <akawaka> of course you could organize the gps structure so latitude, longtitude and altitude all follow after one another
[00:44] <Laurenceb> they probably are
[00:44] <akawaka> then you could just set d to latitude and just placemarker directly
[00:45] <Laurenceb> yes
[00:45] <Laurenceb> how do I make sure they follow like that?
[00:45] <Laurenceb> deselect packed structure members?
[00:45] <akawaka> just define them in that order in the structure
[00:46] <Laurenceb> ok
[00:46] Action: Laurenceb likes this
[00:46] <Laurenceb> thanks for the help
[00:47] <akawaka> the last 3 years i've been writing a lot of code for efficiently loading and saving C structures
[00:47] <Laurenceb> but if I allow packed structure members in the makefile, could they be in some other order?
[00:47] <akawaka> no, packing will never reorganize the order
[00:47] <akawaka> just the padding between members
[00:48] <akawaka> but there won't be any padding between 32-bit members anyway
[00:48] <Laurenceb> so it would always be in the order defined?
[00:48] <akawaka> yup
[00:48] <Laurenceb> its an 8 bit avr
[00:48] <akawaka> yup, not an issue
[00:49] <akawaka> without structure packing struct { float foo; char bar; float baz; } would be 12 bytes, assuming float has a natual alignment of 4 bytes
[00:50] <akawaka> with packing that structure would be 9 bytes, because the compiler will remove the 3 bytes of padding between bar and baz
[00:57] <Laurenceb> ah I see
[00:58] <Laurenceb> right time to get some sleep, thanx for the help
[00:58] <Laurenceb> cya
[00:59] Laurenceb (n=Laurence@host81-154-154-203.range81-154.btcentralplus.com) left irc:
[01:03] Nick change: MetaMorfoziS -> metawaly
[01:27] metawaly (n=avr@3e44b173.adsl.enternet.hu) left irc: Remote closed the connection
[02:01] flowolf (n=flowolf@unaffiliated/flowolf) left irc: "Leaving"
[03:16] <jiffe88> anyone know good radios to use?
[03:35] <akawaka> where are you based and what do you want to do?
[03:43] <jiffe88> south dakota, high altitude ballooning, 30km or so
[03:54] <akawaka> i would recommend getting an amateur radio license
[03:54] <akawaka> it opens up a lot of possibilities and will put you in contact with local people who know a lot about radios
[03:57] <jiffe88> hmm, ok
[03:57] <akawaka> its actually pretty easy to get your license
[03:58] <akawaka> you can use systems like aprs to track your balloon then
[03:59] <jiffe88> I see
[03:59] <jiffe88> well I have a gps unit going through a pic collecting other info
[04:01] <akawaka> do you want to be able to communicate with the balloon or just track it?
[04:01] <jiffe88> the balloon will just be transmitting
[04:01] <jiffe88> gps data ++
[04:02] <akawaka> i'm not sure what is available if you are unlicensed
[04:02] <jiffe88> what about licensed?
[04:03] <akawaka> if you are unlicensed there are some radio modems in the 900mhz band that you could use, like http://www.digi.com/products/wireless/xstream.jsp
[04:03] <akawaka> i know natrium42 used something similar
[04:04] <akawaka> if you are licensed you could hook a pic up to a a vhf transmitter
[04:04] <akawaka> you can buy small handhelds starting at $150
[04:05] <akawaka> or buy a radio module from radiometrix
[04:05] <akawaka> encoding packet radio, or specifically aprs packets with a pic wouldn't be all the difficult
[04:05] <akawaka> a 4-bit dac should give you the resolution you need
[04:10] <akawaka> there are modules that do a lot for you too, like: http://www.byonics.com/microtrak/mt8000fa.php
[04:17] <jiffe88> wow ok
[04:21] <akawaka> i used that on my balloon it was very successful
[04:21] <akawaka> we picked it up with our own radio in the chase car
[04:22] <akawaka> but it also got picked up and repeated by repeaters all over california
[04:37] <jiffe88> wow yeah that has a huge range
[04:37] <jiffe88> know of a similar setup for receiving?
[04:48] <akawaka> just any vhf radio hooked up to a pc
[04:49] <akawaka> you can buy old mobile rigs for under 100
[04:50] <akawaka> or you can just rely on getting picked up by repeaters sent to the internet
[04:53] <jiffe88> ah cool I didn't know that was broadcast over the net
[04:53] <jiffe88> not likely out here though :)
[04:56] <akawaka> yeah, maybe not
[04:57] <akawaka> you really want a radio with you as you follow
[04:57] <akawaka> the microtrak can store two configurations
[04:57] <akawaka> so what you might want to do is transmit every 45 seconds on the standard aprs frequency
[04:57] <akawaka> but when you get below 5000 feet start transmitting more rapidly on a different frequency that you are tuned to
[04:58] <akawaka> (not good to spam the aprs network too often)
[06:35] Simon-MPFH (n=simon@phantom.mpfh.co.uk) joined #highaltitude.
[07:03] akawaka (n=akawaka@external.treyarch.com) left irc: Read error: 110 (Connection timed out)
[08:21] edmoore (n=edmoore@174.123-84-212.ippool.ndo.com) joined #highaltitude.
[08:45] edmoore (n=edmoore@174.123-84-212.ippool.ndo.com) left irc: Read error: 113 (No route to host)
[08:49] edmoore (n=edmoore@smtp.vorticity-systems.com) joined #highaltitude.
[08:54] yansa (n=yans@host-89-230-208-118.lublin.mm.pl) joined #highaltitude.
[09:46] <edmoore> spitfire just flew over
[09:46] <edmoore> what a lovely sound
[09:50] MetaMorfoziS (n=avr@3e44b173.adsl.enternet.hu) joined #highaltitude.
[09:57] akawaka (n=akawaka@cpe-76-173-152-142.socal.res.rr.com) joined #highaltitude.
[10:33] Laurenceb (n=Laurence@host81-154-154-203.range81-154.btcentralplus.com) joined #highaltitude.
[10:37] akawaka (n=akawaka@cpe-76-173-152-142.socal.res.rr.com) left irc: Read error: 110 (Connection timed out)
[10:58] Laurenceb (n=Laurence@host81-154-154-203.range81-154.btcentralplus.com) left irc:
[11:13] MetaMorfoziS (n=avr@3e44b173.adsl.enternet.hu) left irc: "Connectshun reset by mah bukkit."
[13:05] edmoore (n=edmoore@smtp.vorticity-systems.com) got netsplit.
[13:05] yansa (n=yans@host-89-230-208-118.lublin.mm.pl) got netsplit.
[13:05] jiffe88 (n=fxmulder@67.158.3.217) got netsplit.
[13:05] Tygrys^ (i=tygrys@moo.pl) got netsplit.
[13:05] Simon-MPFH (n=simon@phantom.mpfh.co.uk) got netsplit.
[13:05] kornholijo (i=kornholi@c-f1f472d5.09-99-73746f40.cust.bredbandsbolaget.se) got netsplit.
[13:05] rcaron (n=rcaron@c-75-68-113-23.hsd1.nh.comcast.net) got netsplit.
[13:05] bobx (n=bobx@lowfreq.trancemitter.org) got netsplit.
[13:05] natrium42 (n=alexei@CPE000625d867e2-CM0014045885be.cpe.net.cable.rogers.com) got netsplit.
[13:05] borism (n=boris@195-50-204-228-dsl.krw.estpak.ee) got netsplit.
[13:06] zeusbot (n=zeusbot@lister.antycip.co.uk) left #highaltitude.
[13:06] zeusbot joined #highaltitude.
[13:06] #highaltitude: mode change '+ns ' by calvino.freenode.net
[13:08] -:#highaltitude- *** Notice -- TS for #highaltitude changed from 1215691560 to 1164523384
[13:08] #highaltitude: mode change '+tc-s ' by irc.freenode.net
[13:08] yansa (n=yans@host-89-230-208-118.lublin.mm.pl) joined #highaltitude.
[13:08] edmoore (n=edmoore@smtp.vorticity-systems.com) joined #highaltitude.
[13:08] Simon-MPFH (n=simon@phantom.mpfh.co.uk) joined #highaltitude.
[13:08] natrium42 (n=alexei@CPE000625d867e2-CM0014045885be.cpe.net.cable.rogers.com) joined #highaltitude.
[13:08] borism (n=boris@195-50-204-228-dsl.krw.estpak.ee) joined #highaltitude.
[13:08] jiffe88 (n=fxmulder@67.158.3.217) joined #highaltitude.
[13:08] bobx (n=bobx@lowfreq.trancemitter.org) joined #highaltitude.
[13:08] kornholijo (i=kornholi@c-f1f472d5.09-99-73746f40.cust.bredbandsbolaget.se) joined #highaltitude.
[13:08] rcaron (n=rcaron@c-75-68-113-23.hsd1.nh.comcast.net) joined #highaltitude.
[13:08] Tygrys^ (i=tygrys@moo.pl) joined #highaltitude.
[13:08] Topic changed on #highaltitude by !irc.freenode.net: Welcome to #highaltitude - discuss anything to do with high altitude projects (balloons, gliders, etc) www.ukhas.org.uk, wiki.ukhas.org.uk, logs: http://users.gridstar.net/~zeusbot/
[14:28] MetaMorfoziS (n=avr@3e44b173.adsl.enternet.hu) joined #highaltitude.
[14:37] natrium42 (n=alexei@CPE000625d867e2-CM0014045885be.cpe.net.cable.rogers.com) left irc:
[14:47] edmoore (n=edmoore@smtp.vorticity-systems.com) left irc:
[14:50] yansa_ (n=yans@host-89-230-209-7.lublin.mm.pl) joined #highaltitude.
[14:55] borism_ (n=boris@195-50-211-238-dsl.krw.estpak.ee) joined #highaltitude.
[14:58] borism (n=boris@195-50-204-228-dsl.krw.estpak.ee) left irc: Read error: 145 (Connection timed out)
[15:06] yansa (n=yans@host-89-230-208-118.lublin.mm.pl) left irc: Read error: 110 (Connection timed out)
[15:40] flowolf_ (n=flowolf@host15-224-dynamic.20-87-r.retail.telecomitalia.it) joined #highaltitude.
[15:44] flowolf_ (n=flowolf@host15-224-dynamic.20-87-r.retail.telecomitalia.it) left #highaltitude ("Leaving").
[16:16] yansa_ (n=yans@host-89-230-209-7.lublin.mm.pl) left irc: Read error: 110 (Connection timed out)
[17:51] MetaMorfoziS (n=avr@3e44b173.adsl.enternet.hu) left irc: Remote closed the connection
[17:51] Hiena (n=Hiena@81.93.195.181.datatrans.hu) joined #highaltitude.
[18:10] jcoxon (n=jcoxon@92.40.165.10.sub.mbb.three.co.uk) joined #highaltitude.
[18:14] akawaka (n=akawaka@external.treyarch.com) joined #highaltitude.
[18:36] MetaMorfoziS (n=avr@3e44b173.adsl.enternet.hu) joined #highaltitude.
[18:55] Ebola (n=Ebola@unaffiliated/ebola) joined #highaltitude.
[19:05] MetaMorfoziS (n=avr@3e44b173.adsl.enternet.hu) left irc: "Connectshun reset by mah bukkit."
[19:11] MetaMorfoziS (n=avr@3e44b173.adsl.enternet.hu) joined #highaltitude.
[20:50] Ebola_ (n=Ebola@unaffiliated/ebola) joined #highaltitude.
[20:50] Ebola (n=Ebola@unaffiliated/ebola) left irc: Nick collision from services.
[20:50] Nick change: Ebola_ -> Ebola
[21:20] BadWolf (n=grunge@217.47.75.27) joined #highaltitude.
[21:53] Hiena (n=Hiena@81.93.195.181.datatrans.hu) left irc: "-=Halt! Hammerzeit!=-"
[22:04] Simon-MPFH (n=simon@phantom.mpfh.co.uk) left irc: "Leaving"
[22:34] Ebola (n=Ebola@unaffiliated/ebola) left irc: "Gone to queue skills on EVE then sleep. With luck it'll be done when I wake up at 4am due to failing at sleep."
[22:52] jcoxon (n=jcoxon@92.40.165.10.sub.mbb.three.co.uk) left irc: "Leaving"
[23:24] BadWolf (n=grunge@217.47.75.27) left irc: Read error: 110 (Connection timed out)
[23:58] natrium42 (n=alexei@CPE000625d867e2-CM0014045885be.cpe.net.cable.rogers.com) joined #highaltitude.
[00:00] --- Fri Jul 11 2008