added Luacheck GitHub action (#210)

* added shields.io elements
* #209 luacheck action
* #209 cleanup to pass luacheck
* added check statuses to readme
This commit is contained in:
Mikayla
2023-04-12 16:02:29 -04:00
committed by GitHub
parent 3ae39b2455
commit c987d14d8d
35 changed files with 93 additions and 114 deletions

View File

@@ -347,11 +347,9 @@ function modbus.new(rtu_dev, use_parallel_read)
response = { MODBUS_EXCODE.NEG_ACKNOWLEDGE }
end
-- default is to echo back
local func_code = packet.func_code
-- echo back with error flag, on success the "error" will be acknowledgement
func_code = bit.bor(packet.func_code, MODBUS_FCODE.ERROR_FLAG)
-- default is to echo back<br>
-- but here we echo back with error flag, on success the "error" will be acknowledgement
local func_code = bit.bor(packet.func_code, MODBUS_FCODE.ERROR_FLAG)
-- create reply
local reply = comms.modbus_packet()
@@ -365,8 +363,8 @@ function modbus.new(rtu_dev, use_parallel_read)
---@param packet modbus_frame
---@return boolean return_code, modbus_packet reply
function public.handle_packet(packet)
local return_code = true
local response = nil
local return_code ---@type boolean
local response ---@type table|MODBUS_EXCODE
if packet.length >= 2 then
-- handle by function code