Unsolved Error: ‘void adc_power_off()’ is deprecated [-Wdeprecated-declarations]

nour.elzein
Posts: 1
Joined: Sat Jan 01, 2022 6:59 pm

Unsolved Error: ‘void adc_power_off()’ is deprecated [-Wdeprecated-declarations]

Postby nour.elzein » Sat Jan 01, 2022 7:06 pm

Hi, I am very new to this software and was trying out a mini project by uploading and monitoring a code on PlatformIO IDE on to a LilyGo-TTGo-HiGrow sensor, but i keep getting two warnings that I don’t know how to solve. Before i display the errors, i want to point out some things that might be the causes of this: i am putting my WIFI and WIFI password exactly as i do when i try to connect my phone for example, is that right? Also, i downloaded the MQTT add-on on Home Assistant and am using the same broker name, username, and password for the code on PlatformIO, is that also right (my broker name is core-mosquitto and i have a feeling it has to be in the form of an IP address all numbers, but I’m also not sure)? I know that warnings must not cause a sensor to not give out output results, but i am not getting any sensor outputs, that is why i am here!

The link to the code i am using is: https://github.com/pesor/TTGO-T-HIGrow/ ... er/include

This is the error I’m getting:
Error Message: ‘void adc_power_off()’ is deprecated [-Wdeprecated-declarations]
Full Error Message:

Code: Select all

void goToDeepSleep()
{

  Serial.print("Going to sleep... ");

  Serial.print(TIME_TO_SLEEP);

  Serial.println(" seconds");

  if (logging) {

    writeFile(SPIFFS, "/error.log", "Going to sleep for 10800 seconds \n");

  }

  WiFi.disconnect(true);

  WiFi.mode(WIFI_OFF);

  btStop();

  // Configure the timer to wake us up!

  esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR);

  // Testpurposes

  //esp_sleep_enable_timer_wakeup(10 * uS_TO_S_FACTOR);

  if (logging)

  {

    writeFile(SPIFFS, "/error.log", "Going to deep sleep \n \n \n");

  }

  // Go to sleep! Zzzz

  esp_deep_sleep_start();

}

void goToDeepSleepFiveMinutes()

{

  Serial.print("Going to sleep... ");

  Serial.print("300");

  Serial.println(" sekunder");

  if (logging) {

    writeFile(SPIFFS, "/error.log", "Going to sleep for 300 seconds \n");

  }

  WiFi.disconnect(true);

  WiFi.mode(WIFI_OFF);

  btStop();

  adc_power_off();

  esp_wifi_stop();

  esp_bt_controller_disable();

  // Configure the timer to wake us up!

  ++sleep5no;

  esp_sleep_enable_timer_wakeup(300 * uS_TO_S_FACTOR);

  // Go to sleep! Zzzz

  esp_deep_sleep_start();

}
This is the second similar error:

Code: Select all

void goToDeepSleep()
{

      Serial.print("Going to sleep... ");

      Serial.print(TIME_TO_SLEEP);

      Serial.println(" seconds");

      if (logging) {

        writeFile(SPIFFS, "/error.log", "Going to sleep for 10800 seconds \n");

      }

      WiFi.disconnect(true);

      WiFi.mode(WIFI_OFF);

      btStop();

      // Configure the timer to wake us up!

      esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR);

      // Testpurposes

      //esp_sleep_enable_timer_wakeup(10 * uS_TO_S_FACTOR);

      if (logging)

      {

        writeFile(SPIFFS, "/error.log", "Going to deep sleep \n \n \n");

      }

      // Go to sleep! Zzzz

      esp_deep_sleep_start();

    }

    void goToDeepSleepFiveMinutes()

    {

      Serial.print("Going to sleep... ");

      Serial.print("300");

      Serial.println(" sekunder");

      if (logging) {

        writeFile(SPIFFS, "/error.log", "Going to sleep for 300 seconds \n");

      }

      WiFi.disconnect(true);

      WiFi.mode(WIFI_OFF);

      btStop();

      adc_power_off();

      esp_wifi_stop();

      esp_bt_controller_disable();

      // Configure the timer to wake us up!

      ++sleep5no;

      esp_sleep_enable_timer_wakeup(300 * uS_TO_S_FACTOR);

      // Go to sleep! Zzzz

      esp_deep_sleep_start();

    }
For further info, this is the terminal when i try to upload and monitor:

Code: Select all

> Executing task: C:\Users\Imad\.platformio\penv\Scripts\platformio.exe run --target upload --target monitor --environment esp32dev <

Processing esp32dev (platform: espressif32; board: esp32dev; framework: arduino)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (3.4.0) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES: 
 - framework-arduinoespressif32 3.10006.210326 (1.0.6) 
 - tool-esptoolpy 1.30100.210531 (3.1.0) 
 - tool-mkspiffs 2.230.0 (2.30) 
 - toolchain-xtensa32 2.50200.97 (5.2.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 38 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <ArduinoJson> 6.17.0
|-- <ArduinoHttpClient> 0.4.0
|-- <esp32_ftpclient> 0.1.3
|   |-- <WiFi> 1.0
|-- <BH1750> 1.1.4
|   |-- <Wire> 1.0.1
|-- <Adafruit Unified Sensor> 1.1.4
|-- <DHT sensor library> 1.4.0
|   |-- <Adafruit Unified Sensor> 1.1.4
|-- <SPIFFS> 1.0
|   |-- <FS> 1.0
|-- <Adafruit BME280 Library> 2.1.2
|   |-- <Adafruit Unified Sensor> 1.1.4
|   |-- <SPI> 1.0
|   |-- <Wire> 1.0.1
|-- <NTPClient> 3.1.0
|-- <PubSubClient> 2.8.0
|-- <SD(esp32)> 1.0.5
|   |-- <FS> 1.0
|   |-- <SPI> 1.0
|-- <SPI> 1.0
|-- <Time> 1.6
|-- <WiFi> 1.0
|-- <Wire> 1.0.1
Building in release mode
Compiling .pio\build\esp32dev\src\main.cpp.o
Generating partitions .pio\build\esp32dev\partitions.bin
Compiling .pio\build\esp32dev\libe2b\ArduinoHttpClient\HttpClient.cpp.o
Compiling .pio\build\esp32dev\libe2b\ArduinoHttpClient\URLEncoder.cpp.o
Compiling .pio\build\esp32dev\libe2b\ArduinoHttpClient\WebSocketClient.cpp.o
Compiling .pio\build\esp32dev\libe2b\ArduinoHttpClient\b64.cpp.o
Compiling .pio\build\esp32dev\lib67e\WiFi\ETH.cpp.o
Compiling .pio\build\esp32dev\lib67e\WiFi\WiFi.cpp.o
Compiling .pio\build\esp32dev\lib67e\WiFi\WiFiAP.cpp.o
Compiling .pio\build\esp32dev\lib67e\WiFi\WiFiClient.cpp.o
.pio\libdeps\esp32dev\ArduinoHttpClient\src\HttpClient.cpp: In member function 'int HttpClient::startRequest(const char*, const char*, const char*, int, const byte*)':
.pio\libdeps\esp32dev\ArduinoHttpClient\src\HttpClient.cpp:87:61: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
             if (!iClient->connect(iServerName, iServerPort) > 0)
                                                             ^
.pio\libdeps\esp32dev\ArduinoHttpClient\src\HttpClient.cpp:97:64: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
             if (!iClient->connect(iServerAddress, iServerPort) > 0)
                                                                ^
Compiling .pio\build\esp32dev\lib67e\WiFi\WiFiGeneric.cpp.o
Compiling .pio\build\esp32dev\lib67e\WiFi\WiFiMulti.cpp.o
Archiving .pio\build\esp32dev\libe2b\libArduinoHttpClient.a
Compiling .pio\build\esp32dev\lib67e\WiFi\WiFiSTA.cpp.o
In file included from src\main.cpp:121:0:
src/go-to-deep-sleep.h: In function 'void goToDeepSleepFiveMinutes()':
src/go-to-deep-sleep.h:41:3: warning: 'void adc_power_off()' is deprecated [-Wdeprecated-declarations]
   adc_power_off();
   ^
In file included from src\main.cpp:15:0:
C:\Users\Imad\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\driver/driver/adc.h:242:6: note: declared here
 void adc_power_off(void) __attribute__((deprecated));
      ^
In file included from src\main.cpp:121:0:
src/go-to-deep-sleep.h:41:3: warning: 'void adc_power_off()' is deprecated [-Wdeprecated-declarations]
   adc_power_off();
   ^
In file included from src\main.cpp:15:0:
C:\Users\Imad\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\driver/driver/adc.h:242:6: note: declared here
 void adc_power_off(void) __attribute__((deprecated));
      ^
In file included from src\main.cpp:121:0:
src/go-to-deep-sleep.h:41:17: warning: 'void adc_power_off()' is deprecated [-Wdeprecated-declarations]
   adc_power_off();
                 ^
In file included from src\main.cpp:15:0:
C:\Users\Imad\.platformio\packages\framework-arduinoespressif32\tools\sdk\include\driver/driver/adc.h:242:6: note: declared here
 void adc_power_off(void) __attribute__((deprecated));
      ^
Compiling .pio\build\esp32dev\lib67e\WiFi\WiFiScan.cpp.o
Compiling .pio\build\esp32dev\lib67e\WiFi\WiFiServer.cpp.o
Compiling .pio\build\esp32dev\lib67e\WiFi\WiFiUdp.cpp.o
Compiling .pio\build\esp32dev\libfb1\esp32_ftpclient\ESP32_FTPClient.cpp.o
Compiling .pio\build\esp32dev\libe43\Wire\Wire.cpp.o
Compiling .pio\build\esp32dev\libc07\BH1750\BH1750.cpp.o
Compiling .pio\build\esp32dev\lib874\Adafruit Unified Sensor\Adafruit_Sensor.cpp.o
Archiving .pio\build\esp32dev\lib67e\libWiFi.a
Compiling .pio\build\esp32dev\lib226\DHT sensor library\DHT.cpp.o
Compiling .pio\build\esp32dev\lib226\DHT sensor library\DHT_U.cpp.o
Compiling .pio\build\esp32dev\lib176\FS\FS.cpp.o
Compiling .pio\build\esp32dev\lib176\FS\vfs_api.cpp.o
Archiving .pio\build\esp32dev\libfb1\libesp32_ftpclient.a
Compiling .pio\build\esp32dev\lib4d8\SPIFFS\SPIFFS.cpp.o
Archiving .pio\build\esp32dev\libe43\libWire.a
Archiving .pio\build\esp32dev\libc07\libBH1750.a
Compiling .pio\build\esp32dev\lib15a\SPI\SPI.cpp.o
Compiling .pio\build\esp32dev\libea6\Adafruit_BME280_Library\Adafruit_BME280.cpp.o
Archiving .pio\build\esp32dev\lib874\libAdafruit Unified Sensor.a
Compiling .pio\build\esp32dev\libd32\NTPClient\NTPClient.cpp.o
Archiving .pio\build\esp32dev\lib15a\libSPI.a
Archiving .pio\build\esp32dev\lib226\libDHT sensor library.a
Compiling .pio\build\esp32dev\libbf9\PubSubClient\PubSubClient.cpp.o
Compiling .pio\build\esp32dev\lib6fb\SD\SD.cpp.o
Compiling .pio\build\esp32dev\lib6fb\SD\sd_diskio.cpp.o
Compiling .pio\build\esp32dev\lib6fb\SD\sd_diskio_crc.c.o
Archiving .pio\build\esp32dev\lib176\libFS.a
Archiving .pio\build\esp32dev\lib4d8\libSPIFFS.a
Compiling .pio\build\esp32dev\lib956\TimeLib\DateStrings.cpp.o
Compiling .pio\build\esp32dev\lib956\TimeLib\Time.cpp.o
Archiving .pio\build\esp32dev\libFrameworkArduinoVariant.a
Compiling .pio\build\esp32dev\FrameworkArduino\Esp.cpp.o
Archiving .pio\build\esp32dev\libea6\libAdafruit_BME280_Library.a
Archiving .pio\build\esp32dev\libd32\libNTPClient.a
Compiling .pio\build\esp32dev\FrameworkArduino\FunctionalInterrupt.cpp.o
Compiling .pio\build\esp32dev\FrameworkArduino\HardwareSerial.cpp.o
Archiving .pio\build\esp32dev\libbf9\libPubSubClient.a
Compiling .pio\build\esp32dev\FrameworkArduino\IPAddress.cpp.o
Compiling .pio\build\esp32dev\FrameworkArduino\IPv6Address.cpp.o
Archiving .pio\build\esp32dev\lib6fb\libSD.a
Compiling .pio\build\esp32dev\FrameworkArduino\MD5Builder.cpp.o
Compiling .pio\build\esp32dev\FrameworkArduino\Print.cpp.o
Archiving .pio\build\esp32dev\lib956\libTimeLib.a
Compiling .pio\build\esp32dev\FrameworkArduino\Stream.cpp.o
Compiling .pio\build\esp32dev\FrameworkArduino\StreamString.cpp.o
Compiling .pio\build\esp32dev\FrameworkArduino\WMath.cpp.o
Compiling .pio\build\esp32dev\FrameworkArduino\WString.cpp.o
Compiling .pio\build\esp32dev\FrameworkArduino\base64.cpp.o
Compiling .pio\build\esp32dev\FrameworkArduino\cbuf.cpp.o
Compiling .pio\build\esp32dev\FrameworkArduino\esp32-hal-adc.c.o
Compiling .pio\build\esp32dev\FrameworkArduino\esp32-hal-bt.c.o
Compiling .pio\build\esp32dev\FrameworkArduino\esp32-hal-cpu.c.o
Compiling .pio\build\esp32dev\FrameworkArduino\esp32-hal-dac.c.o
Compiling .pio\build\esp32dev\FrameworkArduino\esp32-hal-gpio.c.o
Compiling .pio\build\esp32dev\FrameworkArduino\esp32-hal-i2c.c.o
Compiling .pio\build\esp32dev\FrameworkArduino\esp32-hal-ledc.c.o
Compiling .pio\build\esp32dev\FrameworkArduino\esp32-hal-log.c.o
Compiling .pio\build\esp32dev\FrameworkArduino\esp32-hal-matrix.c.o
Compiling .pio\build\esp32dev\FrameworkArduino\esp32-hal-misc.c.o
Compiling .pio\build\esp32dev\FrameworkArduino\esp32-hal-psram.c.o
Compiling .pio\build\esp32dev\FrameworkArduino\esp32-hal-rmt.c.o
Compiling .pio\build\esp32dev\FrameworkArduino\esp32-hal-sigmadelta.c.o
Compiling .pio\build\esp32dev\FrameworkArduino\esp32-hal-spi.c.o
Compiling .pio\build\esp32dev\FrameworkArduino\esp32-hal-time.c.o
Compiling .pio\build\esp32dev\FrameworkArduino\esp32-hal-timer.c.o
Compiling .pio\build\esp32dev\FrameworkArduino\esp32-hal-touch.c.o
Compiling .pio\build\esp32dev\FrameworkArduino\esp32-hal-uart.c.o
C:\Users\Imad\.platformio\packages\framework-arduinoespressif32\cores\esp32\esp32-hal-spi.c: In function 'spiTransferBytesNL':
C:\Users\Imad\.platformio\packages\framework-arduinoespressif32\cores\esp32\esp32-hal-spi.c:922:39: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
                 uint8_t * last_out8 = &result[c_longs-1];
                                       ^
C:\Users\Imad\.platformio\packages\framework-arduinoespressif32\cores\esp32\esp32-hal-spi.c:923:40: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
                 uint8_t * last_data8 = &last_data;
                                        ^
Compiling .pio\build\esp32dev\FrameworkArduino\libb64\cdecode.c.o
Compiling .pio\build\esp32dev\FrameworkArduino\libb64\cencode.c.o
Compiling .pio\build\esp32dev\FrameworkArduino\main.cpp.o
Compiling .pio\build\esp32dev\FrameworkArduino\stdlib_noniso.c.o
Compiling .pio\build\esp32dev\FrameworkArduino\wiring_pulse.c.o
Compiling .pio\build\esp32dev\FrameworkArduino\wiring_shift.c.o
Archiving .pio\build\esp32dev\libFrameworkArduino.a
Linking .pio\build\esp32dev\firmware.elf
Retrieving maximum program size .pio\build\esp32dev\firmware.elf
Checking size .pio\build\esp32dev\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]  13.2% (used 43316 bytes from 327680 bytes)
Flash: [=======   ]  69.9% (used 916182 bytes from 1310720 bytes)
Building .pio\build\esp32dev\firmware.bin
esptool.py v3.1
Merged 1 ELF section
Configuring upload protocol...
AVAILABLE: esp-prog, espota, esptool, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa
CURRENT: upload_protocol = esptool
Looking for upload port...
Auto-detected: COM3
Uploading .pio\build\esp32dev\firmware.bin
esptool.py v3.1
Serial port COM3
Connecting........__
Chip is ESP32-D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: fc:f5:c4:0c:fb:c0
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Auto-detected Flash size: 4MB
Flash will be erased from 0x00001000 to 0x00005fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x0000e000 to 0x0000ffff...
Flash will be erased from 0x00010000 to 0x000effff...
Compressed 17104 bytes to 11191...
Writing at 0x00001000... (100 %)
Wrote 17104 bytes (11191 compressed) at 0x00001000 in 0.6 seconds (effective 241.6 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 128...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (128 compressed) at 0x00008000 in 0.1 seconds (effective 350.8 kbit/s)...
Hash of data verified.
Compressed 8192 bytes to 47...
Writing at 0x0000e000... (100 %)
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.1 seconds (effective 490.0 kbit/s)...
Hash of data verified.
Compressed 916416 bytes to 536879...
Writing at 0x00010000... (3 %)
Writing at 0x0001b4bd... (6 %)
Writing at 0x000292de... (9 %)
Writing at 0x0004011d... (12 %)
Writing at 0x00045795... (15 %)
Writing at 0x0004b0b7... (18 %)
Writing at 0x00050235... (21 %)
Writing at 0x00055475... (24 %)
Writing at 0x0005a92b... (27 %)
Writing at 0x0005fdf9... (30 %)
Writing at 0x000654ea... (33 %)
Writing at 0x0006e741... (36 %)
Writing at 0x00074e2b... (39 %)
Writing at 0x0007a444... (42 %)
Writing at 0x0007fe94... (45 %)
Writing at 0x000850ca... (48 %)
Writing at 0x0008ac51... (51 %)
Writing at 0x00090c7c... (54 %)
Writing at 0x00096b34... (57 %)
Writing at 0x0009c567... (60 %)
Writing at 0x000a2063... (63 %)
Writing at 0x000a7c25... (66 %)
Writing at 0x000adb30... (69 %)
Writing at 0x000b42f6... (72 %)
Writing at 0x000ba066... (75 %)
Writing at 0x000c03bc... (78 %)
Writing at 0x000c620f... (81 %)
Writing at 0x000cbfe5... (84 %)
Writing at 0x000d1fd4... (87 %)
Writing at 0x000d9c54... (90 %)
Writing at 0x000df805... (93 %)
Writing at 0x000e4dcb... (96 %)
Writing at 0x000eac75... (100 %)
Wrote 916416 bytes (536879 compressed) at 0x00010000 in 13.3 seconds (effective 549.7 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
========================================================================================= [SUCCESS] Took 68.89 seconds =========================================================================================
--- Available filters and text transformations: colorize, debug, default, direct, esp32_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter, time
--- More details at https://bit.ly/pio-monitor-filters
--- Miniterm on COM3  115200,8,N,1 ---
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:10124
load:0x40080400,len:5828
entry 0x400806a8
Void Setup
Listing directory: /
- failed to open file for reading
Here comes the calibration info:

- failed to open file for reading
Here comes the name info:

- failed to open file for reading
Here comes the charge date info info:

Size of SSID array 1

SSID name: FRITZ!BOX7490.............................................................
............................................................
............................................................
....................we should break
Going to sleep... 300 sekunder
I hope anyone can help me, I would really appreciate that!

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Unsolved Error: ‘void adc_power_off()’ is deprecated [-Wdeprecated-declarations]

Postby WiFive » Mon Jan 03, 2022 1:50 am

It is just a warning so it does not prevent the app from compiling, flashing, and running. It times out when trying to connect to WiFi but there are no debug messages to help figure out why.

Who is online

Users browsing this forum: Bing [Bot] and 72 guests