Clooney82 / MavLink_FrSkySPort

This MavLink_FrSkySPort repository is discontinued! The development is moved to athertop/MavLink_FrSkySPort. Please do not use this repo, and follow the link to athertop.
https://github.com/athertop/MavLink_FrSkySPort
GNU General Public License v3.0
61 stars 17 forks source link

Brake Mode not displaying/calling - code fix detailed in post #51

Closed athertop closed 8 years ago

athertop commented 8 years ago

If you select Pause mode (new in 3.3) it siaplays/calls "Invalid Flight mode". I have tracked this down to line 498 which reads: if FmodeNr<1 or FmodeNr>17 then

it should read:

if FmodeNr<1 or FmodeNr>18 then

FmodeNr is set in the LUA to the Telem Flight Mode + 1, but the Pause Mode is APM mode 17, so this sets FmodeNr to 18 which the current line 498 equates to TRUE so fmodeNr is set to 13 inside the IF staement, which is 'Invalid flight mode'. Simple fix - replace 17 with 18, or instead use table.getn(FlightMode) to simply refer to the array length. This way you can add future flight modes to the start of this code without worrying about This IF statement.

lvale commented 8 years ago

Are you sure is "Pause".

Last I've seen was "Brake"

And yes that's a new "Flight Mode" :)

athertop commented 8 years ago

Well spotted - my deliberate mistake ;-) It is indeed 'Brake mode', anyway, changing 17 to 18 fixes this.Strangely, the wav file for Brake mode is already present in the repository, so we are all good there.

lvale commented 8 years ago

Yes. As Brake mode can be used on a Aux function (CH7 to CH12) the sound appears isolated (I use it on CH7), but for the sake of consistency can be added to the Flight modes list also. btw: tables consume lots of memory on Lua, and we must be careful with its usage.

athertop commented 8 years ago

Ivale, The sound files for the "Brake" mode and the coding is already configured/included in the project (you will see the FlightMode array which starts on line 102 includes the "Brake" mode) - its just that the coding error was preventing them from being used. Like I said, changing 17 to 18 on line 498 fixes this. I am hoping that Clooney will apply the suggested fix, along with the other fixes I detailed in another post for Open Tx 2.1.7. I haven't heard from Jochen in a while now. The project seems to have gone quiet.

athertop commented 8 years ago

Pull request issued above

athertop commented 8 years ago

The fix now merged for this issue