Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions src/SCRIPTS/BF/MSP/common.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

-- Protocol version
MSP_VERSION = bit32.lshift(1,5)
MSP_STARTFLAG = bit32.lshift(1,4)
local MSP_VERSION = bit32.lshift(1,5)
local MSP_STARTFLAG = bit32.lshift(1,4)

-- Sequence number for next MSP packet
local mspSeq = 0
Expand All @@ -17,8 +16,6 @@ local mspTxIdx = 1
local mspTxCRC = 0
local mspTxPk = 0

mspPendingRequest = false

function mspProcessTxQ()
if (#(mspTxBuf) == 0) then
return false
Expand Down
12 changes: 5 additions & 7 deletions src/SCRIPTS/BF/MSP/crsf.lua
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@

-- CRSF Devices
CRSF_ADDRESS_BETAFLIGHT = 0xC8
CRSF_ADDRESS_RADIO_TRANSMITTER = 0xEA
local CRSF_ADDRESS_BETAFLIGHT = 0xC8
local CRSF_ADDRESS_RADIO_TRANSMITTER = 0xEA
-- CRSF Frame Types
CRSF_FRAMETYPE_MSP_REQ = 0x7A -- response request using msp sequence as command
CRSF_FRAMETYPE_MSP_RESP = 0x7B -- reply with 60 byte chunked binary
CRSF_FRAMETYPE_MSP_WRITE = 0x7C -- write with 60 byte chunked binary
local CRSF_FRAMETYPE_MSP_REQ = 0x7A -- response request using msp sequence as command
local CRSF_FRAMETYPE_MSP_RESP = 0x7B -- reply with 60 byte chunked binary
local CRSF_FRAMETYPE_MSP_WRITE = 0x7C -- write with 60 byte chunked binary

crsfMspCmd = 0
crsfMspHeader = {}

protocol.mspSend = function(payload)
local payloadOut = { CRSF_ADDRESS_BETAFLIGHT, CRSF_ADDRESS_RADIO_TRANSMITTER }
Expand Down
11 changes: 5 additions & 6 deletions src/SCRIPTS/BF/MSP/sp.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@

LOCAL_SENSOR_ID = 0x0D
SMARTPORT_REMOTE_SENSOR_ID = 0x1B
FPORT_REMOTE_SENSOR_ID = 0x00
REQUEST_FRAME_ID = 0x30
REPLY_FRAME_ID = 0x32
local LOCAL_SENSOR_ID = 0x0D
local SMARTPORT_REMOTE_SENSOR_ID = 0x1B
local FPORT_REMOTE_SENSOR_ID = 0x00
local REQUEST_FRAME_ID = 0x30
local REPLY_FRAME_ID = 0x32

local lastSensorId, lastFrameId, lastDataId, lastValue

Expand Down
2 changes: 1 addition & 1 deletion src/SCRIPTS/BF/protocols.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ local supportedProtocols =
}
}

function getProtocol()
local function getProtocol()
if supportedProtocols.smartPort.push() then
return supportedProtocols.smartPort
elseif supportedProtocols.crsf.push() then
Expand Down
2 changes: 1 addition & 1 deletion src/SCRIPTS/BF/ui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ end

local function saveSettings(new)
if Page.values then
local payload = {}
if Page.preSave then
payload = Page.preSave(Page)
else
payload = {}
for i=1,(Page.outputBytes or #Page.values) do
payload[i] = Page.values[i]
end
Expand Down