cool4uma / UART_Terminal

Uart terminal for Flipper Zero
MIT License
140 stars 20 forks source link

Max string length #6

Closed aafksab closed 1 year ago

aafksab commented 1 year ago

I am unsure how to reach out to you and this seems the only way. I have forked this project and am making a dedicated fap for a specific LoRA module. its mostly AT commands but I am finding that anything over 10 len is failing to send properly.

is there some limit set and could you point me in the right direction?

cool4uma commented 1 year ago

Hello! When sending, the actual length of the string is taken. In other words, the actual length of the input field string "app->selected_tx_string" is passed as an argument to the "uart_terminal_uart_tx" function. So I don't think it should be a problem. I quickly decided to check this and connected for this to the Flipper tp-link mp2030 and sent a command whose length is> 10 to the router. Everything works for me, my command successfully sent and worked.

cool4uma commented 1 year ago

mart1 mart2

aafksab commented 1 year ago

that is very interesting. The LoRA module that I am using is configurable with simple AT commands, but the docs state that you have to send cr+lf. https://github.com/aafksab/LORA-Term/blob/4b1adf178b5059921b413d7098e43494709fbb65/scenes/uart_terminal_scene_console_output.c#L130

I added that here, but when I send the quick commands I get err1 which per the docs mean i did not end the string properly. Any thoughts on this?

aafksab commented 1 year ago

image for clarity the quick commands that do work, are the few short ones, this is why I was curious about length :) further if I just use a usb uart bridge all the commands work, I am very confused lol

cool4uma commented 1 year ago

I have never worked with LoRA modules. From what I managed to quickly google, it says that cr+lf is used in response to AT commands.

Have you tried using the original uart_terminal, is it the same there?

aafksab commented 1 year ago

yes and that is why I forked, in hterm I have to choose cr+lf on both send and receive

cool4uma commented 1 year ago

I have only one thought so far: Try like this:

if(app->is_command && app->selected_tx_string) { uart_terminal_uart_tx( (uint8_t)(app->selected_tx_string), strlen(app->selected_tx_string)); uart_terminal_uart_tx((uint8_t)("\r\n"), 1); }

You probably already did it:)

cool4uma commented 1 year ago

Without a module on hand, it's hard to suggest something working.((

aafksab commented 1 year ago

yes, I did try that and found it needs to be on the same line/string for the AT commands to process properly. I can get you a module :) we have a discord channel where we are designing and producing many flipper boards

cool4uma commented 1 year ago

Wow, cool! :) I will be glad if I can help in some way in developing something useful for people

aafksab commented 1 year ago

https://discord.gg/bEFGbtBB

this is our discord server, let me know when you join, I am SusCloudz. I will make sure we get you a lora board :)

cool4uma commented 1 year ago

@aafksab Hello! I tested your UART_Terminal fork, it works fine for me, even with long commands. Unfortunately, I did not manage to buy the Lora module, but I think this is not so important, the AT commands have the same principle of operation everywhere. Your reason is definitely not a string length limit

For info: I tested on ESP-WROOM-32 with AT firmware.

AT_2

AT_1

cool4uma commented 1 year ago

I'm planning a big commit soon, which will have a separate switch for working with AT commands.

cool4uma commented 1 year ago

Planned commit pushed, AT command supported