First off - thank you for sharing this. I have finally gotten around and wired together my CC1101 with a NodeMCU (ESP8266 I think it is the ESP-12E).
I have managed to decrypt my Multical 21 key, and updated config.h with my wifi credentials and the serial and key for the multical.
It is the first time I use platformio, and although "pio check" succeeds, it fails when I run "pio run" to build the project:
host:~/gitwork/esp-multical21(master)$ pio project init --ide emacs --board nodemcuv2
host:~/gitwork/esp-multical21(master)$ pio check
Checking esp8266 > cppcheck (framework: arduino; platform: espressif8266; board: d1_mini_lite)
...
=========================================== [PASSED] Took 43.52 seconds ===========================================
Component HIGH MEDIUM LOW
------------------------------------- ------ -------- -----
.pio/libdeps/esp8266/Crypto 0 0 70
.pio/libdeps/esp8266/PubSubClient/src 0 0 6
include 0 0 3
src 0 15 16
Total 0 15 95
Environment Tool Status Duration
------------- -------- -------- ------------
esp8266 cppcheck PASSED 00:00:43.525
=========================================== 1 succeeded in 00:00:43.525 ===========================================
host:~/gitwork/esp-multical21(master)$ pio run
Processing esp8266 (framework: arduino; platform: espressif8266; board: d1_mini_lite)
--------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/d1_mini_lite.html
PLATFORM: Espressif 8266 (1.8.0) > WeMos D1 mini Lite
HARDWARE: ESP8266 80MHz, 80KB RAM, 1MB Flash
PACKAGES:
- framework-arduinoespressif8266 @ 2.20402.4 (2.4.2)
- tool-esptool @ 1.413.0 (4.13)
- toolchain-xtensa @ 1.40802.0 (4.8.2)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 28 compatible libraries
Scanning dependencies...
Dependency Graph
|-- Crypto @ 0.2.0
|-- PubSubClient @ 2.8.0
|-- ArduinoOTA @ 1.0
|-- ESP8266WiFi @ 1.0
|-- ESP8266mDNS
|-- SPI @ 1.0
Building in release mode
Compiling .pio/build/esp8266/src/WaterMeter.cpp.o
Compiling .pio/build/esp8266/src/main.cpp.o
Compiling .pio/build/esp8266/lib162/Crypto/AESCommon.cpp.o
Compiling .pio/build/esp8266/lib162/Crypto/AESEsp32.cpp.o
Compiling .pio/build/esp8266/lib162/Crypto/AuthenticatedCipher.cpp.o
Compiling .pio/build/esp8266/lib162/Crypto/BLAKE2b.cpp.o
Compiling .pio/build/esp8266/lib162/Crypto/BLAKE2s.cpp.o
In file included from src/WaterMeter.cpp:15:0:
include/WaterMeter.h:231:5: error: 'IRAM_ATTR' does not name a type
IRAM_ATTR static void cc1101Isr(void *p);
^
include/WaterMeter.h:252:5: error: 'IRAM_ATTR' does not name a type
IRAM_ATTR void instanceCC1101Isr();
^
src/WaterMeter.cpp:195:1: error: 'IRAM_ATTR' does not name a type
IRAM_ATTR void WaterMeter::instanceCC1101Isr()
^
src/WaterMeter.cpp:202:1: error: 'IRAM_ATTR' does not name a type
IRAM_ATTR void WaterMeter::cc1101Isr(void *p)
^
src/WaterMeter.cpp: In member function 'void WaterMeter::loop()':
src/WaterMeter.cpp:223:60: error: 'cc1101Isr' was not declared in this scope
attachInterruptArg(digitalPinToInterrupt(CC1101_GDO0), cc1101Isr, this, FALLING);
^
src/WaterMeter.cpp:223:84: error: 'attachInterruptArg' was not declared in this scope
attachInterruptArg(digitalPinToInterrupt(CC1101_GDO0), cc1101Isr, this, FALLING);
^
src/WaterMeter.cpp: In member function 'void WaterMeter::begin(uint8_t*, uint8_t*)':
src/WaterMeter.cpp:246:58: error: 'cc1101Isr' was not declared in this scope
attachInterruptArg(digitalPinToInterrupt(CC1101_GDO0), cc1101Isr, this, FALLING);
^
src/WaterMeter.cpp:246:82: error: 'attachInterruptArg' was not declared in this scope
attachInterruptArg(digitalPinToInterrupt(CC1101_GDO0), cc1101Isr, this, FALLING);
^
*** [.pio/build/esp8266/src/WaterMeter.cpp.o] Error 1
In file included from src/main.cpp:24:0:
include/WaterMeter.h:231:5: error: 'IRAM_ATTR' does not name a type
IRAM_ATTR static void cc1101Isr(void *p);
^
include/WaterMeter.h:252:5: error: 'IRAM_ATTR' does not name a type
IRAM_ATTR void instanceCC1101Isr();
^
src/main.cpp: In function 'bool ConnectWifi()':
src/main.cpp:93:8: error: 'class ESP8266WiFiClass' has no member named 'setHostname'
WiFi.setHostname(ESP_NAME);
^
*** [.pio/build/esp8266/src/main.cpp.o] Error 1
============================================ [FAILED] Took 1.18 seconds ============================================
Environment Status Duration
------------- -------- ------------
esp8266 FAILED 00:00:01.182
====================================== 1 failed, 0 succeeded in 00:00:01.182 ======================================
So I realized I was maybe building for the wrong board (board: d1_mini_lite), and found that I should specify the board ("-e nodemcuv2"), and did, but got no further:
host:~/gitwork/esp-multical21(master)$ platformio lib -e nodemcuv2 install knolleary/PubSubClient
host:~/gitwork/esp-multical21(master)$ platformio lib -e nodemcuv2 install rweather/Crypto
host:~/gitwork/esp-multical21(master)$ pio check -e nodemcuv2
...
Environment Tool Status Duration
------------- -------- -------- ------------
nodemcuv2 cppcheck PASSED 00:00:44.278
...
host:~/gitwork/esp-multical21(master)$ pio project config
Computed project configuration for /home/martin/gitwork/esp-multical21
platformio
----------
default_envs = esp8266
env:esp32
---------
framework = arduino
platform = espressif32
board = az-delivery-devkit-v4
board_build.mcu = esp32
lib_deps = rweather/Crypto@^0.4.0
knolleary/PubSubClient@^2.8.0
env:esp8266
-----------
framework = arduino
platform = espressif8266
board = d1_mini_lite
board_build.mcu = esp8266
lib_deps = rweather/Crypto@^0.2.0
knolleary/PubSubClient@^2.8.0
monitor_speed = 115200
env:nodemcuv2
-------------
platform = espressif8266
board = nodemcuv2
framework = arduino
lib_deps = knolleary/PubSubClient@^2.8.0
rweather/Crypto@^0.4.0
host:~/gitwork/esp-multical21(master)$ pio run -e nodemcuv2
Processing nodemcuv2 (platform: espressif8266; board: nodemcuv2; framework: arduino)
--------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/nodemcuv2.html
PLATFORM: Espressif 8266 (1.8.0) > NodeMCU 1.0 (ESP-12E Module)
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
PACKAGES:
- framework-arduinoespressif8266 @ 2.20402.4 (2.4.2)
- tool-esptool @ 1.413.0 (4.13)
- toolchain-xtensa @ 1.40802.0 (4.8.2)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 28 compatible libraries
Scanning dependencies...
Dependency Graph
|-- Crypto @ 0.4.0
|-- PubSubClient @ 2.8.0
|-- ArduinoOTA @ 1.0
|-- ESP8266WiFi @ 1.0
|-- ESP8266mDNS
|-- SPI @ 1.0
Building in release mode
Compiling .pio/build/nodemcuv2/src/WaterMeter.cpp.o
Compiling .pio/build/nodemcuv2/src/main.cpp.o
Compiling .pio/build/nodemcuv2/src/utils.cpp.o
Generating LD script .pio/build/nodemcuv2/ld/eagle.app.v6.common.ld
Compiling .pio/build/nodemcuv2/lib82e/Crypto/AES128.cpp.o
Compiling .pio/build/nodemcuv2/lib82e/Crypto/AES192.cpp.o
Compiling .pio/build/nodemcuv2/lib82e/Crypto/AES256.cpp.o
In file included from src/WaterMeter.cpp:15:0:
include/WaterMeter.h:231:5: error: 'IRAM_ATTR' does not name a type
IRAM_ATTR static void cc1101Isr(void *p);
^
include/WaterMeter.h:252:5: error: 'IRAM_ATTR' does not name a type
IRAM_ATTR void instanceCC1101Isr();
^
src/WaterMeter.cpp:195:1: error: 'IRAM_ATTR' does not name a type
IRAM_ATTR void WaterMeter::instanceCC1101Isr()
^
src/WaterMeter.cpp:202:1: error: 'IRAM_ATTR' does not name a type
IRAM_ATTR void WaterMeter::cc1101Isr(void *p)
^
src/WaterMeter.cpp: In member function 'void WaterMeter::loop()':
src/WaterMeter.cpp:223:60: error: 'cc1101Isr' was not declared in this scope
attachInterruptArg(digitalPinToInterrupt(CC1101_GDO0), cc1101Isr, this, FALLING);
^
src/WaterMeter.cpp:223:84: error: 'attachInterruptArg' was not declared in this scope
attachInterruptArg(digitalPinToInterrupt(CC1101_GDO0), cc1101Isr, this, FALLING);
^
src/WaterMeter.cpp: In member function 'void WaterMeter::begin(uint8_t*, uint8_t*)':
src/WaterMeter.cpp:246:58: error: 'cc1101Isr' was not declared in this scope
attachInterruptArg(digitalPinToInterrupt(CC1101_GDO0), cc1101Isr, this, FALLING);
^
src/WaterMeter.cpp:246:82: error: 'attachInterruptArg' was not declared in this scope
attachInterruptArg(digitalPinToInterrupt(CC1101_GDO0), cc1101Isr, this, FALLING);
^
*** [.pio/build/nodemcuv2/src/WaterMeter.cpp.o] Error 1
In file included from src/main.cpp:24:0:
include/WaterMeter.h:231:5: error: 'IRAM_ATTR' does not name a type
IRAM_ATTR static void cc1101Isr(void *p);
^
include/WaterMeter.h:252:5: error: 'IRAM_ATTR' does not name a type
IRAM_ATTR void instanceCC1101Isr();
^
src/main.cpp: In function 'bool ConnectWifi()':
src/main.cpp:93:8: error: 'class ESP8266WiFiClass' has no member named 'setHostname'
WiFi.setHostname(ESP_NAME);
^
*** [.pio/build/nodemcuv2/src/main.cpp.o] Error 1
============================================ [FAILED] Took 1.29 seconds ============================================
Environment Status Duration
------------- -------- ------------
nodemcuv2 FAILED 00:00:01.288
====================================== 1 failed, 0 succeeded in 00:00:01.288 ======================================
Can someone help me out here? Would be much appreciated!
Solved: I think I for some reason had an outdated version of some library, as I found similar report here and here. Using VSCode, PlatformIO IDE and updating libraries there prior to building fixed the problem.
First off - thank you for sharing this. I have finally gotten around and wired together my CC1101 with a NodeMCU (ESP8266 I think it is the ESP-12E).
I have managed to decrypt my Multical 21 key, and updated config.h with my wifi credentials and the serial and key for the multical.
It is the first time I use platformio, and although "pio check" succeeds, it fails when I run "pio run" to build the project:
So I realized I was maybe building for the wrong board (board: d1_mini_lite), and found that I should specify the board ("-e nodemcuv2"), and did, but got no further:
Can someone help me out here? Would be much appreciated!