olliw42 / mLRS

2.4 GHz & 915/868 MHz & 433 MHz/70 cm LoRa based telemetry and radio link for remote controlled vehicles
GNU General Public License v3.0
295 stars 67 forks source link

LUA support small screen ? #74

Closed seanwang338 closed 1 year ago

seanwang338 commented 1 year ago

Can LUA support some radios with internal RF and small screen(128x64)? It only can use CLI to change param with PC.

olliw42 commented 1 year ago

not currently - unfortunately.

I do not have such a radio so I cannot do the lua script, so we would need someone with such a radio and the skils and wills to modify the lua script to work on the smaller displays.

A respective PR would be very much appreciated.

It's indeed one of the bigger things still missing.

vrquaeler commented 1 year ago

At least I have the hardware available for testing. My LUA skills are just good enough for "one-line-code-changes".

olliw42 commented 1 year ago

@vrquaeler well, I have never looked into what needs to be done for the smaller screens, but I guess all it might be is to just adjust the layout, i.e., the x,y coordinates in the print commands, and of course color. Could be that your "one-line-code-changes" skills are way good enough for that task :):)

vrquaeler commented 1 year ago

It's on my list.

Maybe for the rainy days...

4O6FPV commented 1 year ago

hmmm I have the radio and will soon be one handed from shoulder surgery so I may take this up!!!!

seanwang338 commented 1 year ago

not currently - unfortunately.

I do not have such a radio so I cannot do the lua script, so we would need someone with such a radio and the skils and wills to modify the lua script to work on the smaller displays.

A respective PR would be very much appreciated.

It's indeed one of the bigger things still missing.

Hello olliw, I had worked in lua with small screen radio at last weekend. It only have MCU internal RAM, so free ram of opentx is too little for lua, it's only about 40Kbytes :( For example, DEVICE_PARAM_LIST is too large, radio report not enough memory, and some lua api like table.insert is not supported. I plan don't storing all parameters, so a cmd like MBRIDGE_CMD_PARAM_REQUEST_BY_INDEX is needed.

olliw42 commented 1 year ago

@jasonwang01 first, MANY thx for jumping in and looking at this. Massively appreciated :)

argh ... I was suspecting that it may not be that easy ... very sad

btw, do we know how the TBS configurator is doing it (which AFAIK is also used by ELRS)? it could maybe give us ideas

so, you want to read the list and plot the options with the current setting while reading all options, and want to keep the list of possible settings only for the presently selected option, right? So you need a command to retrieve this list for said option?

I think the precursor is already there, though not yet implemented, see https://github.com/olliw42/mLRS/blob/dev-mavlinkx/mLRS/CommonTx/mbridge_interface.h#L471C34-L477. Instead of defining a specific cmd, the approach would be to send a MBRIDGE_CMD_REQUEST_CMD with the cmd MBRIDGE_CMD_PARAM_ITEM, and the param index as further parameter. So, it's a bit more complicated than what you suggest, but not very much. This line https://github.com/olliw42/mLRS/blob/main/lua/mLRS.lua#L463 would be an example of how that would work with sending a cmd request.

So, we need to do the implementation side. Should not be very difficult, but needs to be done. I've raised an issue to put this in the list :). https://github.com/olliw42/mLRS/issues/82

Q: is there a way knwoing how much memory is used by the current lua script? I mean, can we figure out if avoiding storing the complete list would be enough of memory saving for getting the job done?

zanefond commented 1 year ago

hello ! I have tested the black-white screen lua on my x9d+with edgetx 2.8.there are some problems while using the luascript on x9d+.first,when starting the luascript, the screen will show " mlrs loading",but cannot active the function. when changed the baudrate from 115K to 400K,I could enter the main page but still cannot calibrate the parameters.

olliw42 commented 1 year ago

@zanefond vrquaeler has reported that the script works fine on OpenTx and a Zorro radio. Unfortunately, EdgeTx and OpenTx are somewhat different concerning lua. The changes which were required to get the color lua script running on EdgeTx seem to be not included in the bw lua script, so EdgeTx might indeed be why it's not working for you. Pure speculation but a guess.

Do you have the means to copy over the few changes to handle EdgeTx from the color lua script, and see if it then works?

geofrancis commented 1 year ago

where can I get the lua for a x9d?

olliw42 commented 1 year ago

where can I get the lua for a x9d?

here is jasonwang01's PR: https://github.com/olliw42/mLRS/pull/83

geofrancis commented 1 year ago

The script works great on my Taranis X9E with opentx.

olliw42 commented 1 year ago

many thx for the report !

@vrquaeler @geofrancis the question is also a bit how usefull it is. In my understanding it so far only allows to adjust 5 settings, not all. In your opinion, is that usefull enough for a good number of users to be happy with it and benefit from it? (question essentially is if it is ready enough to be spread to the public, or if it rather should see more improvement before)

geofrancis commented 1 year ago

It does the essentials, the only other option I would like to see would be to receiver power level. Other than that it's good enough.

olliw42 commented 1 year ago

thx! so what options does it actually allow to set?

from the PR description and the code I deduce

the receiver power level should thus actually be available !? (comment: the rx needs to be connected to the tx for the rx parameters to be available&settable)

vrquaeler commented 1 year ago

Hi,

Even with the limitation to the 5 parameters mentioned above It is really useful as it is now. Otherwise we would have nothing for the BW-radios and are forced to use the CLI any time.

The CLI has to be used for the other parameters.

For parameter changes in the field like changing power level for a range check (without the need of a PC) I am fine with.

olliw42 commented 1 year ago

many thx

you find that it's possible to set also rx power?

vrquaeler commented 1 year ago

Yes, it's possible to change and save the RX power or the RXout protocol. The RX has to be connected.

Mine shows the TX and RX power settings.

Tested on Seeed E5 based hardware and E28 based hardware.

olliw42 commented 1 year ago

MANY THX for having tested it, and MANY THX to @jasonwang01 to have made that bw lua script. I have merged it now. I also opened a new issue about improving it to more parameters.

geofrancis commented 1 year ago

mine displays the power level for both tx and rx but i can only change the tx power level as far as I can see.... turns out im on an old version of the firmware... https://static.rcgroups.net/forums/attachments/3/0/3/8/7/6/a17400081-52-20230702_004208.jpg