PATCH-INSTRUCTION FOR VCAL ========================== IMPORTANT: VCAL may be changed in the future, so don't rely on any absolute patch positions! Always search for the given patterns to find the right position to place the patched values. The patch consists of two patches in fact: One for the voltage offset, which is a 16-bit integer value and one for the [i]nfo screen to give the user a clear message about the offset value. That one is simple asci-string. More later. 1. The placement ---------------- a) The 16-Bit offset value Search for the pattern 6, 64 - that is two successive bytes with the value 6 and 64 (that is the code for ADDI.W #literal, D0 - it's unique in the code). The *following* two bytes are the 16-Bit value to patch (order: High/Low). b) The ASCII code for the [i]nfo screen Search for two patterns, one is 99, 116, 105, 111, 110 (ASCII 'ction' from 'correction'). Add 7 to the position of 99, that's where the sign belongs (+ or -). Since the '0.' never changes, add another 3 from the sign's position and place the 3 bytes for the voltage. In other words, the string lookes like: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 ... correc t i o n : + 0 . 0 1 2 V The positions 8 and 9 as well as 13 never change. Just replace position 7, 10, 11 and 12. Remember, that are bytes representing the ASCII value of the character shown. 2. How to form the 16-bit offset value -------------------------------------- First you have to build the right value, since not all user requests are possible. The resolution of the Pilot's 'voltmeter' is 1/78 V, decimal that is 0.0128205 V. So, if a user requests i.e. 0.020V, only ~0.025 is possible. It's up to you, how to offer this resolution, my patch program just calculates a 'best possible correction' and tells the user. I restrict the resolution to 3 digits. In a graphically designed UI, you might use a slider that offers only the possible steps. However, when you have that value, convert it to 1/78th volts and store it in an 16-bit integer value (i.e. $0003 equals a correction of 3/78V or ~0.038V). For negative correction, subract your value from 0. $FFFF represents -1 (i.e. $FFFD equals a correction of -3/78V or ~ -0.038V). Additionally I restricted the input to -0.4V to +0.4V, that should be enough for all users. Too high values might cause extreme confusion for the OS, since also the warning level management gets the corrected value. That means, if you correct too much in positive direction, the Pilot never realizes a low battery situation and the user might loose data. Too much negative correction might be worse even, since the Pilot might refuse to power on even with a full battery :). I didn't try all of that in detail, it's nonsense anyway . 2. How to form the ASCII string for the [i]nfo screen ----------------------------------------------------- Well, not much to say on that one. Just build an ASCII string, representing the correction in a decimal number, but don't take the user input, it might not represent the actual correction. My patch program first calculates the 16-Bit value for the true correction, then I multiply that value with 0.0128205V (rounded to 3 digits). That is then the true correction value. (c)Peter Strobel, 1998