Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tried to use the updated payload bresser.cpp to correct no rain stats, now doesnt complile #119

Open
mczakk opened this issue Dec 12, 2024 · 2 comments

Comments

@mczakk
Copy link

mczakk commented Dec 12, 2024

Hi Matthias, I saw that you had updated the payload_bresser.cpp to correct the rain stats issue, so i re installed the bresserweathersensor library. now my old .ino code does not compile at all, looking at the code, have you changed the weathersensor.h file, as the structures seem different and my code fails on those structures!

edited to add the error messages:



In file included from c:\Users\mtc20tfq\OneDrive - Bangor University\Documents\Arduino\libraries\RadioLib\src/modules/CC1101/CC1101.h:7,
                 from c:\Users\mtc20tfq\OneDrive - Bangor University\Documents\Arduino\libraries\RadioLib\src/RadioLib.h:69,
                 from c:\Users\mtc20tfq\OneDrive - Bangor University\Documents\Arduino\libraries\BresserWeatherSensorReceiver\src/WeatherSensor.h:99,
                 from C:\Users\mtc20tfq\OneDrive - Bangor University\Documents\Arduino\sketches\newbresseresp32\newbresseresp32.ino:193:
c:\users\mtc20tfq\onedrive - bangor university\documents\arduino\libraries\radiolib\src\protocols\physicallayer\physicallayer.h:138:9: error: 'FSK' conflicts with a previous declaration
  138 |   FSK = 0,
      |         ^
In file included from c:\Users\mtc20tfq\OneDrive - Bangor University\Documents\Arduino\libraries\MCCI_LoRaWAN_LMIC_library\src/lmic/lmic.h:37,
                 from c:\Users\mtc20tfq\OneDrive - Bangor University\Documents\Arduino\libraries\MCCI_LoRaWAN_LMIC_library\src/arduino_lmic.h:26,
                 from C:\Users\mtc20tfq\OneDrive - Bangor University\Documents\Arduino\sketches\newbresseresp32\newbresseresp32.ino:145:
c:\Users\mtc20tfq\OneDrive - Bangor University\Documents\Arduino\libraries\MCCI_LoRaWAN_LMIC_library\src/lmic/lorabase.h:41:14: note: previous declaration '_sf_t FSK'
   41 | enum _sf_t { FSK=0, SF7, SF8, SF9, SF10, SF11, SF12, SFrfu };
      |              ^~~
C:\Users\mtc20tfq\OneDrive - Bangor University\Documents\Arduino\sketches\newbresseresp32\newbresseresp32.ino: In member function 'void cSensor::setup(uint32_t)':
C:\Users\mtc20tfq\OneDrive - Bangor University\Documents\Arduino\sketches\newbresseresp32\newbresseresp32.ino:1210:78: error: invalid use of 'struct WeatherSensor::Weather'
 1210 |             if ((ws > -1) && weatherSensor.sensor[ws].valid && weatherSensor.Weather[ws].rain_ok) {
      |                                                                              ^~~~~~~
C:\Users\mtc20tfq\OneDrive - Bangor University\Documents\Arduino\sketches\newbresseresp32\newbresseresp32.ino:1211:58: error: invalid use of 'struct WeatherSensor::Weather'
 1211 |                 rainGauge.update(timeinfo, weatherSensor.Weather[ws].rain_mm, weatherSensor.sensor[ws].startup, rg_overflow);
      |                                                          ^~~~~~~
In file included from C:\Users\mtc20tfq\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.7\cores\esp32/esp32-hal.h:72,
                 from C:\Users\mtc20tfq\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.7\cores\esp32/Arduino.h:36,
                 from C:\Users\mtc20tfq\AppData\Local\arduino\sketches\6DC01CF21E669E0B1D3612568D3660B6\sketch\newbresseresp32.ino.cpp:1:
C:\Users\mtc20tfq\OneDrive - Bangor University\Documents\Arduino\sketches\newbresseresp32\newbresseresp32.ino: In member function 'void cSensor::doUplink()':
C:\Users\mtc20tfq\OneDrive - Bangor University\Documents\Arduino\sketches\newbresseresp32\newbresseresp32.ino:1417:69: error: invalid use of 'struct WeatherSensor::Weather'
 1417 |       DEBUG_PRINTF("Air Temperature:    % 3.1f °C",   weatherSensor.Weather[ws].temp_c);
      |                                                                     ^~~~~~~
C:\Users\mtc20tfq\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.7\cores\esp32/esp32-hal-log.h:139:76: note: in definition of macro 'log_d'
  139 | #define log_d(format, ...)     log_printf(ARDUHAL_LOG_FORMAT(D, format), ##__VA_ARGS__)
      |                                                                            ^~~~~~~~~~~
C:\Users\mtc20tfq\OneDrive - Bangor University\Documents\Arduino\sketches\newbresseresp32\newbresseresp32.ino:1417:7: note: in expansion of macro 'DEBUG_PRINTF'
 1417 |       DEBUG_PRINTF("Air Temperature:    % 3.1f °C",   weatherSensor.Weather[ws].temp_c);
      |       ^~~~~~~~~~~~
C:\Users\mtc20tfq\OneDrive - Bangor University\Documents\Arduino\sketches\newbresseresp32\newbresseresp32.ino:1418:69: error: invalid use of 'struct WeatherSensor::Weather'
 1418 |       DEBUG_PRINTF("Humidity:            %2d   %%",   weatherSensor.Weather[ws].humidity);
      |                                                                     ^~~~~~~
C:\Users\mtc20tfq\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.7\cores\esp32/esp32-hal-log.h:139:76: note: in definition of macro 'log_d'
  139 | #define log_d(format, ...)     log_printf(ARDUHAL_LOG_FORMAT(D, format), ##__VA_ARGS__)
      |                                                                            ^~~~~~~~~~~
C:\Users\mtc20tfq\OneDrive - Bangor University\Documents\Arduino\sketches\newbresseresp32\newbresseresp32.ino:1418:7: note: in expansion of macro 'DEBUG_PRINTF'
 1418 |       DEBUG_PRINTF("Humidity:            %2d   %%",   weatherSensor.Weather[ws].humidity);
      |       ^~~~~~~~~~~~
C:\Users\mtc20tfq\OneDrive - Bangor University\Documents\Arduino\sketches\newbresseresp32\newbresseresp32.ino:1419:69: error: invalid use of 'struct WeatherSensor::Weather'
 1419 |       DEBUG_PRINTF("Rain Gauge:       %7.1f mm",      weatherSensor.Weather[ws].rain_mm);
      |                                                                     ^~~~~~~
C:\Users\mtc20tfq\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.7\cores\esp32/esp32-hal-log.h:139:76: note: in definition of macro 'log_d'
  139 | #define log_d(format, ...)     log_printf(ARDUHAL_LOG_FORMAT(D, format), ##__VA_ARGS__)
      |                                                                            ^~~~~~~~~~~
C:\Users\mtc20tfq\OneDrive - Bangor University\Documents\Arduino\sketches\newbresseresp32\newbresseresp32.ino:1419:7: note: in expansion of macro 'DEBUG_PRINTF'
 1419 |       DEBUG_PRINTF("Rain Gauge:       %7.1f mm",      weatherSensor.Weather[ws].rain_mm);
      |       ^~~~~~~~~~~~
C:\Users\mtc20tfq\OneDrive - Bangor University\Documents\Arduino\sketches\newbresseresp32\newbresseresp32.ino:1420:69: error: invalid use of 'struct WeatherSensor::Weather'
 1420 |       DEBUG_PRINTF("Wind Speed (avg.):    %3.1f m/s", weatherSensor.Weather[ws].wind_avg_meter_sec_fp1/10.0);
      |                                                                     ^~~~~~~
C:\Users\mtc20tfq\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.7\cores\esp32/esp32-hal-log.h:139:76: note: in definition of macro 'log_d'
  139 | #define log_d(format, ...)     log_printf(ARDUHAL_LOG_FORMAT(D, format), ##__VA_ARGS__)
      |                                                                            ^~~~~~~~~~~
C:\Users\mtc20tfq\OneDrive - Bangor University\Documents\Arduino\sketches\newbresseresp32\newbresseresp32.ino:1420:7: note: in expansion of macro 'DEBUG_PRINTF'
 1420 |       DEBUG_PRINTF("Wind Speed (avg.):    %3.1f m/s", weatherSensor.Weather[ws].wind_avg_meter_sec_fp1/10.0);
      |       ^~~~~~~~~~~~
C:\Users\mtc20tfq\OneDrive - Bangor University\Documents\Arduino\sketches\newbresseresp32\newbresseresp32.ino:1421:69: error: invalid use of 'struct WeatherSensor::Weather'
 1421 |       DEBUG_PRINTF("Wind Speed (max.):    %3.1f m/s", weatherSensor.Weather[ws].wind_gust_meter_sec_fp1/10.0);
      |                                                                     ^~~~~~~
C:\Users\mtc20tfq\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.7\cores\esp32/esp32-hal-log.h:139:76: note: in definition of macro 'log_d'
  139 | #define log_d(format, ...)     log_printf(ARDUHAL_LOG_FORMAT(D, format), ##__VA_ARGS__)
      |                                                                            ^~~~~~~~~~~
C:\Users\mtc20tfq\OneDrive - Bangor University\Documents\Arduino\sketches\newbresseresp32\newbresseresp32.ino:1421:7: note: in expansion of macro 'DEBUG_PRINTF'
 1421 |       DEBUG_PRINTF("Wind Speed (max.):    %3.1f m/s", weatherSensor.Weather[ws].wind_gust_meter_sec_fp1/10.0);
      |       ^~~~~~~~~~~~
C:\Users\mtc20tfq\OneDrive - Bangor University\Documents\Arduino\sketches\newbresseresp32\newbresseresp32.ino:1422:69: error: invalid use of 'struct WeatherSensor::Weather'
 1422 |       DEBUG_PRINTF("Wind Direction:     %4.1f °",     weatherSensor.Weather[ws].wind_direction_deg_fp1/10.0);
      |                                                                     ^~~~~~~
C:\Users\mtc20tfq\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.7\cores\esp32/esp32-hal-log.h:139:76: note: in definition of macro 'log_d'
  139 | #define log_d(format, ...)     log_printf(ARDUHAL_LOG_FORMAT(D, format), ##__VA_ARGS__)
      |                                                                            ^~~~~~~~~~~
C:\Users\mtc20tfq\OneDrive - Bangor University\Documents\Arduino\sketches\newbresseresp32\newbresseresp32.ino:1422:7: note: in expansion of macro 'DEBUG_PRINTF'
 1422 |       DEBUG_PRINTF("Wind Direction:     %4.1f °",     weatherSensor.Weather[ws].wind_direction_deg_fp1/10.0);
      |       ^~~~~~~~~~~~
C:\Users\mtc20tfq\OneDrive - Bangor University\Documents\Arduino\sketches\newbresseresp32\newbresseresp32.ino:1526:48: error: invalid use of 'struct WeatherSensor::Weather'
 1526 |         encoder.writeTemperature(weatherSensor.Weather[ws].temp_c);
      |                                                ^~~~~~~
C:\Users\mtc20tfq\OneDrive - Bangor University\Documents\Arduino\sketches\newbresseresp32\newbresseresp32.ino:1527:42: error: invalid use of 'struct WeatherSensor::Weather'
 1527 |         encoder.writeUint8(weatherSensor.Weather[ws].humidity);
      |                                          ^~~~~~~
C:\Users\mtc20tfq\OneDrive - Bangor University\Documents\Arduino\sketches\newbresseresp32\newbresseresp32.ino:1533:47: error: invalid use of 'struct WeatherSensor::Weather'
 1533 |             encoder.writeUint16(weatherSensor.Weather[ws].wind_gust_meter_sec_fp1);
      |                                               ^~~~~~~
C:\Users\mtc20tfq\OneDrive - Bangor University\Documents\Arduino\sketches\newbresseresp32\newbresseresp32.ino:1534:47: error: invalid use of 'struct WeatherSensor::Weather'
 1534 |             encoder.writeUint16(weatherSensor.Weather[ws].wind_avg_meter_sec_fp1);
      |                                               ^~~~~~~
C:\Users\mtc20tfq\OneDrive - Bangor University\Documents\Arduino\sketches\newbresseresp32\newbresseresp32.ino:1535:47: error: invalid use of 'struct WeatherSensor::Weather'
 1535 |             encoder.writeUint16(weatherSensor.Weather[ws].wind_direction_deg_fp1);
      |                                               ^~~~~~~
C:\Users\mtc20tfq\OneDrive - Bangor University\Documents\Arduino\sketches\newbresseresp32\newbresseresp32.ino:1537:45: error: invalid use of 'struct WeatherSensor::Weather'
 1537 |         encoder.writeRawFloat(weatherSensor.Weather[ws].rain_mm);
      |                                             ^~~~~~~
C:\Users\mtc20tfq\OneDrive - Bangor University\Documents\Arduino\sketches\newbresseresp32\newbresseresp32.ino:1587:74: error: invalid use of 'struct WeatherSensor::Weather'
 1587 |         if ((ws > -1) && weatherSensor.sensor[ws].valid && weatherSensor.Weather[ws].rain_ok) {
      |                                                                          ^~~~~~~
C:\Users\mtc20tfq\OneDrive - Bangor University\Documents\Arduino\sketches\newbresseresp32\newbresseresp32.ino:1645:3: error: 'wsIndex' was not declared in this scope
 1645 |   wsIndex = ws;
      |   ^~~~~~~

exit status 1

Compilation error: invalid use of 'struct WeatherSensor::Weather'
@matthias-bs
Copy link
Owner

Hi @mczakk,

the first issue I see is

In file included from c:\Users\mtc20tfq\OneDrive - Bangor University\Documents\Arduino\libraries\RadioLib\src/modules/CC1101/CC1101.h:7,
                 from c:\Users\mtc20tfq\OneDrive - Bangor University\Documents\Arduino\libraries\RadioLib\src/RadioLib.h:69,
                 from c:\Users\mtc20tfq\OneDrive - Bangor University\Documents\Arduino\libraries\BresserWeatherSensorReceiver\src/WeatherSensor.h:99,
                 from C:\Users\mtc20tfq\OneDrive - Bangor University\Documents\Arduino\sketches\newbresseresp32\newbresseresp32.ino:193:
c:\users\mtc20tfq\onedrive - bangor university\documents\arduino\libraries\radiolib\src\protocols\physicallayer\physicallayer.h:138:9: error: 'FSK' conflicts with a previous declaration
  138 |   FSK = 0,
      |         ^
In file included from c:\Users\mtc20tfq\OneDrive - Bangor University\Documents\Arduino\libraries\MCCI_LoRaWAN_LMIC_library\src/lmic/lmic.h:37,
                 from c:\Users\mtc20tfq\OneDrive - Bangor University\Documents\Arduino\libraries\MCCI_LoRaWAN_LMIC_library\src/arduino_lmic.h:26,
                 from C:\Users\mtc20tfq\OneDrive - Bangor University\Documents\Arduino\sketches\newbresseresp32\newbresseresp32.ino:145:
c:\Users\mtc20tfq\OneDrive - Bangor University\Documents\Arduino\libraries\MCCI_LoRaWAN_LMIC_library\src/lmic/lorabase.h:41:14: note: previous declaration '_sf_t FSK'
   41 | enum _sf_t { FSK=0, SF7, SF8, SF9, SF10, SF11, SF12, SFrfu };
      |              ^~~

which shows that you are using RadioLib and MCCI_LoRaWAN_LMIC_library in the same sketch! I don't know why this happens, but this won't work!
BresserWeatherSensorLW and BresserWeatherSensorReceiver are based on RadioLib entirely. Maybe you've got some old stuff which was based on BresserWeatherSensorTTN.

For the other topic:

  1. Identify the version of BresserWeatherSensorLW you created the previous fork from
    (If the fork is still 20240821-feat-oled, you look at the file history and/or release notes around that date. Maybe it is https://github.com/matthias-bs/BresserWeatherSensorLW/releases/tag/v0.9.2 (from August 4) or https://github.com/matthias-bs/BresserWeatherSensorLW/releases/tag/v0.9.3 (from August 21)).

  2. Compare the changes between the version your fork was created from and the current
    (Lets assume it was v0.9.3 - then you check v0.9.3...v0.10.1 Here you don't see any differences in using the weatherSensor structure.)

It looks as if you are using some rather old stuff, or a weird mixture of different versions. The way you are using the structure dates back prior to changes made in matthias-bs/BresserWeatherSensorReceiver@caac416 (27 Oct 2023).

Looking at package.json, you always see a consistent set of library versions which is known to work.

@mczakk
Copy link
Author

mczakk commented Dec 21, 2024

yes, i probably have old stuff that was based on BresserWeatherSensorTTN as i havent updated it since the discovery that the rain statistyics were not working properly.
I have downlaoded you latest version (LW) and everything seems very different. I cant see how to integrate the SSD1306 display in the new .ino and when i try and compile without it i am getting all sorts of errors relating to BLE sensors and 'nimbleutils'
I've created a repository called old-code, which i think is the last working version of the esp bresser with oled (but failed tto do the rain stats). can you incorporate the display elements of this into the current (LW) code?

Many Thanks
Matt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants