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

[BUG] 'numAverages' was not declared in this scope #450

Closed DonFalma closed 2 years ago

DonFalma commented 2 years ago

BSB-LAN Version master from github / commit b1765ffa

Architecture ESP32

Describe the bug Compiling the Code with #define AVERAGES commented out leads to error BSB_LAN/BSB_LAN.ino:3815:91: error: 'numAverages' was not declared in this scope

Expected behavior Compiles without errors

Additional context I think a possible fix for the problem is to move line 765 #ifdef AVERAGES to 766 in BSB_LAN.ino.

Fixed:

static const int numAverages = sizeof(avg_parameters) / sizeof(avg_parameters[0]);
#ifdef AVERAGES
float avgValues_Old[numAverages] = {0};
float avgValues[numAverages] = {0};
float avgValues_Current[numAverages] = {0};
int avgCounter = 1;
#endif
fredlcore commented 2 years ago

@dukess was kind enough to fix this quickly, so the current master repository should no longer have this error.

dukess commented 2 years ago

Oh, I didn't notice this problem, I discovered it independently. Yes, this correction is also suitable, but my program size will be little bit smaller. :)