Git Product home page Git Product logo

Comments (10)

jgromes avatar jgromes commented on July 27, 2024

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.

KjartanOli avatar KjartanOli commented on July 27, 2024

Yes I'm just runningidf.py build. The example compiles without error.

from radiolib.

jgromes avatar jgromes commented on July 27, 2024

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.

KjartanOli avatar KjartanOli commented on July 27, 2024

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.

KjartanOli avatar KjartanOli commented on July 27, 2024

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.

jgromes avatar jgromes commented on July 27, 2024

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.

illysky avatar illysky commented on July 27, 2024

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.

jgromes avatar jgromes commented on July 27, 2024

@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.

illysky avatar illysky commented on July 27, 2024

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.

jgromes avatar jgromes commented on July 27, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.