betaflight / betaflight-tx-lua-scripts

Collection of scripts to configure Betaflight from your TX (currently only supported in OpenTx)
GNU General Public License v3.0
590 stars 142 forks source link

Convert betaflight-tx-lua to Inav #491

Closed druckgott closed 8 months ago

druckgott commented 10 months ago

I use this script very often at betaflight and it´s realy nice for PID Tuning an do so on. For my funjet I need now inav for flying fixed wing and I convert the script that it alrady start and have no error with Inav (at first I only want to use it for pid tuning)

I renamed all things and so on. But there is one topic which is different in Inav the MSP values are extending the value 255.

I can recive values from here: https://github.com/iNavFlight/inav/blob/master/src/main/msp/msp_protocol.h

But Inav also use this area starting by: 0x2000 https://github.com/iNavFlight/inav/blob/master/src/main/msp/msp_protocol_v2_inav.h

I now add a page wher the value: 0x2000 (or in decimal I also tested it) have to load there comes nothing.

The Problem is I do not have this huge experince to change the msp code to also recive values and send values to this adresses range.

Maybe somebody from the betaflight team can help me to get this cool script working also on Inav as a first version. My current Version is here: https://github.com/druckgott/inav-tx-lua-scripts

Hopefully here is one person who can help me also if it´s inav ;-)

klutvott123 commented 9 months ago

Currently the betaflight lua scripts only support MSPV1, but MSPV2 support should be pretty straight forward to implement. The problem is that it won't work with frsky or ghost as the packets are too small, but for CRSF it's doable.

Have a look at this https://github.com/betaflight/betaflight-tx-lua-scripts/blob/master/src/SCRIPTS/BF/MSP/common.lua

I'll have a look at it too when I have the time.

druckgott commented 9 months ago

Hi thx. for your link. I have no Idea how to implement this. I compared it to here: https://github.com/fpv-wtf/msp-osd/pull/140/files But it´s to complex for me ;-)

klutvott123 commented 9 months ago

@druckgott I just had a look at the Inav code, and it doesn't have support for mspv2 over telemetry like betaflight does so you would have to update the firmware for it to work too. I have mspv2 working on the bf lua scripts right now, but the problem is still that it will only work with the CRSF protocol.

anyway here's something that works https://github.com/betaflight/betaflight-tx-lua-scripts/compare/master...klutvott123:betaflight-tx-lua-scripts:msp_v2

klutvott123 commented 9 months ago

also I would recommend basing your INAV version on an actual fork of the BF scripts to preserve commit history 🙂

druckgott commented 9 months ago

Ah im yes i can do this, makes sence. So i will have a Look forward thx for your help very nice.

druckgott commented 9 months ago

Ok I did a fork again and put in your things thx for your help. Now there needs to be inav updated

klutvott123 commented 9 months ago

look at these https://github.com/betaflight/betaflight/pull/11112 https://github.com/betaflight/betaflight/pull/11131

druckgott commented 9 months ago

Thx i will have a look

druckgott commented 9 months ago

Its done, but I do not know how to debug it: https://github.com/iNavFlight/inav/pull/9528

klutvott123 commented 9 months ago

There may be differences between inav and bf to begin with. not sure, but you should double check. also have a closer look at the second PR I linked to. The first PR introduced a shared msp buffer, but that didn't work too well so it was removed in the second PR. You have two mspSerialOutBuf in your PR

klutvott123 commented 9 months ago

also tell us which rx protocol you're using.

druckgott commented 9 months ago

I have expresslrs protocoll so crfs

Ok i will Check this with the double Definition later

druckgott commented 9 months ago

Ok I now fixed this, but still did get api load. I realy have now Idea due to my expertise how I can start debugging this ;-) Maybe there is any help how I can do this?! I implement both PR´s from you as best as I understand it.

github-actions[bot] commented 8 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs within a week.

github-actions[bot] commented 8 months ago

Issue closed automatically as inactive.