HWal / ESP8266_HAN_Receive_Web_Relay_Output

Receive and process messages from Kaifa smart electricity meter
1 stars 0 forks source link

Error when compiling #2

Open KarlNorway opened 2 years ago

KarlNorway commented 2 years ago

Hello.

First of all nice project.

I'm getting an error on compile from the int decodeMessage(unsigned char *buf, int buf_len, HanMsg *msg)

It seems that there is only a return if the else condition on the end for the function block is met.

Is there suppose to be a return there or am I missing somthing?

HWal commented 2 years ago

[image: cleardot.gif] Hi,

The actual function code was copied from an example provided by my local power grid company. However, here is what I found by looking up the question on Quora: https://www.quora.com/Is-it-mandatory-to-return-a-value-in-integer-type-function-in-C

Maybe it is not good practice....

I did, however, compile the code in Arduino IDE 1.8.5 just before writing this reply, and got no errors. Specified card type: NodeMCU 1.0 (ESP-12E Module).

My setup now runs a Raspberry Pi, but before that I used the ESP8266 for quite a while.

Thanks, Helge.

man. 20. des. 2021 kl. 20:57 skrev Karl Kristian Markman < @.***>:

Hello.

First of all nice project.

I'm getting an error on compile from the int decodeMessage(unsigned char buf, int buf_len, HanMsg msg)

It seems that there is only a return if the else condition on the end for the function block is met.

Is there suppose to be a return there or am I missing somthing?

— Reply to this email directly, view it on GitHub https://github.com/HWal/ESP8266_HAN_Receive_Web_Relay_Output/issues/2, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABBZHGGNWAJPY352NXE4UXTUR6DBFANCNFSM5KOP5LFA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

KarlNorway commented 2 years ago

Thanks Helge for reply.

I'm on Arduino 1.8.16, card WeMos D1 mini.

Tiried compiling now with two changes:

int decodeMessage(unsigned char *buf, int buf_len, HanMsg *msg) -> void decodeMessage(unsigned char *buf, int buf_len, HanMsg *msg)

int updateWeb(unsigned char *buf, int buf_len, HanMsg *msg) - > void updateWeb(unsigned char *buf, int buf_len, HanMsg *msg)

Compile OK.

Thanks ageain for the sharing the code

HWal commented 2 years ago

Hi,

Maybe the newer compiler is stricter regarding code correctness.

If you want to use the code for a real life application, please be aware that different makes of meters may have slightly different telegrams. If you have a meter other than Kaifa, some edit to the code may be necessary.

Helge.

tir. 21. des. 2021 kl. 07:31 skrev Karl Kristian Markman < @.***>:

Thanks Helge for reply.

I'm on Arduino 1.8.16, card WeMos D1 mini.

Tiried compiling now with two changes:

int decodeMessage(unsigned char buf, int buf_len, HanMsg msg) -> void decodeMessage(unsigned char buf, int buf_len, HanMsg msg)

int updateWeb(unsigned char buf, int buf_len, HanMsg msg) - > void updateWeb(unsigned char buf, int buf_len, HanMsg msg)

Compile OK.

Thanks ageain for the sharing the code

— Reply to this email directly, view it on GitHub https://github.com/HWal/ESP8266_HAN_Receive_Web_Relay_Output/issues/2#issuecomment-998510862, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABBZHGEXXVSER6CJPV7ZJW3USANN5ANCNFSM5KOP5LFA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>