Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add keyword to start tlf in s&p mode #396

Merged
merged 11 commits into from
Aug 1, 2023
2 changes: 1 addition & 1 deletion ToDo
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Planned for later versions
list of most used RST values which will then be used for scrolling,
e.g. CHANGE_RST=339,479,599 or similar.
[x] Have a template for cabrillo file header (suggested by Joop PG4I)
[ ] Add a keyword to startup TLF in S&P mode (should be an easy one)
[x] Add a keyword to startup TLF in S&P mode (should be an easy one)
[ ] switch between ESM and CT mode during contest (Nate N0NB)
[x] Send Morse via Hamlib for radios that support it.
Tnx Christoph DF7CB and others.
Expand Down
9 changes: 9 additions & 0 deletions share/logcfg.dat
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ CALL=NOCALL
#
#################################
# #
# OPERATING MODE #
# #
#################################
# Can be set to CQ, S&P
OPERATING_MODE=CQ
#
#
#################################
# #
# Time offset from UTC #
# #
#################################
Expand Down
4 changes: 2 additions & 2 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ int cluster = NOCLUSTER; /* 0 = OFF, 1 = FOLLOW, 2 = spots 3 = all */
bool clusterlog = false; /* clusterlog on/off */
bool searchflg = false; /* display search window */
bool show_time = false;
cqmode_t cqmode = CQ;
cqmode_t cqmode; /* can be CQ or S&P */
bool demode = false; /* send DE before s&p call */

int announcefilter = FILTER_ANN; /* filter cluster announcements */
Expand Down Expand Up @@ -636,7 +636,7 @@ static void init_variables() {
tune_seconds = 6; /* tune up for 6 s */
unique_call_multi = MULT_NONE;
generic_mult = MULT_NONE;

cqmode = CQ;
leading_zeros_serial = true;
ctcomp = false;
resend_call = RESEND_NOT_SET;
Expand Down
20 changes: 20 additions & 0 deletions src/parse_logcfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
#include "startmsg.h"
#include "tlf_curses.h"
#include "searchlog.h"
#include "tlf.h"

bool exist_in_country_list();

Expand Down Expand Up @@ -415,6 +416,24 @@ static int cfg_contest(const cfg_arg_t arg) {
return PARSE_OK;
}

static int cfg_operating_mode(const cfg_arg_t arg) {
char *str = g_ascii_strup(parameter, -1);
g_strstrip(str);

if (strcmp(str, "CQ") == 0) {
cqmode = CQ;
} else if (strcmp(str, "S&P") == 0) {
cqmode = S_P;
} else {
g_free(str);
error_details = g_strdup("must be CQ or S&P");
return PARSE_WRONG_PARAMETER;
}

g_free(str);
return PARSE_OK;
}

static int cfg_bandoutput(const cfg_arg_t arg) {
char *str = g_strdup(parameter);
g_strstrip(str);
Expand Down Expand Up @@ -1370,6 +1389,7 @@ static config_t logcfg_configs[] = {
{"CABRILLO-(.+)", OPTIONAL_PARAM, cfg_cabrillo_field},
{"RESEND_CALL", NEED_PARAM, cfg_resend_call},
{"GENERIC_MULT", NEED_PARAM, cfg_generic_mult},
{"OPERATING_MODE", NEED_PARAM, cfg_operating_mode},

{NULL} // end marker
};
Expand Down
7 changes: 7 additions & 0 deletions test/test_parse_logcfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ int setup_default(void **state) {
exclude_multilist_type = EXCLUDE_NONE;
rigptt = 0;
minitest = 0;
cqmode = CQ;

setcontest(QSO_MODE);

Expand Down Expand Up @@ -916,6 +917,12 @@ void test_ssbmode(void **state) {
assert_int_equal(trxmode, SSBMODE);
}

void test_operating_mode(void **state) {
int rc = call_parse_logcfg("OPERATING_MODE=S&P\n");
assert_int_equal(rc, 0);
assert_int_equal(cqmode, S_P);
}

// TLFCOLOR1..6
void test_tlfcolorn(void **state) {
char line[80];
Expand Down
5 changes: 5 additions & 0 deletions tlf.1.in
Original file line number Diff line number Diff line change
Expand Up @@ -1656,6 +1656,11 @@ The station callsign used in messages; also used to determine the station's
country, zone and continent.
.
.TP
\fBOPERATING_MODE\fR=\fICQ\fR|\fIS&P\fR
Set operating mode for start up. Use \fICQ\fR for "run" and \fIS&P\fR for "search and pounce".
The default mode is \fICQ\fR.
.
.TP
\fBTIME_OFFSET\fR=\fI0\fR
Used to shift the @PACKAGE_NAME@ time with respect to the computer clock.
.
Expand Down