Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-m output with different ID #6

Open
jeanmarc77 opened this issue Dec 12, 2015 · 9 comments
Open

-m output with different ID #6

jeanmarc77 opened this issue Dec 12, 2015 · 9 comments

Comments

@jeanmarc77
Copy link

Hello,

Is it possible to have different IDs for import/export/total meters with the -m output ? (like IMP, EXP, TOT)
The data could eventually mess-up since each meters should have a unique ID.

Thanks

@The-Drake
Copy link

Hi jeanmarc, please try my fork version (not yet merged in main from gianfrdp), it already includes this feature.

https://github.com/The-Drake/SDM120C

@jeanmarc77
Copy link
Author

Hi Drake,

Thanks for your reply. I had trouble to compile your version.

I have like gianfrdp version to add into the make file.
export PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/local/lib/pkgconfig
export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib

[root@i3 SDM120Cdrk]# make
gcc -c -o sdm120c.o sdm120c.c -O2 -Wall -g pkg-config --cflags libmodbus
sdm120c.c: Dans la fonction ‘tv_diff’:
sdm120c.c:188:5: attention : implicit declaration of function ‘timersub’
[-Wimplicit-function-declaration]
timersub(t1, t2, &res);
^
sdm120c.c: Dans la fonction ‘getCurTime’:
sdm120c.c:212:28: erreur: storage size of ‘tz’ isn’t known
static struct timezone tz;
^
sdm120c.c:217:5: attention : implicit declaration of function
‘gettimeofday’ [-Wimplicit-function-declaration]
gettimeofday(&_t, &tz);
^
sdm120c.c:212:28: attention : unused variable ‘tz’ [-Wunused-variable]
static struct timezone tz;
^
sdm120c.c: Dans la fonction ‘main’:
sdm120c.c:1271:37: attention : format ‘%lu’ expects argument of type ‘long
unsigned int’, but argument 4 has type ‘uint32_t {alias unsigned int}’
[-Wformat=]
fprintf(stderr, "%s: -j Response timeout (%lu) out of
range, 0-500.\n",programName,resp_timeout);
^
sdm120c.c:1278:37: attention : format ‘%lu’ expects argument of type ‘long
unsigned int’, but argument 4 has type ‘uint32_t {alias unsigned int}’
[-Wformat=]
fprintf(stderr, "%s: -y Byte timeout (%lu) out of
range, 1-500.\n",programName,byte_timeout);
^
Makefile:9 : la recette pour la cible « sdm120c.o » a échouée
make: *** [sdm120c.o] Erreur 1

On Sat, Dec 12, 2015 at 9:03 AM, The-Drake notifications@github.com wrote:

Hi jeanmarc, please try my fork version (not yet merged in main from
gianfrdp), it already includes this feature.

https://github.com/The-Drake/SDM120C


Reply to this email directly or view it on GitHub
#6 (comment).

@The-Drake
Copy link

Please try this fix in file sdm120c.c:

#include <sys/types.h>
#include <sys/file.h>
-#include <time.h>
+#include <sys/time.h>

+#include <time.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>

@jeanmarc77
Copy link
Author

Sorry but include what ? ;)

@The-Drake
Copy link

Ops, sorry... :)

 #include <sys/types.h>
 #include <sys/file.h>
-#include <time.h>
+#include <sys/time.h>

+#include <time.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <stdarg.h>

@jeanmarc77
Copy link
Author

Thanks, I had few warnings (see bellow) and i have to export
LD_RUN_PATH=/usr/local/lib
I am trying your version, so far it work ;)

[root@i3 SDM120Cdrk]# make
gcc -c -o sdm120c.o sdm120c.c -O2 -Wall -g pkg-config --cflags libmodbus
sdm120c.c: In function ‘main’:
sdm120c.c:1273:37: warning: format ‘%lu’ expects argument of type ‘long
unsigned int’, but argument 4 has type ‘uint32_t {aka unsigned int}’
[-Wformat=]
fprintf(stderr, "%s: -j Response timeout (%lu) out of
range, 0-500.\n",programName,resp_timeout);
^
sdm120c.c:1280:37: warning: format ‘%lu’ expects argument of type ‘long
unsigned int’, but argument 4 has type ‘uint32_t {aka unsigned int}’
[-Wformat=]
fprintf(stderr, "%s: -y Byte timeout (%lu) out of
range, 1-500.\n",programName,byte_timeout);
^
gcc -o sdm120c sdm120c.o -O2 -Wall -g pkg-config --libs libmodbus
chmod 4711 sdm120c
[root@i3 SDM120Cdrk]# ./sdm120c
./sdm120c: error while loading shared libraries: libmodbus.so.5: cannot
open shared object file: No such file or directory
[root@i3 SDM120Cdrk]# export LD_RUN_PATH=/usr/local/lib
[root@i3 SDM120Cdrk]# make
make: 'sdm120c' is up to date.
[root@i3 SDM120Cdrk]#
[root@i3 SDM120Cdrk]# ./sdm120c
./sdm120c: error while loading shared libraries: libmodbus.so.5: cannot
open shared object file: No such file or directory
[root@i3 SDM120Cdrk]# make clean
rm -f *.o sdm120c
[root@i3 SDM120Cdrk]#
[root@i3 SDM120Cdrk]# make
gcc -c -o sdm120c.o sdm120c.c -O2 -Wall -g pkg-config --cflags libmodbus
sdm120c.c: In function ‘main’:
sdm120c.c:1273:37: warning: format ‘%lu’ expects argument of type ‘long
unsigned int’, but argument 4 has type ‘uint32_t {aka unsigned int}’
[-Wformat=]
fprintf(stderr, "%s: -j Response timeout (%lu) out of
range, 0-500.\n",programName,resp_timeout);
^
sdm120c.c:1280:37: warning: format ‘%lu’ expects argument of type ‘long
unsigned int’, but argument 4 has type ‘uint32_t {aka unsigned int}’
[-Wformat=]
fprintf(stderr, "%s: -y Byte timeout (%lu) out of
range, 1-500.\n",programName,byte_timeout);
^
gcc -o sdm120c sdm120c.o -O2 -Wall -g pkg-config --libs libmodbus
chmod 4711 sdm120c
[root@i3 SDM120Cdrk]#

On Sat, Dec 12, 2015 at 11:20 AM, The-Drake notifications@github.com
wrote:

Ops, sorry... :)

#include <sys/types.h>
#include <sys/file.h>
-#include <time.h>
+#include <sys/time.h>

+#include <time.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>


Reply to this email directly or view it on GitHub
#6 (comment).

@The-Drake
Copy link

Warnings should be fixed now. Please try v1.3.5.2.

@jeanmarc77
Copy link
Author

jeanmarc77 commented Dec 12, 2015 via email

@The-Drake
Copy link

Fixed with latest merge in this repo too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants