Jump to content
The simFlight Network Forums

All Activity

This stream auto-updates

  1. Today
  2. Hello Fragtality, PilotsDeck profile switching (MSFS2020/2024) has stopped working. I am using the latest version of PilotsDeck (ver 0.8.9) and recently updated to the latest version of StreamDeck (ver 6.9.1). The profile switching problem started at some point after the StreamDeck update. I have tried reinstalling PilotsDeck, and have checked and resaved the profile settings in the Profile Manager. No matter which plane I load, I get the Default Profiles on the SD+ and the 15 button SD. Would appreciate any ideas on what might be a good way for me to try and find the profile switching problem? Thanks, Al
  3. Yesterday
  4. Hi, I've built a small box with a 4x4 keypad and a 20x4 character OLED display. I’m using it to display the active and standby COM1 frequencies, and to type in the next standby frequency to be set (via Button A). In addition, I can set the standby frequencies for COM2, NAV1, and NAV2 using Buttons B, C, and D. If I make a mistake while typing, I can delete the last character by pressing "*". The "#" button functions as a transfer switch, toggling the COM1 standby and active frequencies. Here’s what the prototype looks like: I'd now like to clean up the Lua script and refactor it to use the event.com() function for handling serial input. Could anyone have a look at the script and maybe offer some suggestions on how to best achieve this? Here is the Lua script: ---------------------------------------------------------------- ---------------------------------------------------------------- dev = com.open("COM6", 115200, 0) -- Open COM port with baud rate 115200 ---------------------------------------------------------------- ---------------------------------------------------------------- -- Display a message to indicate that the script is running ipc.display("Keypad Radio - Lua script is running...", 4) -- Message stays for 4 seconds function processInput() local datastring, length = com.read(dev, 256) -- Read up to 256 bytes from the serial port -- Parsing the received string to set COM1 standby frequency if datastring:match("^COM1SB") then local freq_mhz = tonumber(datastring:sub(8)) -- Extract frequency in MHz if freq_mhz then local base = math.floor(freq_mhz) local fraction = freq_mhz - base -- Round fraction to nearest kHz to avoid float precision issues local frac_khz = math.floor(fraction * 1000 + 0.5) if frac_khz == 10 then freq_mhz = base + 0.011 elseif frac_khz == 15 then freq_mhz = base + 0.016 elseif frac_khz == 40 then freq_mhz = base + 0.041 elseif frac_khz == 80 then freq_mhz = base + 0.081 end local frequency = math.floor(freq_mhz * 1000000 + 0.5) -- Convert to Hz and round ipc.control(67363, frequency) end --[[ Before using the above code to round fraction to nearest kHz to avoid float precision issues, there were issues with the frequencies ending with x10, x15, x40 and x80 that the wrong frequency was being sent. x10 was sent as x09, x15 -> x14, x40 -> x39. The "old" code was these two lines: local frequency = tonumber(datastring:sub(8)) * 1000000 -- Extract frequency and convert to Hz ipc.control(67363, frequency) -- COM1_STBY_RADIO_HZ_SET ]] -- Parsing the received string to set COM2 standby frequency elseif datastring:match("^COM2SB") then local freq_mhz = tonumber(datastring:sub(8)) -- Extract frequency in MHz if freq_mhz then local base = math.floor(freq_mhz) local fraction = freq_mhz - base -- Round fraction to nearest kHz to avoid float precision issues local frac_khz = math.floor(fraction * 1000 + 0.5) if frac_khz == 10 then freq_mhz = base + 0.011 elseif frac_khz == 15 then freq_mhz = base + 0.016 elseif frac_khz == 40 then freq_mhz = base + 0.041 elseif frac_khz == 80 then freq_mhz = base + 0.081 end local frequency = math.floor(freq_mhz * 1000000 + 0.5) -- Convert to Hz and round ipc.control(67364, frequency) end --local frequency = tonumber(datastring:sub(8)) * 1000000 -- Extract frequency and convert to Hz --ipc.control(67364, frequency) -- COM2_STBY_RADIO_HZ_SET -- Parsing the received string to set NAV1 standby frequency elseif datastring:match("^NAV1SB") then local frequencyStr = datastring:match("NAV1SB%s*(%d+%.%d+)") -- Extracts the frequency if frequencyStr then ipc.log("Extracted frequency: " .. frequencyStr) -- Debug log local bcdValue = convertToBCD(frequencyStr) ipc.log("BCD Converted: " .. string.format("0x%X", bcdValue)) -- Debug log ipc.writeUD(0x311E, bcdValue) -- Send to FSUIPC ipc.display("NAV1 standby set: " .. frequencyStr, 3) ipc.log("NAV1 standby frequency set to BCD: " .. string.format("0x%X", bcdValue)) else ipc.log("Error: Failed to extract frequency!") end -- Parsing the received string to set NAV2 standby frequency elseif datastring:match("^NAV2SB") then local frequencyStr = datastring:match("NAV2SB%s*(%d+%.%d+)") -- Extracts the frequency if frequencyStr then ipc.log("Extracted frequency: " .. frequencyStr) -- Debug log local bcdValue = convertToBCD(frequencyStr) ipc.log("BCD Converted: " .. string.format("0x%X", bcdValue)) -- Debug log ipc.writeUD(0x3120, bcdValue) -- Send to FSUIPC ipc.display("NAV2 standby set: " .. frequencyStr, 3) ipc.log("NAV2 standby frequency set to BCD: " .. string.format("0x%X", bcdValue)) else ipc.log("Error: Failed to extract frequency!") end -- Transfer Standby to Active elseif datastring:match("^COM1TX") then ipc.control(66372) -- COM1_STBY_RADIO_SWAP end end -- Convert frequency to BCD (e.g., "113.45" → 0x1345) function convertToBCD(freq) local cleanFreq = freq:gsub("%.", "") -- Remove decimal (e.g., "109.2" → "0920") local decimalNumber = tonumber(cleanFreq) -- Convert to number if not decimalNumber then return 0 end -- Return 0 if conversion fails local bcd = 0 local shift = 0 -- Convert each decimal digit to BCD format while decimalNumber > 0 do local digit = decimalNumber % 10 bcd = bcd + (digit * (16 ^ shift)) -- Use base 16 shift instead of bitwise left shift decimalNumber = math.floor(decimalNumber / 10) shift = shift + 1 end return bcd end -- Format Hz to string (e.g. 128325000 -> "128.325") function formatComFreq(freqHz) return string.format("%.3f", freqHz / 1000000.0) end lastCom1 = "" lastCom1sb = "" function sendComFrequencies() local freqCom1 = ipc.readUD(0x05C4) -- COM1 active in Hz local strCom1 = formatComFreq(freqCom1) if strCom1 ~= lastCom1 then com.write(dev, "COM1:" .. strCom1 .. "\n") lastCom1 = strCom1 end local freqCom1sb = ipc.readUD(0x05CC) -- COM1 standby in Hz local strCom1sb = formatComFreq(freqCom1sb) if strCom1sb ~= lastCom1sb then com.write(dev, "COM1SB:" .. strCom1sb .. "\n") lastCom1sb = strCom1sb end end --Main loop to continuously check for serial input while true do processInput() -- Call the function to process any incoming serial data ipc.sleep(100) -- Small delay to avoid high CPU usage sendComFrequencies() -- Call the function to process any incoming serial data ipc.sleep(100) -- Small delay to avoid high CPU usage end --event.com(dev, 3, 1, 10, "processInput") --event.timer(1000, "sendComFrequencies") ---------------termination----------------- function closeCom () com.close(dev) end And here is the Arduino code: #include <Keypad.h> #include <LiquidCrystal.h> // Initialize the LCD connected to pins 9, 8, 7, 6, 5, 4 on Arduino LiquidCrystal lcd(9, 8, 7, 6, 5, 4); // Keypad settings const byte ROWS = 4; // four rows const byte COLS = 4; // four columns char keys[ROWS][COLS] = { {'1', '2', '3', 'A'}, {'4', '5', '6', 'B'}, {'7', '8', '9', 'C'}, {'*', '0', '#', 'D'} }; byte rowPins[ROWS] = {A0, A1, A2, A3}; byte colPins[COLS] = {A4, A5, A6, A7}; Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS); String frequency = "1"; // Pre-define the first digit as '1' String inputString = ""; bool stringComplete = false; void setup() { lcd.begin(20, 4); // Turn off the display: lcd.noDisplay(); delay(500); // Turn on the display: lcd.display(); // Initial LCD message: lcd.setCursor(4, 1); lcd.print("KEYPAD RADIO"); delay(4000); lcd.clear(); lcd.setCursor(0, 0); lcd.print("COM1 ACT"); lcd.setCursor(0, 1); lcd.print("COM1 STB"); lcd.setCursor(0, 3); lcd.print("NEXT STB"); Serial.begin(115200); //start checking serial connection } void loop() { char key = keypad.getKey(); if (key) { if (key == 'A') { sendCom1FrequencyToSim(); frequency = "1"; // Reset to '1' after sending lcd.setCursor(9, 3); lcd.print(" "); } else if (key == 'B') { sendCom2FrequencyToSim(); frequency = "1"; // Reset to '1' after sending lcd.setCursor(9, 3); lcd.print(" "); } else if (key == 'C') { sendNav1FrequencyToSim(); frequency = "1"; // Reset to '1' after sending lcd.setCursor(9, 3); lcd.print(" "); } else if (key == 'D') { sendNav2FrequencyToSim(); frequency = "1"; // Reset to '1' after sending lcd.setCursor(9, 3); lcd.print(" "); } else if (key == '*') { if (frequency.length() > 1) { // Ensure '1' stays as the first digit frequency.remove(frequency.length() - 1); // Remove last digit // Clear the previous frequency display and update it lcd.setCursor(9, 3); lcd.print(" "); lcd.setCursor(9, 3); lcd.print(formatFrequency(frequency)); } } else if (key == '#') { transferFrequency(); // Trigger COM1 STBY RADIO SWAP } else if (isDigit(key)) { if (frequency.length() < 6) { // limit to 6 digits (including '1') frequency += key; // Update the LCD with the new frequency lcd.setCursor(9, 3); lcd.print(formatFrequency(frequency)); } } } else if (stringComplete) { if (inputString.startsWith("COM1:")) { String freq = inputString.substring(5); lcd.setCursor(9, 0); lcd.print(" "); // Clear lcd.setCursor(9, 0); lcd.print(freq); } else if (inputString.startsWith("COM1SB:")) { String freq = inputString.substring(7); lcd.setCursor(9, 1); lcd.print(" "); // Clear lcd.setCursor(9, 1); lcd.print(freq); } inputString = ""; stringComplete = false; } } String formatFrequency(String freq) { // Automatically add the decimal point at the right place if (freq.length() >= 4) { // Adjusted to account for the pre-defined '1' return freq.substring(0, 3) + "." + freq.substring(3); } return freq; // If less than 3 digits, no decimal } void sendCom1FrequencyToSim() { String formattedFrequency = formatFrequency(frequency); // Add the decimal point Serial.print("COM1SB "); // Add COM1SB tag Serial.println(formattedFrequency); // Send formatted frequency (with decimal) } void sendCom2FrequencyToSim() { String formattedFrequency = formatFrequency(frequency); // Add the decimal point Serial.print("COM2SB "); // Add COM2SB tag Serial.println(formattedFrequency); // Send formatted frequency (with decimal) } void sendNav1FrequencyToSim() { String formattedFrequency = formatFrequency(frequency); // Add the decimal point Serial.print("NAV1SB "); // Add NAV1SB tag Serial.println(formattedFrequency); // Send formatted frequency (with decimal) } void sendNav2FrequencyToSim() { String formattedFrequency = formatFrequency(frequency); // Add the decimal point Serial.print("NAV2SB "); // Add NAV2SB tag Serial.println(formattedFrequency); // Send formatted frequency (with decimal) } void transferFrequency() { Serial.println("COM1TX"); // Send transfer command } void serialEvent() { while (Serial.available()) { char inChar = (char)Serial.read(); if (inChar == '\n') { stringComplete = true; } else { inputString += inChar; } } } Cheers, Isak
  5. Thanks again. Aren't these controls aircraft independent? Does offset 0x31FC update? I'm trying to emulate Toolbar Pushback with buttons. To get away from using a mouse. The tool has forward, backward, steering and speed for the tug.
  6. Like most add-on aircraft then! Many (most) add-on aircraft in MSFS2020/2024 seem to implement their behavior in non-standard ways and not use the standard events or simvars.
  7. Ok, interesting. With P3Dv4, it is always advised to start with a default aircraft, and then switch, especially if using complex add-ons, but probably a good idea to do this when using any add-on aircraft. Thanks for the update.
  8. Thanks, I'm flying the Cockspur PH100 Phenom. Very nice aircraft. Not consistent with how switches, buttons, knobs are bound.
  9. I finally found the problem!!!! It comes from my plane that I use in P3D startup. I have the "AC11 Commander 114 Cold & Dark," and it probably has an option that turns off the automatic fuel switch. So, if I power up this plane, then turn off the engines, then load the FOUGA: I do an engine ignition, and the engines don't stop when the wing tanks are empty!
  10. Thank you John, very thorough. I have a Stream Deck and trying to emulate the Toolbar Pushback capability with buttons instead of a mouse. In my sim, I'm trying to get rid of the need for a keyboard and mouse. I have a button for pushback (works) and tests ON for the other buttons. Again thanks
  11. Electronic Flight Bag, also called a flypad (looks like an ipad), usually attached to the door below the pilots window. Used by many complex add-ons (airliners and airbuses) to configure the aircraft (fuel, weights/passengers, even throttle set-up and calibration, brakes etc) and control ground services amongst other things.
  12. Thanks, what is an EFB?
  13. Ok, thats interesting - and I also don't understand why this would fix your issue - maybe there was an option you set that disabled this for some reason. But glad its now fixed! Maybe try comparing the old prepar3d.cfg (if you saved it) to the new one, to see what has changed that could affect this.
  14. News : I have try to delete prepar3D.cfg, and now it is working !!! (fuel dump working !) I don't understand....
  15. Tested in the FBW A320. You need to switch the pushback system on in the EFB, and then you can only attach the tug via the offsets. Looks like you need to set the direction in the EFB and control from there really.
  16. Thank you John! Karl
  17. Yes i have all DLL installed. No "manually switch fuel tanks". Thank you very much.
  18. The idea with the logs was to compare the working v5 log with the non-working v6 log, to see if any additional controls were being sent in v5. But as now v5 isn't working, this is not possible. And I don't know this aircraft. For most aircraft that I know, you would manually switch fuel tanks. Is this not the case in this aircraft? There's not much else I can do at the moment, until I have re-installed P3Dv4, installed this aircraft and taken a look.
  19. I would think its more likely a config issue with the aircraft. But strange it was previously working in v5. I noticed that there was something about install additional dlls in that post you refrenced - do you have the dsd_p3d_fuel_dump_x64.dll file installed?
  20. FSUIPC6 log with problem.rar I'm sorry, but I don't understand why the fuel transfer isn't working, maybe it's a problem with the plane rather than with the fsuipc ?
  21. Procedure : it is easy : fill center tank, put only 2% in the aux tank, put parking brake, CTRL+E to start engine. And wait to empty AUX tank with burning fuel. When 0% in AUX, and 100% in CENTER, the engine will stop. No transfert fuel is happenning I don't know why, but now I have the same problem with v5 or v6. Strange! pack.rar
  22. Tested in the PMDG 737 and the offsets seem to work with that aircraft as well. Have you tried to use these offsets? If not, why not just try them. Any issues, let me know what the issue is and with which aircraft. John
  23. Seems ok now. However, the log is useless as it doesn't show anything. Did you get your issue from the session where this log was generated? The log ends after < 5mins. I need to see a log from when you get the issue, and one from FSUIPC5 when you didn't, so I can see if there is any difference. Also, as I said, if you can let me know the steps to recreate this issue here, I can do that - after I have re-installed P3Dv4 and this aircraft.
  24. It is strange, because the log is working for download here for me..?!!!
  25. Sorry, this is not correct - I was writing to offset 0x31F0 rather than 0x31F4. Writing to offset 0x31F4 seems to control pushback as documented, at least in the Cessna 172, and writing to offset 0x31F8 controls the heading. So it seems that these offsets are working, at lease in the Cessna 172.
  26. I have not enabled direct axis assignment to input events due to this calibration issue. There are some issues adding calibration for input events directly to the axis assignment tab for various reasons, and it certainly won't be possible via the calibration panels for various reasons. What I could possible do, for an initial attempt, would be to allow assignment to input events, but these would then need to be calibrated using FSUIPC's axis scaling functions, only available by manually editing the ini file. I will put this on my todo list to look into. But for now, you need to use lua scripts for this, as you are doing. John
  27. It would be nice to be able to bind an axis to an Input Event and being able to specify to convert to what lower and upper limit 0.0 to 1.0 0 to 100 -16384 to 16383 As an example, the Carenado uses an Input Event for it's mixture axis. Only using the Input Event the engine can be started from external hardware. Using the normal mixture axis one needs to touch the mixture control with the mouse. There are also Input Events used for lights and for cold/hot air intake levers. Any chance to get this in a future version? For now I'm using Lua scripts. Karl
  1. Load more activity
×
×
  • 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.