Comments (10)
Seems like the CI does not have any issues compiling with ESP-IDF: https://github.com/jgromes/RadioLib/actions/runs/8621766528/job/23631387349
Can you try with the unedited ESP-IDF example? Also, how are you building it? The CI just calls idf.py build
, are you doing anything else?
from radiolib.
Yes I'm just runningidf.py build
. The example compiles without error.
from radiolib.
The example compiles without error.
That would suggest an issue in your code rather than in the library itself.
The only two significant differences I see in your code is that your HAL instance is auto-typed (why? it can never be anything other than EspHal
) and that both your HAL and radio instances are local to app_main
, so I'm wondering if the C linkage declared by extern "C"
is causing any issues. Can you try to move both of these into the global scope?
from radiolib.
I'll try, but this:
#include <cstdio>
#include <string_view>
#include <RadioLib.h>
#include "EspHal.h"
using namespace std::literals::string_view_literals;
constexpr auto TAG = "MAIN"sv;
extern "C" void app_main(void)
{
auto hal = new EspHal(5, 19, 27);
SX1276 radio = new Module(hal, 18, 26, 14, 33);
ESP_LOGI(TAG.data(), "[SX1276] Initializing ... ");
int state = radio.begin();
if (state != RADIOLIB_ERR_NONE) {
ESP_LOGI(TAG.data(), "failed, code %d\n", state);
while(true) {
hal->delay(1000);
}
}
ESP_LOGI(TAG.data(), "success!\n");
// loop forever
for(;;) {
// send a packet
ESP_LOGI(TAG.data(), "[SX1276] Transmitting packet ... ");
state = radio.transmit("Hello World!");
if(state == RADIOLIB_ERR_NONE) {
// the packet was successfully transmitted
ESP_LOGI(TAG.data(), "success!");
} else {
ESP_LOGI(TAG.data(), "failed, code %d\n", state);
}
// wait for a second before transmitting again
hal->delay(1000);
}
}
also compiles, so I find it unlikely this is the issue.
from radiolib.
Just tried
#include <cstdio>
#include <array>
#include <chrono>
#include <string_view>
#include <thread>
#include <RadioLib.h>
#include "EspHal.h"
using namespace std::chrono_literals;
using namespace std::literals::string_view_literals;
constexpr auto TAG = "MAIN"sv;
EspHal* hal = new EspHal(5, 19, 27);
SX1276 radio = new Module(hal, 18, 26, 14, 33);
extern "C" void app_main(void)
{
ESP_LOGI(TAG.data(), "[SX1276] Initializing ... ");
int state = radio.begin();
if (state != RADIOLIB_ERR_NONE) {
ESP_LOGI(TAG.data(), "failed, code %d\n", state);
while(true) {
hal->delay(1000);
}
}
ESP_LOGI(TAG.data(), "success!\n");
while (true) {
auto buffer = std::array<std::byte, 50>{};
auto state = radio.receive((uint8_t*) buffer.data(), buffer.size());
if (state == RADIOLIB_ERR_NONE) {
std::printf("%s\n", (char*) buffer.data());
} else {
ESP_LOGI(TAG.data(), "failed, code %d\n", state);
}
std::this_thread::sleep_for(10s);
}
}
Same error.
from radiolib.
Ah, I missed the most crucial difference, which is that receive
is being called. I actually had to diff
the two files you showed to find out what was the difference among all those strange indentations ...
With that I am able to replicate the issue, but only in the latest ESP-IDF (5.2.1). The problem is that the virtual getRSSI
has no arguments in PhysicalLayer
, but the only implementation available in SX1272
and SX1278
classes has arguments with default values, which I guess is a warning in new versions of GCC/G++ that ESP-IDF automatically throws an error over due to its -Werror
flag.
Fixed in the above-linked commit, thanks for reporting!
from radiolib.
Hi Thank you for posting this., I am also using ESP-IDF. I think the same overload error is also occurring in the sleep function.
./../protocols/PhysicalLayer/PhysicalLayer.h:117:21: error: 'virtual int16_t PhysicalLayer::sleep()' was hidden [-Werror=overloaded-virtual=]
117 | virtual int16_t sleep();
I applied similar fixes to what you did in the commit and it fixes it, I've forked it for now,
I love RadioLib, thank you - you've saved me so much time.
from radiolib.
@illysky it would be great if you could submit a PR for that ;)
Though what confuses me the most is that the ESP-IDF CI is not able to catch these errors. I'm guessing it's because the methods are not being called from the example that's being compiled ... but then again the entire library is being compiled, so it'S a bit weird.
from radiolib.
Of course. I will try to PR after Ive done my EspHal.
So I guess an overload is a warning? And I am getting errors because of -Werror flag is set, which is good. But perhaps their CI doesn't have -Werror enabled and warnings get through in CI. Maybe
from radiolib.
@illysky thank you! The CI is in this repository, here's is an example of the latest run: https://github.com/jgromes/RadioLib/actions/runs/8960526520/job/24607133566
It has default configuration and produces (as far as I can tell) no warnings. Furthermore RPi builds have -Wall
and -Wextra
and likewise produce no warnings.
from radiolib.
Related Issues (20)
- Feature request: AX.25 parser HOT 4
- Think I introduced a bug with Promiscuous (requireCarrierSense) when used with directMode HOT 2
- Move Raspberry Pi example to another GPIO library HOT 11
- Better error handling in the HAL HOT 3
- CC1101 Direct Mode getRSSI() only ever returns -74.0 HOT 2
- importing Radiolib into VSCODE + Platformio with NRF52840 board does not compile HOT 13
- SX1280 startTransmit after CAD not working HOT 4
- Move examples to a separate repository HOT 14
- Invalid calibrateImage parameters prevent initializing with 915MHz frequency on SX126x-based STM32WLx HOT 2
- #include <Radiolib/SX1262.h> is available to use less space than the hole library? HOT 1
- Minor issue in startReceiveDutyCycleAuto HOT 3
- GFSK support for SX1231/RFM69 and SX127x/RFM9x HOT 2
- Support for MSPM0 Microcontroller HOT 1
- STM8 Arduino HOT 2
- This line cause errors when build HOT 1
- AFSK not working on LILYGO T3_V1.6.1 HOT 2
- Examples not running on seed studio XIAO esp32C3 HOT 6
- Extra bits after the message using RFM69HCW module on feather 32u4 HOT 5
- RadioLib not compile for Arduino Nano ESP32 HOT 3
- RSSI bug in PhysicalLayer? also getFrequencyError() seems missing HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from radiolib.