crsf-wg / crsf

MIT License
124 stars 12 forks source link

Maximum length of strings as parameter names or values #22

Closed wimalopaan closed 2 days ago

wimalopaan commented 1 week ago

The maximum length of strings (parameter names and / or their values) is not well defined. Only implicitly according to the maximum length of CRSF packets. But I think there should be a fixed maximum length e.g. 10 chars + end-of-string.

ajjjjjjjj commented 5 days ago

Judging by crossfire device.lua or even elrsV3.lua, maxlen is sent as first byte after editable string termination character.

wimalopaan commented 5 days ago

Judging by crossfire device.lua or even elrsV3.lua, maxlen is sent as first byte after editable string termination character.

As the docu says this is optional and the docu named that "string units".

See also: https://github.com/crsf-wg/crsf/issues/23

ajjjjjjjj commented 5 days ago

Current docs are not accurate, for example 0x0D - COMMAND does not specify timeout byte but elrsV3 uses it:

local function fieldCommandLoad(field, data, offset)
  field.status = data[offset]
  field.timeout = data[offset+1]

Also: https://github.com/tbs-fpv/freedomtx/blob/c079f0151e3678fe3902ca82307733d20db1c4b6/radio/sdcard/taranis-x9/SCRIPTS/TOOLS/CROSSFIRE/device.lua#L294

wimalopaan commented 5 days ago

Current docs are not accurate,

Absolutely, therefore we need to file these issues ...

CapnBry commented 2 days ago

Current docs are not accurate, for example 0x0D - COMMAND does not specify timeout byte but elrsV3 uses it:

This is the sort of thing the Issue tracker should be used for so I fix it, not as an offhand comment in the middle of someone asking a question. Thanks for pointing this out though, I've updated the documentation.

CapnBry commented 2 days ago

The maximum length of strings (parameter names and / or their values) is not well defined

Because there is no limit apart from being able to fit things. What "fits" is up to the generator (developer) of the messages to be viewed by their users. If a developer is targeting all EdgeTX users with a lua script, then they must strike the balance of brevity vs descriptiveness to fit on the screen. That's not the CRSF protocol's job-- best practices are what is most practical for the application. The strings can go on and on across many parameter chunks if that is what the developer intends.