On Wed, 2011-09-14 at 11:48 +0200, Ingo wrote:
> Hi Roman,
> 
> thanks for taking the time looking at the code. Unfortunately your version
> will be sending even many more wrong numbers.
> 
> I have put some list messages into your patch. Keep clicking onto them
> randomly and you will see that the headers change between 6, 7, 14 and 15.
> Sometimes they are correct - sometimes not.
> 
> The problem is due to the change object inside the debyte object. Leaving it
> out would always send all 8 bits for the group of pins. Leaving it in will
> keep holding old values.

Gotcha. I removed the [change] objects from the [pd debytemask]
subpatch. And I also agree, that it would be ugly, if digital pins fire
without changing their state.

> I cannot see any way other than using individual debyte objects for each
> group unless you would come up with something completely different like
> storing everything into an array and sending from there (after checking what
> has changed) which would be much more complicated.

Actually, I found the table based approach not that complicated and I
think it is more scalable (it covers all possible 16 groups). I added a
[pd polychange] subpatch that does exactly what you describe. I
hopefully tested it more thoroughly this time. See attached patch.

Cheers
Roman


#N canvas 0 53 450 300 10;
#N canvas 179 119 538 392 digital 0;
#X obj 42 17 inlet;
#X obj 42 334 outlet;
#X msg 42 120 0 \$1;
#X msg 80 120 1 \$1;
#X msg 118 120 2 \$1;
#X msg 156 120 3 \$1;
#X msg 194 120 4 \$1;
#X msg 232 120 5 \$1;
#X msg 270 120 6 \$1;
#X msg 312 120 7 \$1;
#X obj 42 215 +;
#X obj 378 113 & 15;
#X msg 42 310 digital \$1 \$2;
#X obj 378 134 * 8;
#X obj 42 237 pack float float;
#X obj 42 170 unpack float float;
#N canvas 289 142 450 300 debytemask 0;
#X obj 32 140 & 1;
#X obj 82 139 & 2;
#X obj 132 139 & 4;
#X obj 182 139 & 8;
#X obj 232 139 & 16;
#X obj 282 139 & 32;
#X obj 332 139 & 64;
#X obj 382 139 & 128;
#X obj 32 220 outlet;
#X obj 82 220 outlet;
#X obj 132 220 outlet;
#X obj 182 220 outlet;
#X obj 232 220 outlet;
#X obj 282 220 outlet;
#X obj 332 220 outlet;
#X obj 382 220 outlet;
#X obj 32 76 trigger float float float float float float float float
;
#X obj 32 32 inlet;
#X obj 82 160 >> 1;
#X obj 132 160 >> 2;
#X obj 182 160 >> 3;
#X obj 232 160 >> 4;
#X obj 282 160 >> 5;
#X obj 332 160 >> 6;
#X obj 382 160 >> 7;
#X connect 0 0 8 0;
#X connect 1 0 18 0;
#X connect 2 0 19 0;
#X connect 3 0 20 0;
#X connect 4 0 21 0;
#X connect 5 0 22 0;
#X connect 6 0 23 0;
#X connect 7 0 24 0;
#X connect 16 0 0 0;
#X connect 16 1 1 0;
#X connect 16 2 2 0;
#X connect 16 3 3 0;
#X connect 16 4 4 0;
#X connect 16 5 5 0;
#X connect 16 6 6 0;
#X connect 16 7 7 0;
#X connect 17 0 16 0;
#X connect 18 0 9 0;
#X connect 19 0 10 0;
#X connect 20 0 11 0;
#X connect 21 0 12 0;
#X connect 22 0 13 0;
#X connect 23 0 14 0;
#X connect 24 0 15 0;
#X restore 42 85 pd debytemask;
#X obj 42 38 t a a;
#X msg 69 60 \$1;
#X msg 42 60 \$2;
#N canvas 315 128 443 301 polychange 0;
#X obj 23 20 inlet;
#X obj 23 242 outlet;
#X obj 236 12 table \$0.digital.in.cache 128;
#X obj 23 87 tabread \$0.digital.in.cache;
#X obj 23 64 unpack f f;
#X obj 23 109 !=;
#X obj 23 131 sel 1;
#X obj 23 42 t a a;
#X obj 23 153 list append;
#X obj 83 242 tabwrite \$0.digital.in.cache;
#X obj 23 175 t a a a;
#X msg 248 215 \$1;
#X msg 83 213 \$2;
#X connect 0 0 7 0;
#X connect 3 0 5 0;
#X connect 4 0 3 0;
#X connect 4 1 5 1;
#X connect 5 0 6 0;
#X connect 6 0 8 0;
#X connect 7 0 4 0;
#X connect 7 1 8 1;
#X connect 8 0 10 0;
#X connect 10 0 1 0;
#X connect 10 1 12 0;
#X connect 10 2 11 0;
#X connect 11 0 9 1;
#X connect 12 0 9 0;
#X restore 42 273 pd polychange;
#X connect 0 0 17 0;
#X connect 2 0 15 0;
#X connect 3 0 15 0;
#X connect 4 0 15 0;
#X connect 5 0 15 0;
#X connect 6 0 15 0;
#X connect 7 0 15 0;
#X connect 8 0 15 0;
#X connect 9 0 15 0;
#X connect 10 0 14 0;
#X connect 11 0 13 0;
#X connect 12 0 1 0;
#X connect 13 0 10 1;
#X connect 14 0 20 0;
#X connect 15 0 10 0;
#X connect 15 1 14 1;
#X connect 16 0 2 0;
#X connect 16 1 3 0;
#X connect 16 2 4 0;
#X connect 16 3 5 0;
#X connect 16 4 6 0;
#X connect 16 5 7 0;
#X connect 16 6 8 0;
#X connect 16 7 9 0;
#X connect 17 0 19 0;
#X connect 17 1 18 0;
#X connect 18 0 11 0;
#X connect 19 0 16 0;
#X connect 20 0 12 0;
#X restore 7 13 pd digital messages roman;
_______________________________________________
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list

Reply via email to