I looked at several sources for a simple routine(All signal
processing done in a 16f628a):
1. Receive a button-press-caused infrared-signal from a
remote control with a TSOP1740(IR receiver module)
2. Identify the button being pressed. Then return a number
representing the button being pressed.
I want to go into detail about my experiences: There are all
kinds of code-examples, everytime combined with varieties of
hardware. No simple routine to call and get the values needed.
Not at all. It seems to me as if the creators of theses codes
have never ever reached adulthood. And this is meant in a
negative way. All comments I have read in the code are totally
useless as they describe what everyone has already noticed.
For example(in picbasic): "PORTA = PORTA >> 1 & %00001111 'PORTA
moving 1 to the right whereas bit 4 to 7 are hidden." Totally
useless. I am asking WHY this is done exactly there to get a clue
what to delete or expand and not what it does.
On and on combined with displays and their driving, fancy
joysticks(which, of course, need their own driving, and this is
included in the code somewhere aswell, without any explaining
what is done there).
What I want is the routine mentioned. And a _good_ documentation,
if there are any modifications necessary. A documentation which
does not require the user to rewrite the code just because the
writer thought of himself as a teacher who thought of himself to
be selected to teach everyone. I don't want to learn anything
because someone decides he is in need to teach without asking for
permission (!) (because noone ever would ask exactly those people
for a lesson).
Look at references for python for example. Plain and clear
routines, only necessary values to be passed and a useful result.
THIS is why it is popular.
No playground. And I say this with conviction even though I am
creating a hobbiist project.
Thilo Klein wrote:
> What I want is the routine mentioned. And a _good_ documentation,
No problem. Send me the specs and $880 for the first 8 hours prepaid and
I'll get right on that for you.
In the abscence of getting paid, I and most people here will continue to do
what *we* want to do with our free time, which for me at least currently
doesn't include writing IR remote decoding routines so that demanding people
can use them for free.
Olin Lathrop wrote:
> Thilo Klein wrote:
>
>> What I want is the routine mentioned. And a _good_ documentation,
>>
>
> No problem. Send me the specs and $880 for the first 8 hours prepaid and
> I'll get right on that for you.
>
> In the abscence of getting paid, I and most people here will continue to do
> what *we* want to do with our free time, which for me at least currently
> doesn't include writing IR remote decoding routines so that demanding people
> can use them for free.
>
>
Olin, there you go again, trying to get paid. Don't you know that the
WWW is suppoz'ta be FREE?<G>
--Bob A
> ********************************************************************
> Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products
> (978) 742-9014. Gold level PIC consultants since 2000.
>
>
> Look at references for python for example. Plain and clear
> routines, only necessary values to be passed and a useful result.
> THIS is why it is popular.
For things that are a part of the core python distribution, try
something like the shader plug-in for python array processing. You are
asking for some specific library that cant possibly exist to be made
nice and easy for you.
Every IR remote does its own thing wrt button presses and what code they
put out. something that does what you want would need several megabytes
of pure data just to look up what a given code means. And then the same
code is likely to have several different meanings. IE the same code
might be used by different manufacturers to do different things. What
you want wont exist and cant exist.
Pull your finger out point a remote at your receiver module and plug in
an oscilloscope.
>
>> Olin, there you go again, trying to get paid. Don't you know
>> that the WWW is suppoz'ta be FREE?<G>
>> --Bob A
>
> Haha, let me know when Apple sets up iCode and then some
> spotty kids P2P free iCode
iCode? ???????
He was making a joke back to the original poster stating indirectly
that "code isn't always given away for free".
> It seems to me as if the creators of theses codes
> have never ever reached adulthood. And this is meant in a
> negative way. All comments I have read in the code are totally
> useless as they describe what everyone has already noticed.
>
Well, yeah. An awful lot of "open source" software sucks. The whole
thing is subject to Sturgeon's law, and your comment about adulthood is
probably literally true: a lot of the code you find is going to be
someone's school project or homework assignment, or indeed some
non-adult who thought "hey, it works! This is cool, I'm going to post
it on the net!" A good portion of the rest is likely to be "personal"
code where someone thought "I'll make better comments later" and never
got around to it, but was kind enough to make it available "as-is"
anyway.
It's still worth more than you paid for it.
> Look at references for python for example.
Yeah, there are some shining examples of how well open-source can work
under ideal circumstances. Even in those areas, you get occasional
gratuitous changes in behavior that a commercial effort could never
have gotten away with. (Ask me about the order of string concatenation
vs macro expansion in the gcc preprocessor! Grr.)
> No playground. And I say this with conviction even though I am
> creating a hobbiist project.
Are you going to publish YOUR project before the eyes of the cruel and
critical world? Great! Then there will be one shining example of a
perfect and well documented IR command receive routine for the rest of
us to use. No doubt.
> For example(in picbasic): "PORTA = PORTA >> 1 & %00001111 'PORTA
> moving 1 to the right whereas bit 4 to 7 are hidden." Totally
> useless. I am asking WHY this is done exactly there to get a clue
> what to delete or expand and not what it does.
I can symphathize.. I try hard not to comment WHAT I'm doing, so much
as WHY I'm doing it.. If you can't read AVR asm code, you should put
my code down and get someone who can :) The more important thing is
to document why we are doing what we are doing, and in some rare
cases, why I didn't use the ovbious route or did use some special
"evil hack".
On Wed, 27 Jun 2007, William Chops Westfield wrote:
> An awful lot of "open source" software sucks.
I don't think suckiness is limited to open source software. I see a
lot of jaw-droppingly bad software for PICs and other microcontrollers
written by people who do it for living.
> Python was meant as a huge resource - as any opensource software -
> which was founded and cultivated by many people and given to all
> people for free.
>
> Python equals not only a high amount of data but also high quality
> information. Anything is restricted to what is necessary in the
> documentation but there are still thousands of pages for it.
>
> I recommend anyone to read a programming language manual to know what
> this means.
>
> If everyone had thought about getting money for it, how could this
> opus have been made ?
You can get plenty of free implementations of IR receiving on the 'net.
Just because it isn't nicely packaged as a Python module doesn't make it
useless. Your original gripe isn't about people making money. It's about
imperfect documentation and modularity. Stop throwing random arguments
around and mixing things together.
> Engineers don't have this thinking. They expect themselves to be
> superior to others whereas they are not even superior to nature. They
> are using nature.
> They are unsatisfied and grumbling species with a lack of empathy.
I'm not an engineer (yet), but for the sake of the argument let's assume
I were one. Here's your logic: you want something. A particularly
esoteric something, I must say (there are certainly more people around
who would like a language like Python than people who need IR decoding
routines for microcontrollers). You don't know / don't care / don't want
to write it yourself, so you go looking for it on the Internet. You find
that most people who wrote their own versions did so either without
particularly worrying about portability, modularity, or comments.
However, instead of trying to use the code and/or documenting it for
others to use (which is what people - yourself included - should do,
according to your own arguments), since you can't understand what the
code does, and refuse to learn, you go on a rant on a mailing list
insulting everyone and demanding a free solution. Last time I checked,
this sort of behavior was pretty characteristic of -gasp- a child.
I'm going to need a PIC development environment under Linux that
supports my custom bootloader by calling an external programming tool
(which I wrote in Python, by the way, and which I DID document well
enough to be used by pretty much anyone with half a brain). PikLab is
great, but only supports built-in programming algorithms, and I didn't
want to reimplement the entire loader in C++ for inclusion in PikLab.
Did I go on a gripe on the PikLab mailing list about the absence of such
a basic feature as running external programming tools? No, I went in
myself and CODED IN A BUTTON TO DO IT.
I'm going to need all this in a live distro to use in a workshop I'll be
giving in a few weeks. There is no PIC-oriented distro that I know of.
Did I go whining at Knoppix or Ubuntu for not including PikLab and
gputils? No, I'm making my own derivative.
Moral of the story: ranting about subpar (by your standards) open-source
or free software (or hardware) has been tried over and over and over
again. It has never worked, it will never work, and you'll be best off
not doing it. This applies to everyone, and has nothing to do with
engineers in particular. Get your ass together, grab a scope or a logic
analyzer, figure out the codes for your remote, write the code, and post
it somewhere. (Or don't. Unlike you, others won't demand it from you,
and won't whine if it isn't perfect). The "no money for a scope" excuse
doesn't work here, by the way. You've got a perfectly good scope built
in to your computer that can handle IR bitstreams. It's called a sound card.
For what it's worth, I'm sure if the "gods" that programmed Python saw
your message, they'd get a really good laugh out of it.
On Wed, Jun 27, 2007 at 01:33:39PM -0700, Bob Blick wrote: {Quote hidden}
>
> > > An awful lot of "open source" software sucks.
>
> Let's see... my iPod has several glaring bugs, and my
> new Samsung refrigerator has a bug so big it makes the
> compressor run 24 hours a day.
>
> Personally I think the quality of open source software
> is improving and quality of closed source software is
> the same or getting worse.
Open source can always be improved, closed source...
I just noticed that my cell phone has a absurd bug where if you try to
add a name to the address book twice, you get two seperate entries. But
if you try to delete the dupe, both entries are deleted. I ran into when
I needed to get into a building, and the only way was to call my friend
inside with the keys... Not having his phone number meant I got to climb
a rusting 9 story high fire escape with railings just a little above my
knees and a hinged and swinging 30ft ladder at the start with a
*rotating pipe* over one of the rungs 15ft up. (darling building,
spadina and adalaide)
Now if it were open source, I, or someone else, could have fixed that
bug long ago. Instead it will never be fixed and the manufactuer will
likely make the same mistake again.
Of course, if it were open source, chances are the first version would
be made by some teenager in mom's basement, but at least it can improve,
and often does.
I can think of a couple of reasons for duplicate entries:
1: If there is voice recognition for selecting a call destination, and
more than one person using the phone, like me and my wife with one phone
between us, there will have to be an entry for each voice recognition
pattern.
2: If there are more numbers (voice, E-mail, etc.) than there are normal
slots for, then the only way to store them is create another entry.
In either case, maybe that's the way it should be, if you want to get
rid of someone, just have one time, and all done.
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Wed, Jun 27, 2007 at 01:33:39PM -0700, Bob Blick wrote:
>
>>>> An awful lot of "open source" software sucks.
>>>>
>> Let's see... my iPod has several glaring bugs, and my
>> new Samsung refrigerator has a bug so big it makes the
>> compressor run 24 hours a day.
>>
>> Personally I think the quality of open source software
>> is improving and quality of closed source software is
>> the same or getting worse.
>>
>
> Open source can always be improved, closed source...
>
> I just noticed that my cell phone has a absurd bug where if you try to
> add a name to the address book twice, you get two seperate entries. But
> if you try to delete the dupe, both entries are deleted. I ran into when
> I needed to get into a building, and the only way was to call my friend
> inside with the keys... Not having his phone number meant I got to climb
> a rusting 9 story high fire escape with railings just a little above my
> knees and a hinged and swinging 30ft ladder at the start with a
> *rotating pipe* over one of the rungs 15ft up. (darling building,
> spadina and adalaide)
>
> Now if it were open source, I, or someone else, could have fixed that
> bug long ago. Instead it will never be fixed and the manufactuer will
> likely make the same mistake again.
>
> Of course, if it were open source, chances are the first version would
> be made by some teenager in mom's basement, but at least it can improve,
> and often does.
>
> - --
> http://petertodd.org
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.1 (GNU/Linux)
>
> iD8DBQFGgubx3bMhDbI9xWQRAg8bAKCDMoS7vuExj7qppDVzV2yitrJpVwCcCPbv
> fLNAA5jrOy3wigtiTonTl9M=
> =jEpv
> -----END PGP SIGNATURE-----
>
>>> An awful lot of "open source" software sucks.
>
> Let's see... my iPod has several glaring bugs, and my
> new Samsung refrigerator has a bug...
I meant "sucks" in ways other than bugs. Code can be
beautiful and still have bugs, though more often I
agree that commercial code is frequently both buggy
and ugly.
We usually publicly embarrass perpetrators of especially
bad code and make snide remarks about "bottom 5%" or
"top 5%", depending on the cynicism vs sarcasm switch.
My last complaint was about:
> My last complaint was about:
>
> char g_md_buffered[9]={"", "", "", "", "", "",
> "", "", ""};
Have you ever been in the situation where you think
there might be a compiler bug, and write a bunch of
seemingly unnecessary code, or overly clunky stuff,
just to try to get a handle on what's wrong? Perhaps
that code sample was from someone suspecting a
preprocessor bug and it just got left like that.
I wouldn't mind if my refrigerator had code like that
in it, as long as the temperature was regulated
properly, which it isn't.
>> My last complaint was about:
>>
>> char g_md_buffered[9]={"", "", "", "", "", "",
>> "", "", ""};
>
> Perhaps that code sample was from someone suspecting a
> preprocessor bug and it just got left like that.
>
No. Committed code. Theoretically it had been compiled,
run through static analysis, and REVIEWED before the commit.
I wasn't so much pissed at the coder as disgusted that none
of the rest of the process managed to catch it.
It's apparently not incorrect C (this claim sparked some
discussion), though I would have hoped
that the picker static analysis tools would have complained
that it didn't look "right." I only found it cause I was
using a fussier compiler.
On Thu, 28 Jun 2007, William Chops Westfield wrote:
>>> My last complaint was about:
>>>
>>> char g_md_buffered[9]={"", "", "", "", "", "",
>>> "", "", ""};
>>
> It's apparently not incorrect C (this claim sparked some
> discussion), though I would have hoped
> that the picker static analysis tools would have complained
> that it didn't look "right." I only found it cause I was
> using a fussier compiler.
Yes, it is legal C, even though the results are meaningless. The
author was unbelievably lucky if that array was initialized with
zeros, if that was the intent.
I threw that code at several compilers and static analysis tools, and
even the most brain-dead issued a warning. Which compiler let that
slide silently?
> On Thu, 28 Jun 2007, William Chops Westfield wrote:
>
> >>> My last complaint was about:
> >>>
> >>> char g_md_buffered[9]={"", "", "", "", "", "",
> >>> "", "", ""};
> >>
> > It's apparently not incorrect C (this claim sparked some
> > discussion), though I would have hoped
> > that the picker static analysis tools would have complained
> > that it didn't look "right." I only found it cause I was
> > using a fussier compiler.
>
> Yes, it is legal C, even though the results are meaningless. The
> author was unbelievably lucky if that array was initialized with
> zeros, if that was the intent.
>
> I threw that code at several compilers and static analysis tools, and
> even the most brain-dead issued a warning. Which compiler let that
> slide silently?
>
I think the more egregious problem is the one on the left side of the '='
>> char g_md_buffered[9]={"", "", "", "", "", "", "", "", ""};
>
> I think the more egregious problem is the one on the left side of the
> '='
>
I give up, What's wrong on the left ?
>
> On Jun 28, 2007, at 1:57 PM, Neil Baylis wrote:
>
> >> char g_md_buffered[9]={"", "", "", "", "", "", "", "", ""};
> >
> > I think the more egregious problem is the one on the left side of the
> > '='
> >
> I give up, What's wrong on the left ?
>
> BillW
>
> On 6/28/07, William Chops Westfield <westfwspam_OUTmac.com> wrote:
>>
>> On Jun 28, 2007, at 1:57 PM, Neil Baylis wrote:
>>
>>>> char g_md_buffered[9]={"", "", "", "", "", "", "", "", ""};
>>>
>>> I think the more egregious problem is the one on the left side of the
>>> '='
>>>
>> I give up, What's wrong on the left ?
On 6/28/07, John Temples <@spam@piclist2KILLspamxargs.com> wrote:
>
> There is nothing you could put between the square braces that would
> make that code correct or meaningful.
>
hehe, that's true, and pretty funny. The problem I'm referring to
won't be noticed by a compiler, or even at runtime. The problem will
manifest sometime in the future, when somebody needs to change the
size of the array, and there's all this code that has '9' hard coded
into it. What are you going to do.. global search and replace on the
digit '9' ?
>-----Original Message-----
>From: KILLspampiclist-bouncesKILLspammit.edu [RemoveMEpiclist-bouncesTakeThisOuTmit.edu]
>On Behalf Of Neil Baylis
>Sent: 29 June 2007 05:14
>To: Microcontroller discussion list - Public.
>Subject: [PIC] Receiving Infrared and common problems with engineers.
>
>
>On 6/28/07, John Temples <spamBeGonepiclist2spamBeGonexargs.com> wrote:
>>
>> There is nothing you could put between the square braces that would
>> make that code correct or meaningful.
>>
>
>hehe, that's true, and pretty funny. The problem I'm referring
>to won't be noticed by a compiler, or even at runtime. The
>problem will manifest sometime in the future, when somebody
>needs to change the size of the array, and there's all this
>code that has '9' hard coded into it. What are you going to
>do.. global search and replace on the digit '9' ?
But it's syntacticly correct, even if it's poor style. I don't know of a compiler that will complain because a magic number was used instead of a defined symbol.
Regards
Mike
=======================================================================
This e-mail is intended for the person it is addressed to only. The
information contained in it may be confidential and/or protected by
law. If you are not the intended recipient of this message, you must
not make any use of this information, or copy or show it to any
person. Please contact us immediately to tell us that you have
received this e-mail, and return the original to us. Any use,
forwarding, printing or copying of this message is strictly prohibited.
No part of this message can be considered a request for goods or
services.
=======================================================================
On 29/06/07, John Temples <TakeThisOuTpiclist2EraseMEspam_OUTxargs.com> wrote:
> On Thu, 28 Jun 2007, Neil Baylis wrote:
>
> > look between the square braces..
>
> There is nothing you could put between the square braces that would
> make that code correct or meaningful.
On 6/29/07, Michael Rigby-Jones <RemoveMEMichael.Rigby-JonesTakeThisOuTbookham.com> wrote:
>
> But it's syntacticly correct, even if it's poor style. I don't know of a compiler that will complain because a magic number was used instead of a defined symbol.
I never said anything about whether or not it was syntactically
correct. I said it was a more egregious error. In my world, any error
caught by the compiler is trivial, because the code will fail to
build. (This goes for warnings as well.) But this is an error that can
cause severe difficulties, and is not caught by the compiler. If it
gets through the code review, it can take months or years to cause
trouble.
To label it as 'poor style' is to trivialize it, to put it in the same
league as indentation, or whether you put a space after a '('.
If a job applicant, in an interview at my company, wrote some code
that had a syntax error (e.g. an undefined variable) it would not be
cause for alarm. If they wrote code that had magic numbers like this,
they might be shown the door rather quickly.
>-----Original Message-----
>From: piclist-bouncesEraseME.....mit.edu [EraseMEpiclist-bouncesmit.edu]
>On Behalf Of Neil Baylis
>Sent: 29 June 2007 15:12
>To: Microcontroller discussion list - Public.
>Subject: Re: [PIC] Receiving Infrared and common problems with
>engineers.
>
>
>On 6/29/07, Michael Rigby-Jones
><RemoveMEMichael.Rigby-JonesEraseMEEraseMEbookham.com> wrote:
>>
>> But it's syntacticly correct, even if it's poor style. I don't know
>> of a compiler that will complain because a magic number was used
>> instead of a defined symbol.
>
>I never said anything about whether or not it was
>syntactically correct. I said it was a more egregious error.
>In my world, any error caught by the compiler is trivial,
>because the code will fail to build. (This goes for warnings
>as well.) But this is an error that can cause severe
>difficulties, and is not caught by the compiler. If it gets
>through the code review, it can take months or years to cause trouble.
>
>To label it as 'poor style' is to trivialize it, to put it in
>the same league as indentation, or whether you put a space after a '('.
I'm not trivialising it. Perhaps "poor coding practice" is a better description than "poor style", and then only within a full application. If someone posts a trival code example for comment, then including all the literal definitions for such things as array sizes is neither required nor desirable IMO.
Regards
Mike
=======================================================================
This e-mail is intended for the person it is addressed to only. The
information contained in it may be confidential and/or protected by
law. If you are not the intended recipient of this message, you must
not make any use of this information, or copy or show it to any
person. Please contact us immediately to tell us that you have
received this e-mail, and return the original to us. Any use,
forwarding, printing or copying of this message is strictly prohibited.
No part of this message can be considered a request for goods or
services.
=======================================================================
>
> On Thu, 28 Jun 2007, Neil Baylis wrote:
>
> > look between the square braces..
>
> There is nothing you could put between the square braces that would
> make that code correct or meaningful.
>
> > On 6/28/07, William Chops Westfield <RemoveMEwestfwTakeThisOuTspammac.com> wrote:
> >>
> >> On Jun 28, 2007, at 1:57 PM, Neil Baylis wrote:
> >>
> >>>> char g_md_buffered[9]={"", "", "", "", "", "", "", "", ""};
> >>>
> >>> I think the more egregious problem is the one on the left side of the
> >>> '='
> >>>
> >> I give up, What's wrong on the left ?
>
> --
> John W. Temples, III
John Temples wrote:
> On Thu, 28 Jun 2007, Neil Baylis wrote:
>
>> look between the square braces..
>
> There is nothing you could put between the square braces that would
> make that code correct or meaningful.
Sure there is. Try putting ][1 between the square braces:
100% correct C. If replace the 1 with something else, you could actually
make some space for non-zero-length strings as well. Takes care of the
code style problem as well. It may or may not be what the original coder
wanted, but I could certainly see may places where that line of code
would be useful (with >1 size).