I’m making great progress on my application to control my 1200 Pro 1 unit. I can now send and receive a full list of all items available in the unit – LFO parameters, Sounds, Programs etc.
It took me a whole day just to figure out the chksum formula, once I’d got it working, and reread the explanation it was pretty simple:
for(count = 0; count < len; count++)
chksum = ((chksum << 1) | (chksum >> 15)) + msg[count];
It was the rotation part that I had misunderstood.
Another thing I learned today was “strict weak ordering” this is required for the sort algorithm in the C++ STL template libraries. C++ is very fussy about how you write a compare routine for the sort function. I had taken a shortcut in my code by using a flag for the sort direction (ascending or descending). After I had resolved if A was less than B, I used the direction flag to invert the logic at the end. The problem with this arises when you have comparisons where A < B is not an exact inversion of B < A. This occurs when A and B are the same, in this situation A < B is false, and B < A is also false. By doing the comparison in one way only, and inverting the logic at the end I don’t return the same answer. This has a major effect on the sort routine, causing it to start submitting random memory locations to the compare routine causing a seg fault.