Giter Site home page Giter Site logo

lua-libmodbus's People

Contributors

astvaldur avatar karlp avatar ntd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lua-libmodbus's Issues

modbus/modbus.h: No such file or directory

Hi Karlp, et al.
Compiling with MinGW and MSYS. libmodbus compiled successfully. LuaRocks complains:

os.execute: C: & cd "C:\Users\WSMATH~1\AppData\Local\Temp\luarocks_lua-libmodbus-0.4.2-1-2627\lua-libmodbus" & mingw32-gcc -O2 "-c" "-o" "lua-libmodbus.o" "-IC:\Lua\5.1\include" "lua-libmodbus.c" "-I$LIBMODBUS_INCDIR"
lua-libmodbus.c:41:10: fatal error: modbus/modbus.h: No such file or directory
#include <modbus/modbus.h>
^~~~~~~~~~~~~~~~~
compilation terminated.

The command:
luarocks install lua-libmodbus LUAPKG=lua-5.1 LIBMODBUS_DIR=C:\MinGW\msys\1.0\local\bin LIBMODBUS_INCDIR=C:\MinGW\msys\1.0\local\include --verbose

Any ideas?

I already tried MSYS/make. The complaint:

wsmathews@DESKTOP-LO9R9RB /c/Users/wsmathews/Downloads/lua-libmodbus-master
$ make
/bin/sh: pkg-config: command not found
/bin/sh: pkg-config: command not found
/bin/sh: pkg-config: command not found
/bin/sh: pkg-config: command not found
make: pkg-config: Command not found
make: pkg-config: Command not found
make: pkg-config: Command not found
make: pkg-config: Command not found
cc -c -g -fPIC -std=c11 -Wall -pedantic -Os -o lua-libmodbus.o lua-libmodbus.c
make: cc: Command not found
make: *** [lua-libmodbus.o] Error 127

Idea: get_32/64 routines to work on table/offsets as well as components

Currently, the helpers to get/set 32/64 bit values from 16bit registers expect to get each register as a parameter.

regs = read_registers(0x2000, 20)
local number = mb.get_s64(regs[10],regs[11], regs[12], regs[13])

when pulling out multiple numbers, it might be nice to support indexing a register table instead? Could automatically attempt to do the right thing based on the type of the first argument?

regs = read_registers(0x2000, 20)
local number = mb.get_s64(regs, 10)

write_registers(addr, {-5, 10, -20}) doesn't work

The conversion from the lua table to an array of uint16_t's for libmodbus is truncating badly on openwrt/lnum patched devices at least.

Should make sure that it behaves predictably on both desktop 5.1/5.3 and openwrt patched 5.1

get_s16 doesn't work well with lnum patch

on lua5.1 and 5.3 vanilla, the get_s16(-5) call "correctly" returns -5 as expected

Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio (double int32)
> mb=require("libmodbus")
> =mb.get_s16(-5)
0
> =mb.get_s16(5)
5
> =mb.get_s16(0xface)
-1330
> 

TODO: add int32/float methods to help convert types

given the mess with bit libraries on different lua versions, and the different ways of getting 32bit signed/unsigned integers and floats out of modbus registers, add at least the basic helpers into the library directly so you don't have to keep adding this code yourself all over the place.

In one application libmodbus.so for lua 5.1 works fine, but in another (same version Lua) get an error

Hi Karl,
On the same system, in one application (ZBStudio), the compiled libmodbus.so for lua 5.1 works fine, but in another(Crank Storyboard), when connecting to the same version of lua, when trying to mb = require("libmodbus"), it gives the error I get an error ERROR [0.757] :LUA script failure (entry function: cb_invokeModule ): error loading module 'libmodbus' from file '/usr/local/lib/lua/5.1/libmodbus.so':
/usr/local/lib/lua/5.1/libmodbus.so: undefined symbol: lua_gettop, what could i be wrong, thanks

(Linux 4.4.180-94.147-default (8e3cd9f) x86_64 x86_64 GNU/Linux)
Sergio

Release 0.5.1 or 0.6

Are you planning to release/tag latest changes? Particularly, RS485 mode for serial port feature.
Having tagged release would simplify to push latest feature to upstream Linux distributions, ie. Alpine.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.