Pages

Monday, November 19, 2012

Paleo-Dieting

Things are looking up.

I've got a rental offer on my rack of sennies and a short concert and some hours for the ballet (Nutcracker, of course -- what do you expect a ballet to be doing in December!)  Enough work to keep me busy until late Jan, although that isn't the same thing as enough pay to keep me fed.  And the first part of the year is usually a slow time in theaters.

So I still need to keep my eyes on other work/sources of income.



Before one of the checks I'd been waiting on came in, I was actually enjoying cleaning out some of the recesses of the pantry.  Some egg pasta that had been there for years, as well as a a lovely soup that came in the form of dried beans and herbs -- requiring overnight soak and a four-hour simmer and so on to cook.  Given time I might have gotten to the miso paste and udon noodles, which I seem to dig out about twice in a given year.

I was skipping lunch over the ten-hour work day, and walking to save gas (well, mostly to avoid having to find parking).  And I felt GREAT.

It's a bit of a paleo lifestyle.  We humans spent a long evolutionary span going for days between decent meals, and having to work hard to get that meal, too.  Well, evolutionary physiology is almost as much a quagmire of pop science and misconceptions and over-generalizations as evolutionary psychology, so don't try to take it too far!  All I know is that over a short term, I felt more alert and more fit than usual, and that is a good thing.  Enough that I almost missed having money and being able to buy food again.



The Morrow Project CBR is almost completed.  It is close enough I'm brushing off the sculpts for the Medkit and planning the casting process of that.  I think at this stage I'll just do simple two-piece silicone molds and slush-cast and glue it together (since I'm not trying to be crazy with internal electronics on that one).  And if the molds are any good, use them to experiment with thin-shell fiberglass (my latest reading suggests that the fiberglass eats even the almost indestructible silicone, meaning you get only a handful of pulls from each mold).

I spent most of my free time between performances writing a sub-routine that generates an incrementing random number (it creates n random digits and adds them to an existing stored 8-digit number).  I really need to study my C books more.  For some reason it was throwing up a ton of errors when I tried to pull a value from an array and add it to itself, so I was forced to copy the value to a variable and then stick it back in the array.  Which meant I couldn't do a nice loop/array sort of function for the overflow, but had to do it with a stack of nested if statements.

Any time you see more than three if statements in a stack or nest, especially if they are all referring to the same basic variables, you know you could simplify with a loop or boolean. 

But this all gets compiled anyhow, first via the Arduino IDE, then through avr-gcc, so a nest of if statements is not necessarily any worse at the hardware end.

So.  The software tasks to do:

1) Stack three or more of the "geiger click" subroutine to build an increasing threat (like the chem detector, which reads out a "parts per million" of the identified threat, and chirps the alarm (randomly) with an increasing frequency until it rolls over to full alert status.)

2) Split out the write_buffer part of the new incrementing random number generator so I can loop it with a static display.  The limitations of an 8-digit display; I can't just display "Accumulated RADS 456.34"  Instead I have to rotate through different screens.

3) Modify the rad alert siren.  The basic "timbre" is right (it isn't a wave generator, lacking in fact any analog capability.  What it is, is a mechanical speaker attempting to switch between two PWM frequencies at a fast third frequency, and creating all sorts of harmonics and noise in the process).  Anyhow, what it wants to do is stay on original pitch for an interval then fall rapidly.

4) With these parts, finalize the stages of the simulated radiation threat display.

5) Adjust the "injectable" light flash rate and make it linger into the reset with a flag for turning the selector to the TREAT position.  Right now it is using an arbitrary cut-off for whether the Universal Antidote will work on a given threat.  If I was really crazy I'd use a look-up table (or just organize the Threat table properly).  But then, the Threat table is a switch-case list -- I didn't go through the bother of creating a proper array for it.  And, yes, I did switch leads, to PWM a modern 20ma LED into looking like a vintage 2-5ma model.

6) Write the behavior for the "TREAT" position.  This includes a runtime-only counter (yes, the AVR is a modified Harvard architecture chip meaning a running program can actually write to the non-volatile "program" memory -- but I don't need to dig into that for a simple table prop.)



After that, it is pretty much soldering to the case components, glueing the speaker in, installing magnets to hold the lid on, and touching up the paint job.  I'd love to add a nameplate or stamp somewhere, but most of the ways of doing that would cost more money.  Well.....maybe could glue on a very thin sheet of metal and put a water-slide decal over that...

Thursday, November 15, 2012

Kudzu

It is said that good coding practice is dying as a consequence of Moore's Law.

But this isn't quite true in embedded computing.  Three days worth of kudzu code is now taking up a massive 9 KB of my available 12 KB of program memory.  Fortunately there are only a couple of functions left to write.

In a sense, they are still right.  I could write better-looking, more elegant, more compact and more ingenious code (not that these are necessarily the same thing!)  But it is more important to finish this box and take the lessons learned.  And if I have to, I have an ATmega328P lying around that would double my available program space.

It is also necessarily sprawling because of what I am trying to simulate; a combination of analog electronics and (shhh!) future high-tech.  So there are a lot of places where it "looks" right to blink a display three times, pause, then go to something else.  And getting the timing right on all these events is a bit of a pain.  And leads to a lot of nested loops.

Plus the need for transparency; to be able to switch states in the middle of a display sequence without the box throwing up garbage on the display.  To catch that is taking a whole lot of little weenie "If (so is still true) then (delete that and clean up)" lines of code.

Monday, November 12, 2012

The Morrow Progress

The CBR box is mostly assembled, and I've been coding up the behavior.  As is my wont, I've been thinking about the programming process.

But here's a pic:







Why is the pic so blurry?  Explanation and more boring text-ty stuff below the fold.  Plus more pics of me soldering things.


Job Hunt

The "Starving " part is getting too close to being literal.  I have over a week's worth of food in the apartment although that is mostly grains (aka some ten pounds of dry rice), and little that is attractive for breakfast or lunch (I'm currently soaking beans for a soup that MIGHT be ready by dinner).

So I'm looking for a third job.  Something I can fit in within the show schedule and other ongoing duties I already have.  And it hasn't been going well.  There's probably more design stuff being listed at TBA, but I can't afford the $70 membership to look at their listings.  TBA doesn't quite have the whole Bay Area wrapped up, but listings outside of their umbrella are more rare.  And, somehow, Mall Santa, DP for an independent film, and Egg Donor don't look attractive.

Wednesday, November 7, 2012

Cyber-Poverty

It's like something out of William Gibson.  More and more, in more and more places, "high tech" (aka electronics) is being worked on not in spotless labs with ranks of test equipment, but with rusty screwdrivers while propped precariously on top of a milk crate and surrounded by empty boxes of Chinese take-out.

It is a matter of perspective.  Technology has always needed to be patched and salvaged.  It has been happening from well before the days of background bicycle mechanics, probably way before the days of itinerant tin-smiths.  We just haven't (or at least some of us haven't) quite caught up on our Future Shock and we just aren't quite used to seeing shade-tree mechanics and third-world repairs and improvisations done to things that have LEDs and microprocessors and other digital parts.

Oh, yeah.

My laptop crashed, with my only copy of the software I was writing for the Morrow Project boxes.


Rant, and pics of things being soldered, below the fold.

Thursday, November 1, 2012

Oscar Wilde does Electronics

He did describe the event himself, but it is more usually told as a story; Oscar comes down to lunch one day and a friend of his asks, "Hard at work all morning, were you?"

To which the novelist and playwright responded "Indeed.  I just inserted a comma."

After lunch he vanishes back upstairs and is not heard from until dinner.  At which point the same friend asks "Another productive session, I hope!"

Unperturbed by the sarcasm, Oscar replies, "Most productive.  I deleted the comma I had inserted this morning."

Well, Oscar's excuse was that he was a perfectionist.  My excuse is procrastination.  Plus a middling amount of physical and mental exhaustion from opening weekend.  Being both a designer and a show operator takes a lot out of me mentally and emotionally.  And the long hours (and short rations) don't do much good for me physically, either!


So this morning, I inserted a resistor.