Electronics - Features and bugs

When something doesn't go according to plan when you are programming, it's called a bug.

When that same things turns out to be useful, it's called a feature.

It's a handy distinction, and is used a lot in the software industry for marketing an faulty product.

When my fish hit their feed lever, the program is supposed to feed them one dose of feed, then restrict them from having any more for a set period. The thing is, my software allows them an extra feed if they haven't fed for a while. I cant figure out why, but I suspect it has something to do with the fact that there are two programs running simultaneously. Or at least pretending to. The chip actually just takes it in turns running one line from each program.

Actually there are three programs running...


1. checking everything over and over for changes in things like permission to feed.

2. checking over and over for lever presses.

3. reporting over and over how many feeds so far have been given for the day.


Now I think what is happening, is that the bit that checks for lever presses, diverts the program after a fish hits the lever to change a few things. For one thing it changes the permission for the fish to get a feed to "no".

But I think the part of the program that is checking to see if the fish are allowed to feed, sets the light on and activates the lever to allow a feed, before the bit that did the feeding can turn it off. The result is, there is a delay between giving the feed, and having the device decide it has actually done that.

If the fish were allowed to feed, say 5 times so far today, but haven't, they are allowed two feeds in a row.

That's a feature.

I invented that.




120 things in 20 years - In electronics, like aquaponics, sometimes bugs are features.

No comments:

Post a Comment

Popular Posts