517
518 local pdu
519 -- special handling of the simple cases
520 if action == ac.ACTION_OPTION_GET then
521 pdu = struct.pack(">BHH", funcCode, registerStart, registerCnt)
522 elseif 1 == registerCnt then
523 pdu = struct.pack(">BHc2", funcCode, registerStart, data)
524 else
525 -- Assume only one register range for now
526 pdu = struct.pack(">BHHBc", funcCode, registerStart, registerCnt, 2 * registerCnt, data)
527 end
528 local link = self -- Weird - Saw "attempt to index upvalue 'self' (a nil value)" in the CB's
529 link:send(ioaReq.mModule.mAddress, pdu, LINK_TX_RETRIES,
530 function(res, pdu)
531 link:ioaRequestCallback(res, pdu, ioaReq, subReqIx, subReqCnt, funcCode,
532 function()
533 link:processIOASubRequests(subReqIx + subReqCnt)
534 end)
535 end)
536 end
3:12.09, 08:51:09.020 ! � FATAL EXIT: LUAevent: Error: 2:
3:Modbus/Modbus.lua:531: attempt to index upvalue 'link' (a nil value)
3:stack traceback:
3: Modbus/Modbus.lua:531: in function 'mCallBack'
3: Modbus/Modbus.lua:136: in function 'receiveCB'
3: Modbus/Modbus.lua:168: in function <Modbus/Modbus.lua:167>
3: (tail call): ?
3: (tail call): ?
3: Modbus/Modbus.lua:184: in function <Modbus/Modbus.lua:184>
3: (tail call): ?
3: (tail call): ?