Skip to content

Conversation

@df7cb
Copy link
Contributor

@df7cb df7cb commented Nov 18, 2025

When HAMLIB_KEYER is set, but rig control and keying is disabled via tlf -r, hitting ESC will trip the assert(init_called) in rig_has_stop_morse. Since init_tlf_rig is called early in main(), it seems unlikely that this assert would ever find an actual bug, so just remove it (along with the init_called variable).

@df7cb
Copy link
Contributor Author

df7cb commented Nov 18, 2025

Also, in the HAMLIB_KEYER + tlf -r case, there is an annoying 2s startup delay to inform the user about there being no keying. Since the user asked for it, what's the point of the message, couldn't we just drop it? (Or at least make the delay 1s like the other messages in that code block.)

tlf/src/main.c

Lines 952 to 956 in e3b7cb8

if (trx_control_disabled) {
showmsg("Radio control disabled - no keying!");
sleep(2);
return;
}

@df7cb df7cb changed the title Remove overzealous assert in rig_has_stop_morse() Fix problems when HAMLIB_KEYER is set, but rig control is disabled Nov 18, 2025
@df7cb
Copy link
Contributor Author

df7cb commented Nov 18, 2025

There were more problems (PgUp would crash tlf), so I updated the PR and also included the 2s->1s change I proposed in the 2nd comment above.

@zcsahok
Copy link
Member

zcsahok commented Nov 24, 2025

I believe the reason behind that "Radio control disabled - no keying" message is that with other keying modes (net, serial) it's still possible to use TLF with somewhat reduced functionality, but still with normal keying. For hamlib keying it is not the case hence the user is warned not to expect it.

@dl1jbe
Copy link
Member

dl1jbe commented Nov 24, 2025

When HAMLIB_KEYER is set, but rig control and keying is disabled via tlf -r, hitting ESC will trip the assert(init_called) in rig_has_stop_morse. Since init_tlf_rig is called early in main(), it seems unlikely that this assert would ever find an actual bug, so just remove it (along with the init_called variable).

I see it the other way round: The assert() should make sure we used the functions correctly - calling rig_has_stop_morse () and rig_stop_morse() only after we make sure that it is supported (via init_tlf_rig() ).
And it showed that we used it incorrect.

The fix should be to call that function only it rig control is enabled in hamlib_keyer_stop(). I think the same goes for hamlib_keyer_send() .
Looks like is partly implemented already in your PR.

@dl1jbe
Copy link
Member

dl1jbe commented Nov 24, 2025

I believe the reason behind that "Radio control disabled - no keying" message is that with other keying modes (net, serial) it's still possible to use TLF with somewhat reduced functionality, but still with normal keying. For hamlib keying it is not the case hence the user is warned not to expect it.

Yes, it was the intention to tell the user about an possible configuration error - requiring HAMLIB_KEYER but disabling rig control.

Copy link
Member

@dl1jbe dl1jbe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed please keep the content of sendqrg.c

@df7cb
Copy link
Contributor Author

df7cb commented Nov 24, 2025

sendqrg.c was the first bit I changed, and only later added the if(trx_control) protection to the functions. I had not realized that the 2nd change actually made the 1st redundant. Thanks for spotting!

Updated patch pushed.

When HAMLIB_KEYER is set, but rig control and keying is disabled via
`tlf -r`, hitting ESC will trip the assert(init_called) in
rig_has_stop_morse.

Protect the hamlib_keyer_* functions against being called in that mode.

In passing, decrease the timeout after showing the "keying disabled"
message to 1s.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants