whQQps Posted January 21 Report Posted January 21 Hello, I am writing an application for MSFS 2020 with C Sharp and FSUIPC client dll. I define offset as below. private Offset<ushort> com1offset = new Offset<ushort>("RadioStack", 0x034E); private Offset<ushort> com1stbyoffset = new Offset<ushort>("RadioStack", 0x311A); and with the code below, I convert it to json and send it to the client application. msfs showing 3 digits after comma. i get 2 digits after the comma. (like 132.45). How can I get this as 3 digits? ,JObject jsonObj = JObject.Parse(jsonMessage); FSUIPCConnection.Process("RadioStack"); FsFrequencyCOM com1Helper = new FsFrequencyCOM(this.com1offset.Value); FsFrequencyCOM com1stbyHelper = new FsFrequencyCOM(this.com1stbyoffset.Value); string com1Value = com1Helper.ToString(); jsonObj["com1"] = com1Value; string com1stbyValue = com1stbyHelper.ToString(); jsonObj["com1stby"] = com1stbyValue; string updatedJsonMessage = jsonObj.ToString();
whQQps Posted January 21 Author Report Posted January 21 or is there a way to increase radio frequency without sending calculated value. I am getting actual com1 value via json and and trying to add 5 on it and sendint to server.
whQQps Posted January 21 Author Report Posted January 21 problem solved i used below ofset st server. private Offset<int> com1stbyoffset1 = new Offset<int>("comstby", 0x05CC); then I added comstby value to json and I sent it to client. FSUIPCConnection.Process("comstby"); float comstbyValue1 = com1stbyoffset1.Value; comstbyValue1 = comstbyValue1 / 1000/1000; jsonObj["comstby"] = comstbyValue1; after seting new value at client side I sent new value to server and set offset with new value, if (msgname == "com1stbyvalue") { string com1stbyvalue = json["com1stbyvalue"].ToString(); int com1stbyvaluecalc =int.Parse(com1stbyvalue); FSUIPCConnection.Process("comstby"); com1stbyoffset1.Value = com1stbyvaluecalc; }
John Dowson Posted January 22 Report Posted January 22 Glad you found a solution. As you found, the COM offsets at 0x034E and 0x311A and do/can not support frequencies to 3 decimal places. and you need to use offsets 0x05C4 & 0x05CC instead for 8.33Khz spacing. I am not sure why offsets 0x05C4 - 0x05D00 are documented as not writeable though. These weren't working in earlier releases of MSFS but I am pretty sure they are working now, and are using the newer KEY_COM_RADIO_SET_HZ and similar controls. I will update the documentation. John
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now