Jump to content
The simFlight Network Forums

Strange behavior


Recommended Posts

Hi Pete,

Best wishes for your eyes problem.

I made a little software for my radio stack and special knobs who are pressing switches to change value (turn right, press a up switch, turn left, press a down switch) the program works fine except for a strange behavior.

When I use the switches to go up everything is fine but when I use it to go down, the values just keep circling in a 6 loop.

Ex. 9093, 9092, 9091, 9090, 9089, 9088 and then back to 9093

Here's how the program works

With each press of the down switch:

1- Reads the COM1 value from FSUIPC and put it in a variable

2- Decrease the value by one in the variable

3- Writes the COM1 value to FSUIPC

It's the same for the up switch excep it increase the value.

And I know you hate VB but it's written in that language!!

Any clue why it's OK for up and not for down???

Thanks

Michel

Link to comment
Share on other sites

Any clue why it's OK for up and not for down???

No, no idea, but it is likely related to something FS is doing with invalid values. After all, the only valid values for the last digit of the frequency are 0, 2, 5 and 7. Try testing the last digit and increasing/decreasing by 2 or 3 depending on the current value.

Your values are hard to check in decimal. It's the hexadecimal which is important. Your "9093, 9092, 9091, 9090, 9089, 9088 and then back to 9093" are frequencies 123.85, 123.84 (invalid), 123.83 (invalid), 123.82, 123.81 (invalid), 123.80. The next time you decrement you would get the invalid 123.79. Why FS should do more with that than the other invalid values I don't know, but try to give it proper values only and see what happens then.

Regards,

Pete

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • 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.