Hi Matt,

(at last) I took a look at your servo library. You took a
well-engineerd approach, with cpu-efficient code with high resolution
as a result (afaik - I did not have a chance to run it yet...).
I do find the documentation a bit small though. Since there is no
description of the method (principle) you use, I had to reverse
engineer the code to know what's happening. And I still have not
figured out parts of it, like what the purpose of line 294 (if
servo_1_to_8_num < 8 then) is. Can you enlighten me?
I also see that sometimes you number servo's from 1 and in other cases
from 0. Like _servo_1_to_8_number_count that counts from 0 to 7...
Confusing... Why not make this all 0-based? Embedded programmers are
used to this!

Btw: changing line 147 from bit to byte like:
var byte _servo_1_to_8_isr_count = 0     -- ISR step count (0 - servo
pulse / 1 - idle state)
saves (in my case) 23 bytes of code and a byte of ram.

Also, using the processor delay routines in apps (samples) is a bad
example IMO, since it uses more program memory at each call. (And you
also miss the opportunity to show an other usefull lib to new users).
Changing to  the four delays in delay_100ms(10) in your sample saves
an other 27 bytes (at the one-time expense of 3 bytes ram). Each
additional delay takes 5 bytes, while the compiler delay takes (in my
case, 16f73 @ 20 MHz) 21 bytes.
I also expect we can improve if  servo_1_to_8_on is checked with a
bit-mask rather than the bitwise checks you do now, and if
_servo_1_to_8_set_level() are duplicated of ON and OFF (they are
inline, so they are duplicated in the target already).
Also, make 'reverse' optional allows to save an other 64 bytes (in my
2-servo setup).
All this stuff together saves 17% code memory and saves some cpu cycles too.

Quite a few tips, but as I said at the start: a well-engineerd
approach with cpu-efficient code and high resolution as a result.
Good job!

Joep

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en.

Reply via email to