TheWandrr / vedirect_to_mqtt

MIT License
8 stars 5 forks source link

install error #3

Closed riker65 closed 3 years ago

riker65 commented 3 years ago

Hi

I tried to install it

facing the error:

`sudo make install

cc -c -o vedirect_to_mqtt.o vedirect_to_mqtt.c

In file included from vedirect_to_mqtt.c:14: vedirect.h:74:5: error: unknown type name ‘uint16_t’ uint16_t address; ^~~~ vedirect_to_mqtt.c:92:1: error: unknown type name ‘uint8_t’; did you mean ‘u_int8_t’? uint8_t CalculateChecksum(char msg) { ^~~ u_int8_t vedirect_to_mqtt.c:114:30: error: unknown type name ‘uint16_t’; did you mean ‘u_int16_t’? void BuildRequest(char msg, uint16_t address) { ^~~~ u_int16_t vedirect_to_mqtt.c: In function ‘ProcessUARTTransmitQueueThread’: vedirect_to_mqtt.c:125:13: warning: implicit declaration of function ‘BuildRequest’ [-Wimplicit-function-declaration] BuildRequest(message_buffer, request_list[request_count - 1]); ^~~~ vedirect_to_mqtt.c: In function ‘ParseHexMessage’: vedirect_to_mqtt.c:221:5: error: unknown type name ‘uint8_t’; did you mean ‘u_int8_t’? uint8_t flags = 0; ^~~ u_int8_t vedirect_to_mqtt.c:269:45: error: ‘uint8_t’ undeclared (first use in this function); did you mean ‘u_int8_t’? data = (uint8_t)( ( asciiHexToInt((msg_buf + 0)) << 4 ) + ^~~ u_int8_t vedirect_to_mqtt.c:269:45: note: each undeclared identifier is reported only once for each function it appears in vedirect_to_mqtt.c:284:45: error: ‘uint16_t’ undeclared (first use in this function); did you mean ‘u_int16_t’? data = (uint16_t)( ( asciiHexToInt((msg_buf + 0)) << 4 ) + ^~~~ u_int16_t vedirect_to_mqtt.c:303:45: error: ‘uint32_t’ undeclared (first use in this function); did you mean ‘u_int32_t’? data = (uint32_t)( ( asciiHexToInt(*(msg_buf + 0)) << 4 ) + ^~~~ u_int32_t make: *** [: vedirect_to_mqtt.o] Error 1 `

thanks for hints.

BR T

TheWandrr commented 3 years ago

I just tried building this from a fresh clone and didn't have any problems. Can you provide the details of the platform you're building this on for future reference?

The bit-sized types are defined in stdint.h (others bring this in as well) so I've included this at the top of vedirect.h and pushed the change. Please update with my changes and let me know if this solves the build issue for you.

riker65 commented 3 years ago

I just tried building this from a fresh clone and didn't have any problems. Can you provide the details of the platform you're building this on for future reference?

The bit-sized types are defined in stdint.h (others bring this in as well) so I've included this at the top of vedirect.h and pushed the change. Please update with my changes and let me know if this solves the build issue for you.

will check and respond.

Running on Raspberry 3 with stretch

riker65 commented 3 years ago

make install worked now

thanks

` make install

cc -c -o vedirect_to_mqtt.o vedirect_to_mqtt.c

g++ vedirect_to_mqtt.o -o vedirect_to_mqtt -lwiringPi -lmosquitto -lpthread systemctl stop vedirect_to_mqtt Failed to stop vedirect_to_mqtt.service: Unit vedirect_to_mqtt.service not loaded. make: [Makefile:14: install] Error 5 (ignored) chown root:root ./vedirect_to_mqtt.service ./vedirect_to_mqtt chmod 664 ./vedirect_to_mqtt.service cp ./vedirect_to_mqtt.service /etc/systemd/system/ cp ./vedirect_to_mqtt /usr/local/lib/ systemctl daemon-reload systemctl enable vedirect_to_mqtt Created symlink /etc/systemd/system/multi-user.target.wants/vedirect_to_mqtt.service → /etc/systemd/system/vedirect_to_mqtt.service. systemctl restart vedirect_to_mqtt `

TheWandrr commented 3 years ago

The failure to stop the service initially can be safely ignored because there's no running service to stop. On subsequent builds it needs to be stopped before replacing files. This should all be happening automatically, just explaining a bit of what's going on there.

Otherwise, it looks like this is probably fixed. I remain curious why it wasn't a problem for me.

Feel free to let me know about other issues or general comments going forward.

riker65 commented 3 years ago

Hi thanks

can you guide me where to edit the mosquitto server? and the usb definition for device /dev/ttyusb1 I am using a DIY Cable

Thanks T

riker65 commented 3 years ago

another topic

having the device: BMV SmartShunt 500A/50mV

how to enable this in your settings?

would this be the place?

enum VEValidityFlags { VALID_ALL = 0b11111111, VALID_BMV700 = 0b00000001, VALID_BMV702 = 0b00000010, VALID_BMV712 = 0b00000100,

TheWandrr commented 3 years ago

Mosquitto server constant is in vedirect_to_mqtt.c near the top: "const char *mqtt_host ="

Serial port is near the start of main() in the same file: "// SETUP UART" ...

I don't have multiple devices for testing, so VEValidityFlags was intended to account for additional future devices and the differences between them. I don't think you're going to find many critical differences between BMVs, but you likely will when it comes to inverters and chargers (which could also use this library with some additions/changes).

To add the SmartShunt, you'd need to figure out where the functionality is the same and where it's different then incorporate that into the existing structure in an elegant way.

Much as I'd like to help others use this, I can't offer much personal application support. If you want to make changes and submit a pull request that's the best way to contribute.

riker65 commented 3 years ago

this worked great thanks