hzeller / txtempus

A DCF77, WWVB, JJY and MSF clock LF-band signal transmitter using the Raspberry Pi
GNU General Public License v3.0
441 stars 71 forks source link

update for the recent JetsonGPIO API changes #25

Closed pjueon closed 2 years ago

pjueon commented 2 years ago

In the latest version of JetsonGPIO, GPIO::model is not a variable but a function

pjueon commented 2 years ago

I found a better solution. With the latest version of JetsonGPIO, this PR is not needed any more. Close this PR.

hzeller commented 2 years ago

Is there maybe something we need to #ifdef for older and newer versions or is this not needed ?

pjueon commented 2 years ago

It is possible, but I think you don't have to.

There are 3 variations of JetsonGPIO library.

  1. Old one GPIO::model is a global variable and its type is std::string. You should use GPIO::model as a variable.

  2. Temporary one (The one for this PR) GPIO::model is a function that returns std::string object. You should use GPIO::model as a function. This one was not an officially released version. This one was created about a week ago.

  3. The latest one GPIO::model is a global variable and its type is GPIO::LazyString which is a proxy type for std::string. You can use GPIO::model either as a variable or a function.

So each variation doesn't have compatibility for others at the binary level, but 3 (which is the latest one) has compatibility for 1 and 2 at the code level.

The current source code of the txtempus can be built with 1 and 3. With this PR, it can be built with 2 and 3.

It is possible to make txtempus buildable with all variations of JetsonGPIO (not by #ifdef but by template). But I think you don't have to change the txtempus just for the version that was not officially released.