Skip to content

Commit 0fdd50a

Browse files
committed
add Bind Phrase echo field to simulator for string reload testing
1 parent 51da9e8 commit 0fdd50a

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

src/SCRIPTS/CRSFSimulator/csrfsimulator.lua

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ local txDevice = {
397397
serialNo = CRSF.ELRS_SERIAL_ID,
398398
hwVer = 0,
399399
swVer = 0x00030500, -- 3.5.0
400-
fieldCount = 23, -- total parameter count
400+
fieldCount = 24, -- total parameter count
401401
params = {
402402
{
403403
id = 1,
@@ -552,6 +552,12 @@ local txDevice = {
552552
progress = { "Binding...", "Waiting for RX...", "RX found", "Saving..." },
553553
},
554554

555+
-- Mirrors the Bind Phrase value. Editing the string below rewrites this INFO field
556+
-- on the device side, so it only updates in the UI if the STRING write reloads its
557+
-- sibling fields (reloadRelatedFields, not reloadParentFolder). Placed directly above
558+
-- Bind Phrase so both stay on screen together while editing.
559+
{ id = 24, parent = 0, type = CRSF.INFO, name = "Phrase Echo", value = "default" },
560+
555561
-- Editable string field
556562
{
557563
id = 20,
@@ -1200,6 +1206,14 @@ local function mockPush(command, data)
12001206
i = i + 1
12011207
end
12021208
param.value = (#chars > 0) and string.char(table.unpack(chars)) or ""
1209+
-- Bind Phrase: mirror into the Phrase Echo INFO sibling so the UI only
1210+
-- reflects the change if the STRING write reloads sibling fields.
1211+
if param.id == 20 then
1212+
local echo = findParam(device, 24)
1213+
if echo then
1214+
echo.value = param.value
1215+
end
1216+
end
12031217
elseif t == CRSF.FLOAT then
12041218
local v = bit32.lshift(data[4] or 0, 24)
12051219
+ bit32.lshift(data[5] or 0, 16)

0 commit comments

Comments
 (0)