viperet / esp8266-power-monitor

DIY Power Monitor project using PZEM-004T module and ESP-12F
GNU General Public License v3.0
18 stars 1 forks source link

Вопрос по сборке в PlatformIO #14

Closed AstashovAndrey closed 3 years ago

AstashovAndrey commented 3 years ago

Приветствую. Скажите пожалуйста, а код в данный момент собирается и актуальный? Я можно сказать что начинающий в этой деле, и у меня platformio сильно ругается, чуть ли не на все подряд. Вот я и решил спросить, это у меня беда, или по прошествии времени надо просто обновить код? И еще вопрос, чем прошивали?

viperet commented 3 years ago

Да, только что проверил - есть теперь ошибка при сборке библиотеки для PZEM. Нашел способ исправить - нужно удалить папки .pio/libdeps/*/EspSoftwareSerial и зависимость от EspSoftwareSerial в .pio/libdeps/*/PZEM-004T-v30/library.json.

viperet commented 3 years ago

Прошивал первый раз через esptool, потом по воздуху

AstashovAndrey commented 3 years ago

Такс, тогда получается что у меня стягиваются одноименные, но все таки не те либы.... Причем я по коду смотрю, и понимаю, что например блинкер - это больше к действию со светодиодами, а по факту, когда делаю build в platformio из visual studio code, то мне такая простыня выходит. Где и то что под blinker подразумевается совсем другое, и то SPIFSS теперь deprecated, и надо заменить на LittleFS и еще много всего разного. Но раз у Вас все собирается, видимо я что то не то делаю, или это в принципе не надо делать..... Если есть минутка, взгляните пожалуйста одним глазом, может вектор движения покажите. А то я уже собирался с нуля писать :) Но тут вспомнил что можно через гитхаб вопрос автору задать :)

Processing esp (platform: espressif8266; board: esp12e; framework: arduino) --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via -v, --verbose option CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/esp12e.html PLATFORM: Espressif 8266 (2.6.3) > Espressif ESP8266 ESP-12E HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash PACKAGES:

  • framework-arduinoespressif8266 3.20704.0 (2.7.4)
  • tool-esptool 1.413.0 (4.13)
  • tool-esptoolpy 1.30000.201119 (3.0.0)
  • toolchain-xtensa 2.40802.200502 (4.8.2) LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf LDF Modes: Finder ~ chain, Compatibility ~ soft Found 40 compatible libraries Scanning dependencies... Dependency Graph |-- 0.0.0-alpha+sha.59a1299a1f | |-- 1.0 | | |-- 1.0 | | |-- 0.16.1 | | | |-- 1.0 | | |-- 1.2 | | | |-- 1.0
    | | | |-- 0.16.1
    | | | | |-- 1.0 | |-- 1.2 | | |-- 1.0 | | |-- 0.16.1 | | | |-- 1.0 | |-- 1.0 | |-- 0.16.1 | | |-- 1.0 |-- 0.1.5 | |-- 1.0 | |-- 1.0 | |-- <Ethernet(esp8266)> 1.0.4 | | |-- 1.0 | |-- 1.0 | |-- 1.0 | |-- 1.2 | | |-- 0.16.1 | | | |-- 1.0 | | |-- 1.0 | |-- 1.0 | |-- 1.2 | | |-- 1.0 | | |-- 0.16.1 | | | |-- 1.0 | |-- 6.12.1 | |-- 1.0 | | |-- 0.16.1 | | | |-- 1.0 | | |-- 1.0 |-- 1.0.0 | |-- 6.12.1 |-- 0.16.0 | |-- 1.1.1 | | |-- 0.16.1 | | | |-- 1.0 | |-- 1.0 | | |-- 0.16.1 | | | |-- 1.0 | | |-- 1.0 | |-- 1.0 |-- 2.1.0 |-- 0.0.0-alpha+sha.eb583d713a |-- 2.3.6 | |-- 1.0 | |-- <Ethernet(esp8266)> 1.0.4 | | |-- 1.0 | |-- 1.0 | |-- 1.0 | |-- 1.0 | | |-- 0.16.1 | | | |-- 1.0 | | |-- 1.0 |-- 1.0 | |-- 1.0 | |-- 0.16.1 | | |-- 1.0 | |-- 1.2 | | |-- 1.0 | | |-- 0.16.1 | | | |-- 1.0 |-- 1.0 |-- 1.2 | |-- 1.0 | |-- 0.16.1 | | |-- 1.0 |-- 1.0 | |-- 0.16.1 | | |-- 1.0 | |-- 1.0 |-- 1.0 |-- 0.16.1 | |-- 1.0 Building in release mode Warning! '-Wl,-T' option for specifying linker scripts is deprecated. Please use 'board_build.ldscript' option in your 'platformio.ini' file. Compiling .pio\build\esp\src\main.cpp.o Generating LD script .pio\build\esp\ld\local.eagle.app.v6.common.ld Compiling .pio\build\esp\libc44\ESP8266WiFi\BearSSLHelpers.cpp.o Compiling .pio\build\esp\libc44\ESP8266WiFi\CertStoreBearSSL.cpp.o Compiling .pio\build\esp\libc44\ESP8266WiFi\ESP8266WiFi.cpp.o Compiling .pio\build\esp\libc44\ESP8266WiFi\ESP8266WiFiAP.cpp.o Compiling .pio\build\esp\libc44\ESP8266WiFi\ESP8266WiFiGeneric.cpp.o Compiling .pio\build\esp\libc44\ESP8266WiFi\ESP8266WiFiGratuitous.cpp.o Compiling .pio\build\esp\libc44\ESP8266WiFi\ESP8266WiFiMulti.cpp.o In file included from src\main.cpp:10:0: .pio\libdeps\esp\Blinker\src/Blinker.h:49:6: error: #error Please setting connect mode ahead! Here provided BLINKER_BLE/BLINKER_WIFI/BLINKER_MQTT mode!

    error Please setting connect mode ahead! Here provided BLINKER_BLE/BLINKER_WIFI/BLINKER_MQTT mode!

    ^ Compiling .pio\build\esp\libc44\ESP8266WiFi\ESP8266WiFiSTA-WPS.cpp.o Compiling .pio\build\esp\libc44\ESP8266WiFi\ESP8266WiFiSTA.cpp.o Compiling .pio\build\esp\libc44\ESP8266WiFi\ESP8266WiFiScan.cpp.o Compiling .pio\build\esp\libc44\ESP8266WiFi\WiFiClient.cpp.o Compiling .pio\build\esp\libc44\ESP8266WiFi\WiFiClientSecureAxTLS.cpp.o In file included from .pio\libdeps\esp\WiFi101\src/common/include/nm_common.h:45:0, from .pio\libdeps\esp\WiFi101\src/socket/include/socket.h:60, from .pio\libdeps\esp\WiFi101\src/WiFiUdp.h:24, from C:\Users\astas.platformio\packages\framework-arduinoespressif8266\libraries\ArduinoOTA/ArduinoOTA.h:5, from src\main.cpp:5: .pio\libdeps\esp\WiFi101\src/bsp/include/nm_bsp.h:110:23: error: conflicting declaration 'typedef long unsigned int uint32' typedef unsigned long uint32; ^ In file included from C:\Users\astas.platformio\packages\framework-arduinoespressif8266\tools\sdk\include/ets_sys.h:28:0, from C:\Users\astas.platformio\packages\framework-arduinoespressif8266\cores\esp8266/pgmspace.h:11, from C:\Users\astas.platformio\packages\framework-arduinoespressif8266\cores\esp8266/WString.h:29, from C:\Users\astas.platformio\packages\framework-arduinoespressif8266\cores\esp8266/IPAddress.h:24, from C:\Users\astas.platformio\packages\framework-arduinoespressif8266\libraries\ESP8266WiFi\src/ESP8266WiFi.h:31, from C:\Users\astas.platformio\packages\framework-arduinoespressif8266\libraries\ArduinoOTA/ArduinoOTA.h:4, from src\main.cpp:5: C:\Users\astas.platformio\packages\framework-arduinoespressif8266\tools\sdk\include/c_types.h:49:29: error: 'uint32' has a previous declaration as 'typedef unsigned int uint32' typedef unsigned int uint32; ^ In file included from .pio\libdeps\esp\WiFi101\src/common/include/nm_common.h:45:0, from .pio\libdeps\esp\WiFi101\src/socket/include/socket.h:60, from .pio\libdeps\esp\WiFi101\src/WiFiUdp.h:24, from C:\Users\astas.platformio\packages\framework-arduinoespressif8266\libraries\ArduinoOTA/ArduinoOTA.h:5, from src\main.cpp:5: .pio\libdeps\esp\WiFi101\src/bsp/include/nm_bsp.h:133:22: error: conflicting declaration 'typedef long int sint32' typedef signed long sint32; ^ In file included from C:\Users\astas.platformio\packages\framework-arduinoespressif8266\tools\sdk\include/ets_sys.h:28:0, from C:\Users\astas.platformio\packages\framework-arduinoespressif8266\cores\esp8266/pgmspace.h:11, from C:\Users\astas.platformio\packages\framework-arduinoespressif8266\cores\esp8266/WString.h:29, from C:\Users\astas.platformio\packages\framework-arduinoespressif8266\cores\esp8266/IPAddress.h:24, from C:\Users\astas.platformio\packages\framework-arduinoespressif8266\libraries\ESP8266WiFi\src/ESP8266WiFi.h:31, from C:\Users\astas.platformio\packages\framework-arduinoespressif8266\libraries\ArduinoOTA/ArduinoOTA.h:4, from src\main.cpp:5: C:\Users\astas.platformio\packages\framework-arduinoespressif8266\tools\sdk\include/c_types.h:52:29: error: 'sint32' has a previous declaration as 'typedef int sint32' typedef signed int sint32; ^ In file included from src\main.cpp:7:0: .pio\libdeps\esp\WiFi101\src/WiFiClient.h:31:7: error: redefinition of 'class WiFiClient' class WiFiClient : public Client { ^ In file included from C:\Users\astas.platformio\packages\framework-arduinoespressif8266\libraries\ESP8266WiFi\src/ESP8266WiFi.h:39:0, from C:\Users\astas.platformio\packages\framework-arduinoespressif8266\libraries\ArduinoOTA/ArduinoOTA.h:4, from src\main.cpp:5: C:\Users\astas.platformio\packages\framework-arduinoespressif8266\libraries\ESP8266WiFi\src/WiFiClient.h:45:7: error: previous definition of 'class WiFiClient' class WiFiClient : public Client, public SList { ^ Compiling .pio\build\esp\libc44\ESP8266WiFi\WiFiClientSecureBearSSL.cpp.o In file included from .pio\libdeps\esp\PZEM-004T-v30/PZEM004Tv30.h:30:0, from src\main.cpp:13: .pio\libdeps\esp\EspSoftwareSerial\src/SoftwareSerial.h:132:9: error: 'int SoftwareSerial::availableForWrite()' marked override, but does not override int availableForWrite() override { ^ .pio\libdeps\esp\EspSoftwareSerial\src/SoftwareSerial.h:159:9: error: 'int SoftwareSerial::read(uint8_t, size_t)' marked override, but does not override int read(uint8_t buffer, size_t size) ^ src\main.cpp:44:1: error: 'Blinker' does not name a type Blinker blinker_red(LED_RED); ^ src\main.cpp:45:1: error: 'Blinker' does not name a type Blinker blinker_green(LED_GREEN); ^ src\main.cpp: In function 'void webSocketEvent(uint8_t, WStype_t, uint8_t*, size_t)': src\main.cpp:60:11: warning: enumeration value 'WStype_ERROR' not handled in switch [-Wswitch] switch(type) { ^ src\main.cpp:60:11: warning: enumeration value 'WStype_TEXT' not handled in switch [-Wswitch] src\main.cpp:60:11: warning: enumeration value 'WStype_BIN' not handled in switch [-Wswitch] src\main.cpp:60:11: warning: enumeration value 'WStype_FRAGMENT_TEXT_START' not handled in switch [-Wswitch] src\main.cpp:60:11: warning: enumeration value 'WStype_FRAGMENT_BIN_START' not handled in switch [-Wswitch] src\main.cpp:60:11: warning: enumeration value 'WStype_FRAGMENT' not handled in switch [-Wswitch] src\main.cpp:60:11: warning: enumeration value 'WStype_FRAGMENT_FIN' not handled in switch [-Wswitch] src\main.cpp:60:11: warning: enumeration value 'WStype_PING' not handled in switch [-Wswitch] src\main.cpp:60:11: warning: enumeration value 'WStype_PONG' not handled in switch [-Wswitch] src\main.cpp: In function 'void handleRoot()': src\main.cpp:90:9: warning: 'SPIFFS' is deprecated (declared at C:\Users\astas.platformio\packages\framework-arduinoespressif8266\cores\esp8266/FS.h:269): SPIFFS has been deprecated. Please consider moving to LittleFS or other filesystems. [-Wdeprecated-declarations] if (SPIFFS.exists(path)) ^ src\main.cpp:92:21: warning: 'SPIFFS' is deprecated (declared at C:\Users\astas.platformio\packages\framework-arduinoespressif8266\cores\esp8266/FS.h:269): SPIFFS has been deprecated. Please consider moving to LittleFS or other filesystems. [-Wdeprecated-declarations] File file = SPIFFS.open(path, "r"); ^ src\main.cpp:93:16: warning: unused variable 'sent' [-Wunused-variable] size_t sent = server.streamFile(file, contentType); ^ src\main.cpp: In function 'bool handleFileRead(String)': src\main.cpp:101:9: warning: 'SPIFFS' is deprecated (declared at C:\Users\astas.platformio\packages\framework-arduinoespressif8266\cores\esp8266/FS.h:269): SPIFFS has been deprecated. Please consider moving to LittleFS or other filesystems. [-Wdeprecated-declarations] if (SPIFFS.exists(path)) ^ src\main.cpp:103:21: warning: 'SPIFFS' is deprecated (declared at C:\Users\astas.platformio\packages\framework-arduinoespressif8266\cores\esp8266/FS.h:269): SPIFFS has been deprecated. Please consider moving to LittleFS or other filesystems. [-Wdeprecated-declarations] File file = SPIFFS.open(path, "r"); ^ src\main.cpp:104:16: warning: unused variable 'sent' [-Wunused-variable] size_t sent = server.streamFile(file, contentType); ^ src\main.cpp: In function 'void setup()': src\main.cpp:334:5: error: 'blinker_green' was not declared in this scope blinker_green.setDelay(1000, 1000); ^ src\main.cpp:344:5: warning: 'SPIFFS' is deprecated (declared at C:\Users\astas.platformio\packages\framework-arduinoespressif8266\cores\esp8266/FS.h:269): SPIFFS has been deprecated. Please consider moving to LittleFS or other filesystems. [-Wdeprecated-declarations] SPIFFS.begin(); ^ src\main.cpp: In function 'void loop()': src\main.cpp:382:5: error: 'blinker_red' was not declared in this scope blinker_red.blink(); ^ src\main.cpp:383:5: error: 'blinker_green' was not declared in this scope blinker_green.blink(); ^ *** [.pio\build\esp\src\main.cpp.o] Error 1 ================================================================================================== [FAILED] Took 8.98 seconds ==================================================================================================The terminal process "C:\Users\astas.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

viperet commented 3 years ago

Судя по всему у вас устанавливает не ту Blinker библиотеку. Я добавил пару коммитов которые более точно определяют требуемые библиотеки в platformio.ini (https://github.com/viperet/esp8266-power-monitor/blob/c3a0a09588bd0c51e29a33cfeec0490312b674be/platformio.ini#L20) обновите и попробуйте снова собрать.

AstashovAndrey commented 3 years ago

Только добрался для продолжения :) Да, спасибо. Собрал и запустил(заодно и привык и немного понял PlatformIO и VSCODE). Но есть в коде и бага, которая заставила меня немного "поковырять" код :) Свои изменения к Вам отправлю. Но там главная только одна строчка :) с mqtt.check :)