edgetx icon indicating copy to clipboard operation
edgetx copied to clipboard

corrupted characters in getSourceName()

Open offer-shmuely opened this issue 1 year ago • 3 comments

What part of EdgeTX is the focus of this bug?

Transmitter firmware

Current Behavior

the name returned for some of the fields have additional invisible characters

firmSourceName = getSourceName(126) -- get SD name

we got firmSourceName as: 0xC2 0x8C 0x53 0x41

Expected Behavior

firmSourceName should be: 0x53 0x41

Steps To Reproduce

local i = 126
local expectedSourceName = "SD"
local firmSourceName = getSourceName(i)
print(string.format("source-id: %d, [%s](len:%d), [%s](len:%d) (is same: %s)", i, firmSourceName, string.len(firmSourceName), expectedSourceName, string.len(expectedSourceName), (firmSourceName == expectedSourceName)))
print(string.format("[%s] name as hex: %s", expectedSourceName, string.gsub(expectedSourceName, ".", function(c) return string.format("0x%02X ", string.byte(c)) end)))
print(string.format("[%s] name as hex: %s", firmSourceName,     string.gsub(firmSourceName,     ".", function(c) return string.format("0x%02X ", string.byte(c)) end)))

current result:

source-id: 126, [ŒSA](len:4), [SA](len:2) (is same: false)
[SA] name as hex: 0x53 0x41 
[ŒSA] name as hex: 0xC2 0x8C 0x53 0x41 

Version

2.10.1

Transmitter

FrSky X10 / X10S (ACCST) TX16s

Anything else?

this bug exist for long time the code that clean it: image

offer-shmuely avatar Jun 14 '24 07:06 offer-shmuely

0xC2 0x8C == CHAR_SWITCH (The switch symbol).

philmoz avatar Jun 14 '24 07:06 philmoz

it does not work telemetry sensors as well, not only on switchs

source-id: 276, [“Cels](len:6), [Cels](len:4) (is same: false)
[Cels] name as hex: 0x43 0x65 0x6C 0x73 
[“Cels] name as hex: 0xC2 0x93 0x43 0x65 0x6C 0x73 
source-id: 276, [“Cels](len:6), [Cels](len:4) (is same: false)
[Cels] name as hex: 0x43 0x65 0x6C 0x73 
[“Cels] name as hex: 0xC2 0x93 0x43 0x65 0x6C 0x73

offer-shmuely avatar Jun 14 '24 11:06 offer-shmuely

This one has telemetry symbol

3djc avatar Jun 14 '24 11:06 3djc

I think this can be closed now, as these are expected "special" symbols/characters?

pfeerick avatar Feb 14 '25 02:02 pfeerick

Can you explain how this api should be used? If i have a list of sensor that i like to find one

Cels/VFR/RQly/.... how can i compare them?

Same way, i am searching for id of SF, how to compare the if name=="SF"

offer-shmuely avatar Feb 14 '25 12:02 offer-shmuely