awenzhong / ardupilot-mega

Automatically exported from code.google.com/p/ardupilot-mega
0 stars 0 forks source link

Misson planner forgets Telemetry rates if you disconnect from remote unit, and re-connect. #957

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Set telemetry rates to something other than the default in the 'Planner' 
section.

2. Watch them change as expected.
3. Disconnect the serial port, and then re-connect. The planner reverts back to 
the 'default' values, instead of the values selected.

What is the expected output? 

The expected behavior is to keep the same telemetry rates for the entire 
session, and when it's closed, keep the values set in the workspace 
configuration.

What do you see instead?
The rates revert back to the default.

To fix this, change the following block of code in the 'ResetInternals' method 
in the 'CurrentState.cs' file:

Old code:

        public void ResetInternals()
        {
            mode = "Unknown";
            _mode = 99999;
            messages = new List<string>();
            useLocation = false;
            rateattitude = 10;
            rateposition = 3;
            ratestatus = 2;
            ratesensors = 2;
            raterc = 2;
            datetime = DateTime.MinValue;
            battery_usedmah = 0;
            _lastcurrent = DateTime.MinValue;
            distTraveled = 0;
           timeInAir = 0;
        }

New code:

        public void ResetInternals()
        {
            mode = "Unknown";
            _mode = 99999;
            messages = new List<string>();
            useLocation = false;
            datetime = DateTime.MinValue;
            battery_usedmah = 0;
            _lastcurrent = DateTime.MinValue;
            distTraveled = 0;
           timeInAir = 0;
        }

The defaults can be set once, on program load, before the values are read from 
the workspace saved values. Otherwise, leave them alone.

Original issue reported on code.google.com by duffy.p...@gmail.com on 16 Jan 2014 at 4:38