hey guys
here is an update:
thanks to sbz, I am now working on getting Mata Hari talking to
FP. Chaos has also given me permission to use his Mata Hari table as a test. So with a bit more work, it might not be long before you can see an
FP table responding directly to a rom.
Now, about improving speed. I have some ideas about this and I would like some feedback from anyone with experience in this field.
Basically, pinmame sends a list of lights to update. Using the current method, the data sent is too slow - it won't be able handle more than about ten lights per second, which is not quick enough.
So I had an idea, which is to send the data in a more compressed format. The idea is that instead of sending single lights, you send all the 'changed light' data in a single packet. Here is my idea - instead of sending individual light numbers, you send the first light, and from then on you send the difference between that and the next light.
what I'm thinking is to use a timer in
FP so it know it is receiving data from AutoIT. That is to say, if it gets two keypress signals which are within a millisecond, it knows this is switch data. We will see if this works, I think it might.
Anyway, what I'm thinking is that perhaps a key signal down and then back up again could be used as the 'handshaking' for the data as well, i.e key 'L' down means 'receive light on data' and then 'key L up' means 'stop receiving light on data'.
So the system would work out the biggest 'gap' between the lamp numbers that need to change, and use that to determine how many bits to use for each 'change'. It would then send that data, which light to start with, and then the differences between each light.
So for example. Let's say pinmame says 'switch on light 2,3,6,7,10,12,13,14,16'
So the biggest gap is between 3 and 6, or 7 and 10, which is 3. So we need two bits to describe the differences.
so what we would do to send this data would be something like this
Key 'L' up, followed by 7 bits for the first light (2, i.e '0000010'), and then three bits to tell the system how many bits it needs for the difference (i.e 0 to 7).
in this case we only need 2 bits to describe the difference between each light. So we could send a data stream like this:
0000010 for 'light 2', followed by '010' meaning 'two bits per difference', followed by '01 11 01 11 10 01 01 10'
this means 'start with 2, add 1, then add 3, then add 1, then add 3, then add 2, then add 1, then add 1, then add 2.'
which would give you 2,3,6,7,10,12,13,14,16 as described.
encoding this gives a data stream of 0000100100111011110010110
if converted to hex, using the previous method, we can send this data in three keypresses. However, if, as I was thinking, we might be able to use base 64 (i.e 64 different key presses), then potentially the information could be sent in only 2 keypresses.
So it means we can send 'light on' data for 9 lights in only four key presses - that is 'start light data + light data + end light data'
What is interesting about this method is that the more lights there are, the better the compression is, because the closer together the numbers are. So even sending, say, 60 lights at once could potentially only require around 8 to ten key presses - which may just be quick enough.
Anyway, I hope that makes sense. It should mean that a lot of light data could be sent quite quickly.
What can I say, I like to play with numbers! If you get what I am blabbing on about, please feel free to comment and suggest improvements.
Edited by highrise, 14 January 2011 - 11:55 PM.