timmbogner / Farm-Data-Relay-System

A system that uses ESP-NOW, LoRa, and other protocols to transport sensor data in remote areas without relying on WiFi.
MIT License
485 stars 108 forks source link

Upgrade to RadioLib 6.0.0 #168

Closed Stips5 closed 1 year ago

Stips5 commented 1 year ago

Hi

I found issue when using RadioLib 6.0.0 which is latest lib version

`//Farm-Data-Relay-System/src/fdrs_gateway_lora.h: In function 'void begin_lora()':
/Arduino/libraries/Farm-Data-Relay-System/src/fdrs_gateway_lora.h:293:30: error: no matching function for call to 'SX1278::setDio0Action(void (&)())'
   radio.setDio0Action(setFlag);
                              ^
In file included from /Arduino/libraries/RadioLib/src/modules/RFM9x/RFM95.h:9:0,
                 from /Arduino/libraries/RadioLib/src/RadioLib.h:77,
                 from /Arduino/libraries/Farm-Data-Relay-System/src/fdrs_gateway_lora.h:1,
                 from /Arduino/libraries/Farm-Data-Relay-System/src/fdrs_gateway.h:76,
                 from /.git/MedjuglaviceAtPalm/RemoteGateway/RemoteGateway.ino:9:
Arduino/libraries/RadioLib/src/modules/RFM9x/../SX127x/SX127x.h:700:10: note: candidate: void SX127x::setDio0Action(void (*)(), uint32_t)
     void setDio0Action(void (*func)(void), uint32_t dir);
          ^
Arduino/libraries/RadioLib/src/modules/RFM9x/../SX127x/SX127x.h:700:10: note:   candidate expects 2 arguments, 1 provided

exit status 1`

when using 5.7.0 everything works just fine. So project should be updated or restriction to use 5.7.0 specified in readme.

timmbogner commented 1 year ago

Thanks! I just saw the RadioLib release notes about this yesterday, and fixing it is on my big board of things to do. It's kind of urgent, so I'm going to have to get into it this tomorrow along with a whole backlog of code updates.

timmbogner commented 1 year ago

Here's the release with info about the changes. The first point is easily fixed by adding RISING to the interrupt setting function.

Signature of all methods/functions that use pin numbers (e.g. the Module constructor) changed from platform-dependent "pin type" changed to a common type (uint32_t)

@aviateur17 Could you maybe help explain what this second point means? If I'm understanding right, it's not an issue unless we're working with a pin value that was returned by RadioLib or assigning a pin based using a variable (which we never do).

timmbogner commented 1 year ago

I added the extra parameter in a commit last night, so I think everything should work okay now. I'm going to leave this open until I'm a bit more confident about the other RL changes.

It also still works with RL v5.7, which is a relief to me.

PerRieland commented 1 year ago

Issue still exist when using

define RADIOLIB_MODULE SX1262

define USE_SX126X

I'm not sure how to fix that. Compiler output: c:\users\xxx\documents\arduino\libraries\radiolib\src\modules\sx126x\SX126x.h:568:10: note: candidate: 'virtual void SX126x::setDio1Action(void ()())' void setDio1Action(void (func)(void)); ^~~~~ c:\users\xxx\documents\arduino\libraries\radiolib\src\modules\sx126x\SX126x.h:568:10: note: candidate expects 1 argument, 2 provided exit status 1 Compilation error: exit status 1

timmbogner commented 1 year ago

Very good point. It looks like the new thing is only applicable to SX127x. I've now reversed the change for that chip.

aviateur17 commented 1 year ago

@aviateur17 Could you maybe help explain what this second point means? If I'm understanding right, it's not an issue unless we're working with a pin value that was returned by RadioLib or assigning a pin based using a variable (which we never do).

Looking at the commit (https://github.com/jgromes/RadioLib/commit/9a68a3c9012e1ffe5dc94cb4d116cbe71ad3d3ea) all they really do is change uint8_t to uint32_t so the only thing would be to check our types to make sure they are uint32_t otherwise there may be a compiler warning. I don't see a need to adjust any pin names or values just because of this change.

PerRieland commented 1 year ago

Very good point. It looks like the new thing is only applicable to SX127x. I've now reversed the change for that chip.

And it works ;)