firmata / firmata_test

Test application for the firmata protocol
33 stars 22 forks source link

Problem with Servo mode while using Extended Analog messages #6

Closed OlivieriIan closed 8 years ago

OlivieriIan commented 8 years ago

Hi

I had a problem with the angle 128 for the extended analog message (pins > 15)

What I did was: I changed pin's 16 mode to Servo. While sniffing the port with "Device Monitoring Studio" I gently moved the slider to get all the values in the range. I did it several times to verify that it was no coincidence, and the result obtained was consistent.

Values obtained can be seen in the following file:

servo message analysis.txt

specifically, what I got while moving from 127 to 128 was: F0 6F 10 7F F7 (message for 127) F0 6F 10 00 F7 (message for 128) <-- this should be F0 6F 10 00 01 F7

Snap solves this problem by sending a fixed lenght message for each value: F0 6F 10 00 00 F7 (message for 0) F0 6F 10 7F 00 F7 (message for 127) F0 6F 10 00 01 F7 (message for 128)

soundanalogous commented 8 years ago

Does it only happen with 128 or are all values > 127 truncated at 127?

OlivieriIan commented 8 years ago

only with 128, although the value that follows it is 130, not 129, so i don't really know if 129 has the same issue

soundanalogous commented 8 years ago

I suspect the issue is here. Should be if (val >= 0x00000080) buf[len++] = (val >> 7) & 0x7F; etc rather than if (val > 0x0x00000080...

OlivieriIan commented 8 years ago

makes sense. But how do I change the program to test if that's the problem? Sorry for the newbie question, but I really don't know

soundanalogous commented 8 years ago

No one is really maintaining the firmata_test application anymore. However I'll see what I can do. It may not get to it for a couple of weeks because I'll be traveling.

soundanalogous commented 8 years ago

What is it exactly that you need from firmata_test? It would probably be easier for me to write an entirely new cross-platform application in Java or JavaScript (using something like NW.js) than it would be for me to try to maintain the firmata_test application.

OlivieriIan commented 8 years ago

No problem, I just wanted to let you know about the issue, just that. I was playing with an arduino and the app, discovered it and felt like telling you guys about it.

Thanks for your help man :)