I was about to post this over at the mycockpit PM forum, but the server appears to have crashed! It's probably more appropriate in here anyway, so here goes:
I have built my own 737 EFIS units using the excellent GPWiz40 boards from Groovy Game Gear. I would like to assign 4 buttons for setting the MINS and QNH on my EFIS as follows:
Button 1 - Dec (-.01/-1)
Button 2 - Dec (-.1/-10)
Button 3 - Inc (+.01/+1)
Button 4 - Inc (+.1/+10)
Why you may ask? Because the real units do not use encoders, they are a four position (five if you count the OFF position) return-to-centre switch.
Twist left = decrement 1
Twist further left = decrement 10 (and round down to next multiple of 10, i.e. if you had QNH 1027 set and twisted hard left, it would jump to 1020)
Twist right = increment 1
Twist further right = increment 10 (and round up to next 10)
That's so that if you want to set a BARO of 1100 (for example) to bug the single engine acceleration altitude for take-off, it won't take as long to wind up from say 200 or whatever the previous BARO landing minima was set to. Or if you take off from an airport with a QNH of 985 and land at an airport with a QNH of 1036 etc.
So reading the PM Offsets list, there is a definition for the Elan K Codes near the bottom which contains the following:
-Suggestion:
V10 MINS
V11 BARO
V12 Copilot MINS
V13 Copilot BARO
V101002 (increments MINS by 2 units)
V110004 (decrements BARO by 4 units) V11 [baro] 0 [dec] 004 [4 units]
Send offset and value to write in UIPC...
E0 [offset] [numbytes] [value] (value can be anything after the 7th byte, with or without leading zeroes
E00BC081234.5 writes 1234.5 in 0XBC0 8 bytes (=double)
E004F42005 writes 5 into 0x4F4 (i.e. E0 04F4 2 005)
E004F422 writes 5 into 0x4F4
Can someone explain how I would configure FSUIPC to achieve the button assignments I want, e.g. to decrement the captain MINS by 10 units I would expect to use V100010. But do I use the FSUIPC MCP K-Codes by Param and if so what string should I use? Everything else I have assigned for my EFIS works well, but I am too stupid to figure this out without help.
I would like to achieve the rounding if possible but that would be the icing on the cake! I looked at Peter Dowson's forum and thought it might be possible using the LUA plugins, but reading the documentation for LUA maths functions, I can't find ROUND. One for the clever people out there?