fredlcore / BSB-LAN

LAN/WiFi interface for Boiler-System-Bus (BSB) and Local Process Bus (LPB) and Punkt-zu-Punkt Schnittstelle (PPS) with a Siemens® controller used by Elco®, Brötje® and similar heating systems
225 stars 84 forks source link

[BUG] Compile error Arduino Due #477

Closed chalojak closed 2 years ago

chalojak commented 2 years ago

BSB-LAN Version 2.1 - 30.07.2022

Architecture Arduino Due

Bus system NA

Describe the bug Arduino does compile the code and returns an error, see below.

Logs `Arduino: 1.8.19 (Windows Store 1.8.57.0) (Windows 10), Board: "Arduino Due (Programming Port)"

In file included from C:\Users\jakub.chaloupka\Downloads\BSB-LAN-master\BSB_LAN\BSB_LAN.ino:1202:0:

C:\Users\jakub.chaloupka\Downloads\BSB-LAN-master\BSB_LAN\include\get_cmdtbl_values.h: In function 'float get_next_prognr(float, int)':

C:\Users\jakub.chaloupka\Downloads\BSB-LAN-master\BSB_LAN\include\get_cmdtbl_values.h:59:33: error: cannot convert 'float' to 'double' for argument '2' to 'double modf(double, double*)'

 modf(currentProgNR, &intpart);

                             ^

In file included from C:\Users\jakub.chaloupka\Downloads\BSB-LAN-master\BSB_LAN\BSB_LAN.ino:1202:0:

C:\Users\jakub.chaloupka\Downloads\BSB-LAN-master\BSB_LAN\include\get_cmdtbl_values.h:78:27: error: cannot convert 'float' to 'double' for argument '2' to 'double modf(double, double*)'

 modf(prognr, &intpart1);

                       ^

C:\Users\jakub.chaloupka\Downloads\BSB-LAN-master\BSB_LAN\include\get_cmdtbl_values.h:79:31: error: cannot convert 'float' to 'double' for argument '2' to 'double modf(double, double*)'

 modf(nextprognr, &intpart2);

                           ^

C:\Users\jakub.chaloupka\Downloads\BSB-LAN-master\BSB_LAN\include\get_cmdtbl_values.h:85:37: error: cannot convert 'float' to 'double' for argument '2' to 'double modf(double, double*)'

     modf(currentProgNR, &intpart);

                                 ^

C:\Users\jakub.chaloupka\Downloads\BSB-LAN-master\BSB_LAN\BSB_LAN.ino: In function 'int findLine(float, uint16_t, uint32_t*)':

BSB_LAN:1280:49: error: cannot convert 'float' to 'double' for argument '2' to 'double modf(double, double*)'

       line = BSP_DHT22 + modf(line, &intpart);

                                             ^

BSB_LAN:1284:71: error: cannot convert 'float' to 'double' for argument '2' to 'double modf(double, double*)'

   case 4: {float intpart; line = BSP_ONEWIRE + modf(line, &intpart); break;}

                                                                   ^

BSB_LAN:1290:47: error: cannot convert 'float' to 'double' for argument '2' to 'double modf(double, double*)'

       line = BSP_MAX + modf(line, &intpart);

                                           ^

BSB_LAN:1300:50: error: cannot convert 'float' to 'double' for argument '2' to 'double modf(double, double*)'

       line = BSP_BME280 + modf(line, &intpart);

                                              ^

exit status 1

cannot convert 'float' to 'double' for argument '2' to 'double modf(double, double*)'`

Additional context Add any other context about the problem here.

dukess commented 2 years ago

As a temporary workaround you can change type of intpart, intpart1 and intpart2 from float to double.

fredlcore commented 2 years ago

Sorry, this is a known bug currently, and we're working on it to fix it. Please use the 2.0 release version for the moment.

fredlcore commented 2 years ago

Hm, strange, I just tried to compile for the Due (with VSCode) and standard _config.h and it compiled without errors. Did you change something already, @dukess?

dukess commented 2 years ago

Nope. This may be a specificity of Arduino Studio compiler/library.

dukess commented 2 years ago

Nope. This may be a specificity of Arduino Studio compiler/library.

chalojak commented 2 years ago

I confirm that I could compile the v2.0 without an error, but it occurred in the v2.1 in the same compiler.

út 30. 8. 2022 v 15:13 odesílatel Serguei S. Dukachev < @.***> napsal:

Nope. This may be a specificity of Arduino Studio compiler/library.

— Reply to this email directly, view it on GitHub https://github.com/fredlcore/BSB-LAN/issues/477#issuecomment-1231650413, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKR7VPOFHEZIYJW7ZSNRSRDV3YCGVANCNFSM6AAAAAAQAKOSWQ . You are receiving this because you authored the thread.Message ID: @.***>

fredlcore commented 2 years ago

Yes, we have added a function call that works perfectly fine in our development environment, but we're not using Arduino IDE. The cmath library looks the same on both environments, so it must be compiler specific. @dukess: Is it safe to just change all intpart* variables from float to double? Then I can do that quickly.

dukess commented 2 years ago

We can add definitions:

  #if defined(__SAM3X8E__)
    double intpart;
  #else
    float intpart;
  #endif
fredlcore commented 2 years ago

Should be fixed now with @dukess' latest changes in code. Please check if it now works, @chalojak and reopen the issue if the problem still persists.

1coderookie commented 2 years ago

Yepp, now it works! :) Great - thanks!

chalojak commented 2 years ago

Yes, I confirm that it works too. Thanks for the prompt support and amazing project!