FrSkyRC / ETHOS-Feedback-Community

Feedback & suggestions are welcomed here for ETHOS by FrSky
189 stars 85 forks source link

DSM Forward Prog (LUA MultiBuffer internals) #4410

Closed frankiearzu closed 1 week ago

frankiearzu commented 2 months ago

Im porting the DSM Forward Programming tool to Ethos, but i think is missing the basics to comunicate with the Multi-Module using DSM Forward Prog..

What i need to start:

  1. shared "multi_buffer" inside the firmware that is used to comunicate with LUA and multi-module.

  2. LUA function to access to the "multiBuffer()" to read/write the firmware buffer. https://github.com/opentx/opentx/blob/2.3/radio/src/lua/api_general.cpp#L1758

  3. On the sending side, once the multiBuffer is populated with data, need to send it to the MultiModule so that the data can be added to the DSM data frame sent to the RX. https://github.com/opentx/opentx/blob/2.3/radio/src/pulses/multi.cpp#L472

  4. On the receiving side, The Forward programming data comes as telemetry sensor data..there needs to be a way to copy that data to the multibuffer. https://github.com/opentx/opentx/blob/2.3/radio/src/telemetry/spektrum.cpp#L353 or from EdgeTX that i updated to support many of the DSM sensors, as well as TextGen (Avian Programming) https://github.com/EdgeTX/edgetx/blob/main/radio/src/telemetry/spektrum.cpp

  5. To support TextGen, also will need this piece of code. It allows LUA to capture any of the telemetry frames into the multi-buffer. https://github.com/EdgeTX/edgetx/blob/main/radio/src/telemetry/spektrum.cpp#L586 (ends in L613)

Currently continue my development using a fake multibuffer simulator.

Crunch69 commented 1 month ago

Would love to see this work

bsongis-frsky commented 1 week ago

Working on it. It will be ready in the next nightlies. The interface will be completely different than opentx / edgetx, I don't understand why it has been done differently than sport and crsf.

frankiearzu commented 1 week ago

Thank you, just let me know what is the LUA api, and I can give it a try.

bsongis-frsky commented 1 week ago

Perhaps it will need to be improved, but I think that it is possible to keep the implementation consistent between S.Port, CRSF and Multimodule / DSM

You will have to get a sensor (which is a listener to the Fifo) with this function: sensor = multimodule.getSensor()

Then you will be able to write with this function: sensor:pushFrame(<bytes>)

And read with this function: sensor.popFrame(), or with filters sensor.popFrame({i2cAddress=0x00}) or even sensor.popFrame({type=0x04})

bsongis-frsky commented 1 week ago

Also this implementation allows multiple listeners, which AFAIK is not possible with opentx / edgetx

frankiearzu commented 1 week ago

Thank you!, will wait for the nightly build. will try TexGen first that is receiving only, and then will try Forward Prog that sends/receives.

frankiearzu commented 3 days ago

Verified to be working as expected with latest 1.6.0 nightly. Thank you @bsongis-frsky! Now more work in the GUI! FP_Main-1 FP_Main-2 SmartTel-TextGen-Avian

robthomson commented 1 day ago

@frankiearzu

https://github.com/rotorflight/rotorflight-firmware/issues/173

Arw you able to provide any assistance with this?