Bastelschlumpf / M5PaperWeather

M5Paper project with weather information from openweathermap
116 stars 36 forks source link

Arduino compile error #6

Open dronix27 opened 2 years ago

dronix27 commented 2 years ago

In file included from D:\Arduino\M5PaperWeather\weather\Data.h:24, from D:\Arduino\M5PaperWeather\weather\weather.ino:30: D:\Arduino\M5PaperWeather\weather\Weather.h: In member function 'bool Weather::Fill(const JsonObject&)': D:\Arduino\M5PaperWeather\weather\Weather.h:127:75: warning: 'typename ArduinoJson6185_91::enable_if<ArduinoJson6185_91::is_same<T, char>::value, const char>::type ArduinoJson6185_91::MemberProxy<TParent, TStringRef>::as() const [with T = char; TObject = ArduinoJson6185_91::ElementProxy<ArduinoJson6185_91::MemberProxy<ArduinoJson6185_91::MemberProxy<ArduinoJson6185_91::ObjectRef, const char>, const char> >; TStringRef = const char; typename ArduinoJson6185_91::enable_if<ArduinoJson6185_91::is_same<T, char>::value, const char>::type = const char]' is deprecated: Replace as<char>() with as<const char>() [-Wdeprecated-declarations] hourlyMain[0] = root["current"]["weather"][0]["main"].as<char >(); ^ In file included from D:\Arduino\libraries\ArduinoJson\src/ArduinoJson/Document/JsonDocument.hpp:9, from D:\Arduino\libraries\ArduinoJson\src/ArduinoJson/Document/BasicJsonDocument.hpp:7, from D:\Arduino\libraries\ArduinoJson\src/ArduinoJson/Document/DynamicJsonDocument.hpp:7, from D:\Arduino\libraries\ArduinoJson\src/ArduinoJson.hpp:21, from D:\Arduino\libraries\ArduinoJson\src/ArduinoJson.h:9, from D:\Arduino\M5PaperWeather\weather\Weather.h:25, from D:\Arduino\M5PaperWeather\weather\Data.h:24, from D:\Arduino\M5PaperWeather\weather\weather.ino:30: D:\Arduino\libraries\ArduinoJson\src/ArduinoJson/Object/MemberProxy.hpp:79:7: note: declared here as() const { ^~ In file included from D:\Arduino\M5PaperWeather\weather\Data.h:24, from D:\Arduino\M5PaperWeather\weather\weather.ino:30: D:\Arduino\M5PaperWeather\weather\Weather.h:128:75: warning: 'typename ArduinoJson6185_91::enable_if<ArduinoJson6185_91::is_same<T, char>::value, const char>::type ArduinoJson6185_91::MemberProxy<TParent, TStringRef>::as() const [with T = char; TObject = ArduinoJson6185_91::ElementProxy<ArduinoJson6185_91::MemberProxy<ArduinoJson6185_91::MemberProxy<ArduinoJson6185_91::ObjectRef, const char>, const char> >; TStringRef = const char; typename ArduinoJson6185_91::enable_if<ArduinoJson6185_91::is_same<T, char>::value, const char>::type = const char]' is deprecated: Replace as<char>() with as<const char>() [-Wdeprecated-declarations] hourlyIcon[0] = root["current"]["weather"][0]["icon"].as<char >(); ^ In file included from D:\Arduino\libraries\ArduinoJson\src/ArduinoJson/Document/JsonDocument.hpp:9, from D:\Arduino\libraries\ArduinoJson\src/ArduinoJson/Document/BasicJsonDocument.hpp:7, from D:\Arduino\libraries\ArduinoJson\src/ArduinoJson/Document/DynamicJsonDocument.hpp:7, from D:\Arduino\libraries\ArduinoJson\src/ArduinoJson.hpp:21, from D:\Arduino\libraries\ArduinoJson\src/ArduinoJson.h:9, from D:\Arduino\M5PaperWeather\weather\Weather.h:25, from D:\Arduino\M5PaperWeather\weather\Data.h:24, from D:\Arduino\M5PaperWeather\weather\weather.ino:30: D:\Arduino\libraries\ArduinoJson\src/ArduinoJson/Object/MemberProxy.hpp:79:7: note: declared here as() const { ^~ In file included from D:\Arduino\M5PaperWeather\weather\Data.h:24, from D:\Arduino\M5PaperWeather\weather\weather.ino:30: D:\Arduino\M5PaperWeather\weather\Weather.h:133:84: warning: 'typename ArduinoJson6185_91::enable_if<ArduinoJson6185_91::is_same<T, char>::value, const char>::type ArduinoJson6185_91::MemberProxy<TParent, TStringRef>::as() const [with T = char; TObject = ArduinoJson6185_91::ElementProxy<ArduinoJson6185_91::MemberProxy<ArduinoJson6185_91::ElementProxy, const char> >; TStringRef = const char; typename ArduinoJson6185_91::enable_if<ArduinoJson6185_91::is_same<T, char>::value, const char>::type = const char]' is deprecated: Replace as<char>() with as<const char>() [-Wdeprecated-declarations] hourlyMain[i] = hourly_list[i - 1]["weather"][0]["main"].as<char >(); ^ In file included from D:\Arduino\libraries\ArduinoJson\src/ArduinoJson/Document/JsonDocument.hpp:9, from D:\Arduino\libraries\ArduinoJson\src/ArduinoJson/Document/BasicJsonDocument.hpp:7, from D:\Arduino\libraries\ArduinoJson\src/ArduinoJson/Document/DynamicJsonDocument.hpp:7, from D:\Arduino\libraries\ArduinoJson\src/ArduinoJson.hpp:21, from D:\Arduino\libraries\ArduinoJson\src/ArduinoJson.h:9, from D:\Arduino\M5PaperWeather\weather\Weather.h:25, from D:\Arduino\M5PaperWeather\weather\Data.h:24, from D:\Arduino\M5PaperWeather\weather\weather.ino:30: D:\Arduino\libraries\ArduinoJson\src/ArduinoJson/Object/MemberProxy.hpp:79:7: note: declared here as() const { ^~ In file included from D:\Arduino\M5PaperWeather\weather\Data.h:24, from D:\Arduino\M5PaperWeather\weather\weather.ino:30: D:\Arduino\M5PaperWeather\weather\Weather.h:134:84: warning: 'typename ArduinoJson6185_91::enable_if<ArduinoJson6185_91::is_same<T, char>::value, const char>::type ArduinoJson6185_91::MemberProxy<TParent, TStringRef>::as() const [with T = char; TObject = ArduinoJson6185_91::ElementProxy<ArduinoJson6185_91::MemberProxy<ArduinoJson6185_91::ElementProxy, const char> >; TStringRef = const char; typename ArduinoJson6185_91::enable_if<ArduinoJson6185_91::is_same<T, char>::value, const char>::type = const char]' is deprecated: Replace as<char>() with as<const char>() [-Wdeprecated-declarations] hourlyIcon[i] = hourly_list[i - 1]["weather"][0]["icon"].as<char >(); ^ In file included from D:\Arduino\libraries\ArduinoJson\src/ArduinoJson/Document/JsonDocument.hpp:9, from D:\Arduino\libraries\ArduinoJson\src/ArduinoJson/Document/BasicJsonDocument.hpp:7, from D:\Arduino\libraries\ArduinoJson\src/ArduinoJson/Document/DynamicJsonDocument.hpp:7, from D:\Arduino\libraries\ArduinoJson\src/ArduinoJson.hpp:21, from D:\Arduino\libraries\ArduinoJson\src/ArduinoJson.h:9, from D:\Arduino\M5PaperWeather\weather\Weather.h:25, from D:\Arduino\M5PaperWeather\weather\Data.h:24, from D:\Arduino\M5PaperWeather\weather\weather.ino:30: D:\Arduino\libraries\ArduinoJson\src/ArduinoJson/Object/MemberProxy.hpp:79:7: note: declared here as() const { ^~ D:\Arduino\libraries\M5EPD\src\M5EPD.cpp: In member function 'void M5EPD::BatteryADCBegin()': D:\Arduino\libraries\M5EPD\src\M5EPD.cpp:5:25: error: 'ADC1_GPIO35_CHANNEL' was not declared in this scope

define BAT_ADC_CHANNEL ADC1_GPIO35_CHANNEL

                     ^~~~~~~~~~~~~~~~~~~

D:\Arduino\libraries\M5EPD\src\M5EPD.cpp:90:31: note: in expansion of macro 'BAT_ADC_CHANNEL' adc1_config_channel_atten(BAT_ADC_CHANNEL, ADC_ATTEN_DB_11); ^~~~~~~ D:\Arduino\libraries\M5EPD\src\M5EPD.cpp:5:25: note: suggested alternative: 'ADC1_CHANNEL_7'

define BAT_ADC_CHANNEL ADC1_GPIO35_CHANNEL

                     ^~~~~~~~~~~~~~~~~~~

D:\Arduino\libraries\M5EPD\src\M5EPD.cpp:90:31: note: in expansion of macro 'BAT_ADC_CHANNEL' adc1_config_channel_atten(BAT_ADC_CHANNEL, ADC_ATTEN_DB_11); ^~~~~~~ D:\Arduino\libraries\M5EPD\src\M5EPD.cpp: In member function 'uint32_t M5EPD::getBatteryRaw()': D:\Arduino\libraries\M5EPD\src\M5EPD.cpp:5:25: error: 'ADC1_GPIO35_CHANNEL' was not declared in this scope

define BAT_ADC_CHANNEL ADC1_GPIO35_CHANNEL

                     ^~~~~~~~~~~~~~~~~~~

D:\Arduino\libraries\M5EPD\src\M5EPD.cpp:100:25: note: in expansion of macro 'BAT_ADC_CHANNEL' return adc1_get_raw(BAT_ADC_CHANNEL); ^~~~~~~ D:\Arduino\libraries\M5EPD\src\M5EPD.cpp:5:25: note: suggested alternative: 'ADC1_CHANNEL_7'

define BAT_ADC_CHANNEL ADC1_GPIO35_CHANNEL

                     ^~~~~~~~~~~~~~~~~~~

D:\Arduino\libraries\M5EPD\src\M5EPD.cpp:100:25: note: in expansion of macro 'BAT_ADC_CHANNEL' return adc1_get_raw(BAT_ADC_CHANNEL); ^~~~~~~ D:\Arduino\libraries\M5EPD\src\M5EPD.cpp: In member function 'uint32_t M5EPD::getBatteryVoltage()': D:\Arduino\libraries\M5EPD\src\M5EPD.cpp:5:25: error: 'ADC1_GPIO35_CHANNEL' was not declared in this scope

define BAT_ADC_CHANNEL ADC1_GPIO35_CHANNEL

                     ^~~~~~~~~~~~~~~~~~~

D:\Arduino\libraries\M5EPD\src\M5EPD.cpp:111:39: note: in expansion of macro 'BAT_ADC_CHANNEL' adc_raw_value += adc1_get_raw(BAT_ADC_CHANNEL); ^~~~~~~ D:\Arduino\libraries\M5EPD\src\M5EPD.cpp:5:25: note: suggested alternative: 'ADC1_CHANNEL_7'

define BAT_ADC_CHANNEL ADC1_GPIO35_CHANNEL

                     ^~~~~~~~~~~~~~~~~~~

D:\Arduino\libraries\M5EPD\src\M5EPD.cpp:111:39: note: in expansion of macro 'BAT_ADC_CHANNEL' adc_raw_value += adc1_get_raw(BAT_ADC_CHANNEL);

guglielmino commented 2 years ago

This error seems related to some constants names changed in driver/adc.h M5EPD.cpp starts defining a constant as below

#define BAT_ADC_CHANNEL ADC1_GPIO35_CHANNEL

Looking in adc.h it is clear that name of this constant is changed

...
 ADC1_CHANNEL_7,     /*!< ADC1 channel 7 is GPIO35 */
...

This is confirmed b the compiler output that suggests to use ADC1_CHANNEL_7 instead of ADC1_GPIO35_CHANNEL.

Btw, this issue seems fixed looking here, but the library linked by the Arduino boards manager JSON file is still broken.

Janaboy commented 2 years ago

This error seems related to some constants names changed in driver/adc.h M5EPD.cpp starts defining a constant as below

#define BAT_ADC_CHANNEL ADC1_GPIO35_CHANNEL

Looking in adc.h it is clear that name of this constant is changed

...
 ADC1_CHANNEL_7,     /*!< ADC1 channel 7 is GPIO35 */
...

This is confirmed b the compiler output that suggests to use ADC1_CHANNEL_7 instead of ADC1_GPIO35_CHANNEL.

Btw, this issue seems fixed looking here, but the library linked by the Arduino boards manager JSON file is still broken.

Is there any way to solve this? Still the same problem :(

GIGObug commented 2 months ago

I think these errors boil down to installed libraries I'm not sure which ones yet. The versions of those libraries is very important also. For example the ArduinoJson Library Version 6.12