I’ve been hacking away at all of the drivers, making them meaner, leaner and easier to use. To go back to the HTAC (HiTechnic Accelerator Sensor) driver as an example, check this out:

  HTAC-test1.c
(in suite v 1.8.1)
HTAC-test1.c
(1st round)
HTAC-test1.c
(now)
Total code bytes 4598 1643 (-64%) 1,387 (-70%)
Memory locations 716 420 (-41%) 200 (-72%)
Procedures 59 22 (-63%) 15 (-75%)

  HTAC-SMUX-test1.c
(in suite v 1.8.1)
HTAC-SMUX-test1.c
(1st round)
HTAC-SMUX-test1.c
(now)
Total code bytes 4618 4319 (-6%) 3208 (-31%)
Memory locations 716 652 (-9%) 420 (-41%)
Procedures 57 46 (-19%) 32 (-44%)

Mind you, not all drivers are going to get such big reductions in their memory and task usage, but this should give you an idea.

Other stuff I’ve done is remove the necessity to initialise the Sensor MUX or doing a port scan of the connected sensors in your program. The MUX is automatically configured now without the need to scan on a per-sensor basis. This is also how the official HiTechnic NXT-G blocks operate. I’ve also removed a bunch of functions I felt were just unnecessary and had better alternatives.

I don’t think I’ll be merging the IR Seeker and Colour Sensor drivers, I think it will make the drivers unnecessarily complex. I don’t think many people are using the old sensors now anyway, so that will stay the way it is, for now.

There’s not a lot left to do.  I will need to go through all the drivers and add the differences between them and the versions shipped with 1.8.1 to the individual changelogs.  Diff is your friend.

Tags