Jump to content
The simFlight Network Forums

John Dowson

Members
  • Posts

    13,548
  • Joined

  • Last visited

  • Days Won

    283

Everything posted by John Dowson

  1. No they don't, as I have explained several times. Offsets will be written starting from the offset specified and to the number of offsets required by the type and size of the data you are writing, and when you read from an offset it will read that offset and the consecutive ones up to the size if the data type you are reading. Everything works as it should, and nothing "leaks". You just need to understand how memory addresses work. Of course not, as that would just call the getnumbersfromtext function each time the offset changed - that is obviously not what you want.... Whatever you like - you have to wrap your script in a function, e.g. based upon the last script you posted function getnumbersfromtext(spdstate) return tonumber(spdstate:match"%d+[%d.,]*") end funcyion decodeString(offset, spdstate) if (string.find(spdstate, "%-") and string.find(spdstate, "%*")) then ipc.writeUB(0x66C5,1) ipc.writeUB(0x66C6,1) elseif string.find(spdstate, "%-") then ipc.writeUB(0x66C5,1) ipc.writeUB(0x66C6,0) elseif string.find(spdstate, "%*") then ipc.writeUB(0x66C5,0) ipc.writeUB(0x66C6,1) else ipc.writeUB(0x66C5,0) ipc.writeUB(0x66C6,0) end if string.find(spdstate, "SPD") then ipc.writeUB(0x66C7,1) else ipc.writeUB(0x66C7,0) end if string.find(spdstate, "MACH") then ipc.writeUB(0x66C8,1) else ipc.writeUB(0x66C8,0) end if string.find(spdstate, "%-") then ipc.writeSW(0x66C1, 0) -- speed hast to be forced to 0, when the dashes appear in managed mode, otherwise there will be interferences with the dashes else speed = getnumbersfromtext(spdstate) speed100 = speed*100 ipc.writeUW(0x66C1, speed100) -- logging "speed100" with U16 in the simulator and a 2 byte integer in MobiFlight end end -- of function decodeString event.offset (0xABCD, "STR", 9, "decodeString") If you are planning to use lua, you should look at some on-line lua tutorials. Also take a look at the example lua scripts provided, which are located in your FSUIPC documents folders. There are also plenty of examples in these forums. John
  2. I have moved your comment to a new topic. What do you mean by this? What values are you looking for? Does the DC6 have an SDK, similar to the PMDG 737? If it provides an sdk with additional data that I can use, then I can add this to offsets, as I do with the PMDG 737. Otherwise, maybe check the available lvars. Looks like the DC-6 also uses custom controls in the same way as the PMDG 737 - check the FAQ section on how to use these (although the FAQ refers to the PMDG 737, it should also apply to the DC-6). There are also > 100 presets available for this aircraft, so check them out. Also check-out other posts in this forum on using the DC-6. John
  3. @salsero_at Do you still have this issue? If you want me/us to help you, please supply the required files (see my last comment), otherwise I will close this support request. John
  4. I understand this, but do understand what you mean when you say it isn't working...how do you know this? What errors are you getting? Are you using FSUIPC7, and if so what does that report for the WAPI? Try also setting Debug level logging for the WAPI, and show me/attach your FSUIPC7.log file first, as this will tell me if FSUIPC7 is connecting to the WASM or not. Doesn't matter - you can still download and re-install, as this will also re-install the WASM module. John
  5. What do you mean by "no longer work"? Is it still in your Community folder? What does the FSUIPC_WASM.log say? Have you tried re-installing it? Later: note that you should NOT be using the version of FSUIPC7 posted above - that is now over a year old. Please download and install the latest version, 7.3.23. The installer will also install the WASM for you.
  6. @chickster25 I have just taken a look at this in more detail. The preset works reasonably ok here but only moves the lever between the discreet 4 or 5 positions. However, I can fully control the lever by assigning with Send to FS as normal axis using the Axis Spoiler Set control. Make sure there is no calibration being performed - go to page 6 of the calibration tab and remove any calibration by clicking Reset in the spoilers.
  7. I am very surprised that works... If you remove the general button section from your FSUIPC7.ini file, it will get added back with the default values. The ButtonRepeat rate is not read from a profile button section..... John
  8. License sent. John
  9. But, as I keep saying, ypu shouldn't do this.... If you are storing a number in an offset as a 2-byte word, you should store it starting on a 2-byte offset, e.g. at 66C0 or 66C2. It way seem to work, but you can get problems if you don't do this, depending on how the offset is accessed... Rather than have it run in an endless loop, you can use the event.offset function, using offset 0xABCD, so that you update each time that offset changes value - this would be more efficient.
  10. What version of the A320 are you using? The MF presets for the glareshield lights are for the dev version only - did you try in that version?
  11. License sent. John
  12. You should add your own presets to the myevents.txt file, not the events.txt file, as that will get replaced the next time you update. Executing a preset is EXACTLY the same as executing the calculator code associated to the preset, so you can use either ipc.execPreset("A32NX_OH_INTEG_LIGHT_25") or ipc.execCalcCode("(A:LIGHT POTENTIOMETER:86,percent) 25 (>K:2:LIGHT_POTENTIOMETER_SET)") Note also that the '(A:LIGHT POTENTIOMETER:86,percent)' part is redundant, as this just reads the value and then that value is ignored. it is the same as just ipc.execCalcCode("25 (>K:2:LIGHT_POTENTIOMETER_SET)") as I wrote in my previous comment, and you have said that this doesn't work... if you need calculator code for a specific function, you can ask about this on the MSFS2020 channel of the MobiFlight discord server. That is the community resource you should use for asking the community for the calculator code needed to implement a specific function.
  13. The key press to repeat while held applies to the key sent on button press, not release. As you have nothing assigned to the press, only on release, the repeat option doesn't matter and so is not saved. Try assigning to the press instead of the release. John
  14. But you should not do his... a float is 4 bytes/32-bits, and so you should write on a 4-byte boundary. This will also overwrite offsets 66C2, CC63 & 66C4 This is how floating point numbers work - they are not exact. If you only want to store to 2 decimal places, store the value * 100 as an int, and just remember to divide by 100 when you read it. The size of the offset that you need to store the number depends on the range - you can use 2-bytes if its always between -32,768 to 32,767 (signed) or 0-65,535 (signed), and 4-bytes for the full int range (-2,147,483,648 to 2,147,483,647 signed, 0 to 4,294,967,295 unsigned). And 1-byte if its between 0-255 (unsigned) or -128 - + 127 (signed). Remember to always read the same size as writing, don't overlap your offsets (i.e. make sure you leave enough space for the offset to hold the data before assigning the next offset value), and respect offset boundaries depending on the size of the data the offset holds (as I explained in the other post!). John
  15. Ok, thats interesting. So it takes the profile settings if there are no general ones. I can check the code to see what the actual detail is, just can't remember off-hand...! John
  16. Not really...just think about it. If you write one bye to offset 66C1, it will occupy that byte. If you write 2 bytes, it will occupy 66C1 and 66C2. And the same when you read them, so if you are reading 2-bytes, starting at 66C1, then you are reading 66C1 and 66C2. Similarly, if you were reading it as 4-bytes, you would be reading 66C1, 66C2, 66C3 & 66C4. When you are using offsets for your own needs, remember also to respect byte-boundaries. This means that a 2-byte word must start on a 2-byte boundary (offset address ending in 0,2,4,6,8,A,C or E), a 4-byte double-word must start on a 4-byte boundary (offset address ending in 0, 4, 8 or C), etc. It should be ok if you send it as a single-byte. if you are sending it as a 16-bit word (2-bytes) you shoul move it to a 2-byte boundary. You should space them as needed, and respect the boundaries when using more than one byte (strings excepted, they don't need to be aligned).
  17. Probably yes. FSUIPC4 and above uses SimConnect in the background for most things. @John Dowson will be able to confirm. Yes - everything goes via SimConnect anyway, either to the FS or the WASM. But you can also send "legacy" events via calculator code, using them as k-type variables.
  18. If you are reading 66C1 as a 16-bit/2-byte value, you are also reading offset 66C2, which is changing.
  19. As I said, not all simvars (a-type variables) are settable directly. The MSFS SDK lists the available simvars and their settable status, but this one is not documented, so is probably settable. This is why the presets only read this simvar and use the k-type variable, which is an event or control, to update. As simvars can also be updated by sending the appropriate event. instead of updating directly, why not use: ipc.execCalcCode("50 (>K:2:LIGHT_POTENTIOMETER_SET)") John
  20. In the first ini you posted, you had this: This will run SerialFP2 straight away which will grab the port and prevent FSUIPC from opening it - although I no longer see this in your latest ini. Please read the Appendix Handling VRInsight serial devices in FSUIPC in the Advanced User guide for details on setting up your VRInsight device. Ok, great - what was the issue? John
  21. I think such buttons can cause issues when assigned in MSFS as you would get continual button press events, but this shouldn't be a problem when assigned in FSUIPC as it handles repeat button presses differently - it will only repeat the press when asked and will repeat at the rate configured until a button release is seen. John
  22. I think the ButtonRepeat (and PollInterval) parameters are only read from the general (none-profile) section, as general button assignments are inherited (unless overwritten) in a profile. There can only be one repeat rate set for all button assignments. John
  23. There are two presets for this: A32NX_OH_INTEG_LIGHT_INC and A32NX_OH_INTEG_LIGHT_DEC. Why don't you use them? This is the calculator code for the inc: (A:LIGHT POTENTIOMETER:86,percent) 5 + 100 min 86 (>K:2:LIGHT_POTENTIOMETER_SET) So it using index 86 (not 84), and reading the value from the simvar but using the event to set it. See the HubHop site if you haven't already (https://hubhop.mobiflight.com/presets/). You can assign directly to MF presets in FSUIPC7. Make sure that you are using the latest version (7.3.23) as this has an additional facility/button (Find Preset) that makes finding presets a lot easier. Please see the Advanced User guide on using presets. And for the glareshield (which uses 84), these presets are available: A32NX_LIGHTS_GLARESHIELD2_INC, A32NX_LIGHTS_GLARESHIELD2_DEC, A32NX_LIGHTS_GLARESHIELD2_PERCENT The last one is output only, and just reads the simvar LIGHT POTENTIOMETER:84. John
  24. Your axis goes from 16383 to -16384, this code (in Revers Polish Notation, or RPN) '@ 16384 + 327.68 /' takes the input ('@'), adds 16384 ('@ 16384 +'), giving a range of 32768-0, and then divides the result by 327.68 ('327.68 /'), giving a range of 100-0. so it converts the range +16383 to -16384 to +100 to 0. You could try reversing the axis, i.e. add '-1 * ('@ -1 * 16384 + 327.68 /....'). What do you see in the outside view - can you see the spoilers extending and retracting with your lever? The movement will not be linear, as the preset sets the position according to those custom controls: down, arm, 50%, FLT_DET, Up. You can adjust the numbers in the preset code (5, 10, 50, 70, 95) to change the position for each of those positions. I have finished now - I can look into this further over the weekend if you are still having difficulties.
  25. This one is for 'having multiple if-statements in one file'.... I don't mind helping out with lua questions, but I am no lua expert. I support FSUIPC really, not lua. FSUIPC includes a lua interpreter, but for non-fsuipc related lua questions, you should refer to the available lua resources on the web. That is what I do when I get asked such questions... John
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.