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
231 stars 84 forks source link

ProgNR int -> float #473

Closed dukess closed 2 years ago

dukess commented 2 years ago

Please review this PR.

Changes: ProgNR int -> float EEPROM scheme was changed (uint16_t -> float, 2 unused options removed) User sensors enumeration changed from 20200, 20201, 20202, 20203, 20204, etc to 20200.0,20200.1,20200.2,20200.3,20201.0, etc.

fredlcore commented 2 years ago

Looks great, thanks a lot! Does this already address the rounding "bug" you found?

fredlcore commented 2 years ago

Forget about my two earlier comments in code, found the answers myself :)

dukess commented 2 years ago

Just a question: The merging of cmdtbl1/2/3 into one cmdtbl is done in a different step, right?

I will do it little bit later with erasing AVR code.

fredlcore @.***> 28 августа 2022 г. 10:04:53 написал:

Forget about my two earlier comments in code, found the answers myself :) — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

1coderookie commented 2 years ago

Hi, I just tried to upload the latest version onto the Due, but the ArduinoIDE stops and reports an error:

Arduino: 1.8.8 (Linux), Board: "Arduino Due (Programming Port)"
(...)
In file included from /home/db/BSB-LAN-master/BSB_LAN/BSB_LAN.ino:1202:0:
/tmp/arduino_build_81609/sketch/include/get_cmdtbl_values.h: In
function 'float get_next_prognr(float, int)':
/tmp/arduino_build_81609/sketch/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 /home/db/BSB-LAN-master/BSB_LAN/BSB_LAN.ino:1202:0:
/tmp/arduino_build_81609/sketch/include/get_cmdtbl_values.h:78:27:
error: cannot convert 'float*' to 'double*' for argument '2' to
'double modf(double, double*)'
     modf(prognr, &intpart1);
                           ^
/tmp/arduino_build_81609/sketch/include/get_cmdtbl_values.h:79:31:
error: cannot convert 'float*' to 'double*' for argument '2' to
'double modf(double, double*)'
     modf(nextprognr, &intpart2);
                               ^
/tmp/arduino_build_81609/sketch/include/get_cmdtbl_values.h:85:37:
error: cannot convert 'float*' to 'double*' for argument '2' to
'double modf(double, double*)'
         modf(currentProgNR, &intpart);
                                     ^
/home/db/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);
                                                  ^
Mehrere Bibliotheken wurden für "EthernetUdp.h" gefunden
 Benutzt: /home/db/Arduino/libraries/Ethernet
 Nicht benutzt: /home/db/arduino-1.8.8/libraries/Ethernet
 Nicht benutzt: /home/db/arduino-1.8.8/libraries/Ethernet
 Nicht benutzt: /home/db/arduino-1.8.8/libraries/Ethernet
 Nicht benutzt: /home/db/arduino-1.8.8/libraries/Ethernet
Bibliothek SPI in Version 1.0 im Ordner:
/home/db/.arduino15/packages/arduino/hardware/sam/1.6.12/libraries/SPI
wird verwendet
Bibliothek Wire in Version 1.0 im Ordner:
/home/db/.arduino15/packages/arduino/hardware/sam/1.6.12/libraries/Wire
wird verwendet
Bibliothek Ethernet in Version 2.0.0 im Ordner:
/home/db/Arduino/libraries/Ethernet  wird verwendet
exit status 1
cannot convert 'float*' to 'double*' for argument '2' to 'double
modf(double, double*)'
dukess commented 2 years ago

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

1coderookie commented 2 years ago

Thanks - I don't need it right now though, i just wanted to have a look at the changes of the webinterface and thought it might be better if I'll report that error message ;)

dukess commented 2 years ago

Thank you, i will do a patch. :)

fredlcore commented 2 years ago

Also, /Q seems to print strange parameter numbers now, this is what I got from one user:


Starte Test...

56320 - Kessel - Nachstellzeit Tn TWW
0x2505072A
DC C2 00 0B 06 05 25 07 2A 41 99
DC 80 42 0E 07 25 05 07 2A 00 00 78 54 66

18944 - Trinkwasser Durchlauferhitzer - Schwelle zum Beenden einer BW-Zapfung bei DLH
0x313D10B5
DC C2 00 0B 06 3D 31 10 B5 9F A2
DC 80 42 0D 07 31 3D 10 B5 00 40 58 F5

19200 - Trinkwasser Durchlauferhitzer - Schwelle für Bw-Zapfung bei DLH in Komfort
0x313D10B6
DC C2 00 0B 06 3D 31 10 B6 AF C1
DC 80 42 0D 07 31 3D 10 B6 00 CE 71 E3

19456 - Trinkwasser Durchlauferhitzer - Schwelle für Bw-Zapfung bei Dlh in Heizbetrieb
0x313D10B7
DC C2 00 0B 06 3D 31 10 B7 BF E0
DC 80 42 0D 07 31 3D 10 B7 00 CE 46 D3

20224 - Trinkwasser Durchlauferhitzer - Sollwertkorrektur bei Auslaufregelung mit 40°C (°K)
0x313D10B8
DC C2 00 0B 06 3D 31 10 B8 4E 0F
DC 80 42 0D 07 31 3D 10 B8 00 00 52 60

20480 - Trinkwasser Durchlauferhitzer - Sollwertkorrektur bei Auslaufregelung mit 60°C (°K)
0x313D10B9
DC C2 00 0B 06 3D 31 10 B9 5E 2E
DC 80 42 0D 07 31 3D 10 B9 00 00 65 50

27136 - Trinkwasser Durchlauferhitzer - Zeit TWW-FlowSwitch geschlossen
0x053D3010
DC C2 00 0B 06 3D 05 30 10 65 6E
DC 80 42 0E 07 05 3D 30 10 00 00 00 C8 B9

51712 - Konfiguration - Mod Pumpe Förderhöhe Min
0x073D045B
DC C2 00 0B 06 3D 07 04 5B 3B F0
DC 80 42 0D 07 07 3D 04 5B 00 FF C6 CA

65280 - Konfiguration - Wasserdruckschwelle für Kessel und Pumpe aus
0x053D05DD
DC C2 00 0B 06 3D 05 05 DD 97 EF
DC 80 42 0D 07 05 3D 05 DD 00 03 9C 57

24576 - Konfiguration - KonfigRg1 Bit 0-7
0x053D15CC
DC C2 00 0B 06 3D 05 15 CC 96 8C
DC 80 42 0D 07 05 3D 15 CC 00 00 C3 C0

27136 - Konfiguration - KonfigRg2 Bit 0-7
0x053D15BB
DC C2 00 0B 06 3D 05 15 BB 98 FC
DC 80 42 0D 07 05 3D 15 BB 00 00 9E 58

42240 - Ein-/Ausgangstest - Spannungssignal H2
0x053D1621
DC C2 00 0B 06 3D 05 16 21 EF 5C
DC 80 42 0D 07 05 3D 16 21 11 00 8A 3E

44544 - Ein-/Ausgangstest - Spannungssignal H3
0x053D0FF9
DC C2 00 0B 06 3D 05 0F F9 1C C2
DC 80 42 0D 07 05 3D 0F F9 10 0D 4C 47

44800 - Ein-/Ausgangstest - Kontaktzustand H3
0x053D0DA7
DC C2 00 0B 06 3D 05 0D A7 C1 9B
DC 80 42 0D 07 05 3D 0D A7 00 FF 28 CE

Test beendet.
dukess commented 2 years ago

At least one typo in line 5410: printFmtToWebClient(PSTR("%d;"), prognr); Should be printFmtToWebClient(PSTR("%.1f;"), prognr);

and line 5467: printFmtToWebClient(PSTR("\r\n%hu - "), l);

i think we should rewrite 'Q' handler because it use integer as program numbers;