Skip to content

Commit

Permalink
Add version check for lutest to only to 64-bit when 5.4 or greater
Browse files Browse the repository at this point in the history
  • Loading branch information
mdblack98 committed Dec 6, 2020
1 parent 1b2236b commit 3038921
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions bindings/luatest.lua
Expand Up @@ -5,6 +5,16 @@ Hamlib = require("Hamliblua")
-- you can see the Hamlib properties:
-- for key,value in pairs(Hamlib) do print(key,value) end

function version()
ver = string.sub(_VERSION,4)
-- should only get one match to this
for ver2 in string.gmatch(ver,"%d.%d") do
ver = tonumber(ver2)
end
return ver
end


function doStartup()
print(string.format("%s test, %s\n", _VERSION, Hamlib.hamlib_version))

Expand Down Expand Up @@ -107,9 +117,13 @@ function doStartup()

if sw2 > 0 then D = 'S' else D = 'N' end
print(string.format("Latitude:\t%4.4f, %4.0f° %.0f' %2.0f\" %1s\trecoded: %9.4f", lat1, deg2, mins2, sec2, D, lat3))
print(string.format("The next two lines should show 0x8000000000000000"));
print(string.format("RIG_MODE_TESTS_MAX: 0x%08x", Hamlib.RIG_MODE_TESTS_MAX));
print(string.format("RIG_FUNC_BIT63: 0x%08x", Hamlib.RIG_FUNC_BIT63));
if (version() >= 5.4) then
-- older version may not handle 64-bit values
-- not sure when this was fixed...might have been 5.3 somehwere
print(string.format("The next two lines should show 0x8000000000000000"));
print(string.format("RIG_MODE_TESTS_MAX: 0x%08x", Hamlib.RIG_MODE_TESTS_MAX));
print(string.format("RIG_FUNC_BIT63: 0x%08x", Hamlib.RIG_FUNC_BIT63));
end

end

Expand Down

0 comments on commit 3038921

Please sign in to comment.