Skip to content

Commit a2fb585

Browse files
wb2oszbjpetit
authored andcommitted
More config file checking.
1 parent e5b56c5 commit a2fb585

File tree

1 file changed

+44
-17
lines changed

1 file changed

+44
-17
lines changed

Diff for: src/config.c

+44-17
Original file line numberDiff line numberDiff line change
@@ -2165,6 +2165,9 @@ void config_init (char *fname, struct audio_s *p_audio_config,
21652165

21662166
/*
21672167
* DWAIT n - Extra delay for receiver squelch. n = 10 mS units.
2168+
*
2169+
* Why did I do this? Just add more to TXDELAY.
2170+
* Now undocumented in User Guide. Might disappear someday.
21682171
*/
21692172

21702173
else if (strcasecmp(t, "DWAIT") == 0) {
@@ -2200,14 +2203,20 @@ void config_init (char *fname, struct audio_s *p_audio_config,
22002203
continue;
22012204
}
22022205
n = atoi(t);
2203-
if (n >= 0 && n <= 255) {
2206+
if (n >= 5 && n < 50) {
2207+
// 0 = User has no clue. This would be no delay.
2208+
// 10 = Default.
2209+
// 50 = Half second. User might think it is mSec and use 100.
22042210
p_audio_config->achan[channel].slottime = n;
22052211
}
22062212
else {
22072213
p_audio_config->achan[channel].slottime = DEFAULT_SLOTTIME;
22082214
text_color_set(DW_COLOR_ERROR);
2209-
dw_printf ("Line %d: Invalid delay time for persist algorithm. Using default %d.\n",
2215+
dw_printf ("Line %d: Invalid delay time for persist algorithm. Using default %d.\n",
22102216
line, p_audio_config->achan[channel].slottime);
2217+
dw_printf ("Read the Dire Wolf User Guide, \"Radio Channel - Transmit Timing\"\n");
2218+
dw_printf ("section, to understand what this means.\n");
2219+
dw_printf ("Why don't you just use the default?\n");
22112220
}
22122221
}
22132222

@@ -2224,14 +2233,17 @@ void config_init (char *fname, struct audio_s *p_audio_config,
22242233
continue;
22252234
}
22262235
n = atoi(t);
2227-
if (n >= 0 && n <= 255) {
2236+
if (n >= 5 && n <= 250) {
22282237
p_audio_config->achan[channel].persist = n;
22292238
}
22302239
else {
22312240
p_audio_config->achan[channel].persist = DEFAULT_PERSIST;
22322241
text_color_set(DW_COLOR_ERROR);
2233-
dw_printf ("Line %d: Invalid probability for persist algorithm. Using default %d.\n",
2242+
dw_printf ("Line %d: Invalid probability for persist algorithm. Using default %d.\n",
22342243
line, p_audio_config->achan[channel].persist);
2244+
dw_printf ("Read the Dire Wolf User Guide, \"Radio Channel - Transmit Timing\"\n");
2245+
dw_printf ("section, to understand what this means.\n");
2246+
dw_printf ("Why don't you just use the default?\n");
22352247
}
22362248
}
22372249

@@ -2250,17 +2262,21 @@ void config_init (char *fname, struct audio_s *p_audio_config,
22502262
n = atoi(t);
22512263
if (n >= 0 && n <= 255) {
22522264
text_color_set(DW_COLOR_ERROR);
2253-
if (n == 0) {
2254-
dw_printf ("Line %d: Setting TXDELAY to 0 is a REALLY BAD idea if you want other stations to hear you.\n",
2255-
line);
2256-
dw_printf ("Line %d: See User Guide, \"Radio Channel - Transmit Timing\" for an explanation.\n",
2265+
if (n < 10) {
2266+
dw_printf ("Line %d: Setting TXDELAY this small is a REALLY BAD idea if you want other stations to hear you.\n",
22572267
line);
2268+
dw_printf ("Read the Dire Wolf User Guide, \"Radio Channel - Transmit Timing\"\n");
2269+
dw_printf ("section, to understand what this means.\n");
2270+
dw_printf ("Why don't you just use the default rather than reducing reliability?\n");
22582271
}
2259-
if (n >= 100) {
2272+
else if (n >= 100) {
22602273
dw_printf ("Line %d: Keeping with tradition, going back to the 1980s, TXDELAY is in 10 millisecond units.\n",
22612274
line);
22622275
dw_printf ("Line %d: The value %d would be %.3f seconds which seems rather excessive. Are you sure you want that?\n",
22632276
line, n, (double)n * 10. / 1000.);
2277+
dw_printf ("Read the Dire Wolf User Guide, \"Radio Channel - Transmit Timing\"\n");
2278+
dw_printf ("section, to understand what this means.\n");
2279+
dw_printf ("Why don't you just use the default?\n");
22642280
}
22652281
p_audio_config->achan[channel].txdelay = n;
22662282
}
@@ -2286,24 +2302,28 @@ void config_init (char *fname, struct audio_s *p_audio_config,
22862302
}
22872303
n = atoi(t);
22882304
if (n >= 0 && n <= 255) {
2289-
if (n == 0) {
2290-
dw_printf ("Line %d: Setting TXTAIL to 0 is a REALLY BAD idea if you want other stations to hear you.\n",
2291-
line);
2292-
dw_printf ("Line %d: See User Guide, \"Radio Channel - Transmit Timing\" for an explanation.\n",
2305+
if (n < 5) {
2306+
dw_printf ("Line %d: Setting TXTAIL that small is a REALLY BAD idea if you want other stations to hear you.\n",
22932307
line);
2308+
dw_printf ("Read the Dire Wolf User Guide, \"Radio Channel - Transmit Timing\"\n");
2309+
dw_printf ("section, to understand what this means.\n");
2310+
dw_printf ("Why don't you just use the default rather than reducing reliability?\n");
22942311
}
2295-
if (n >= 50) {
2312+
else if (n >= 50) {
22962313
dw_printf ("Line %d: Keeping with tradition, going back to the 1980s, TXTAIL is in 10 millisecond units.\n",
22972314
line);
22982315
dw_printf ("Line %d: The value %d would be %.3f seconds which seems rather excessive. Are you sure you want that?\n",
22992316
line, n, (double)n * 10. / 1000.);
2317+
dw_printf ("Read the Dire Wolf User Guide, \"Radio Channel - Transmit Timing\"\n");
2318+
dw_printf ("section, to understand what this means.\n");
2319+
dw_printf ("Why don't you just use the default?\n");
23002320
}
23012321
p_audio_config->achan[channel].txtail = n;
23022322
}
23032323
else {
23042324
p_audio_config->achan[channel].txtail = DEFAULT_TXTAIL;
23052325
text_color_set(DW_COLOR_ERROR);
2306-
dw_printf ("Line %d: Invalid time for transmit timing. Using %d.\n",
2326+
dw_printf ("Line %d: Invalid time for transmit timing. Using %d.\n",
23072327
line, p_audio_config->achan[channel].txtail);
23082328
}
23092329
}
@@ -2852,7 +2872,7 @@ void config_init (char *fname, struct audio_s *p_audio_config,
28522872
dw_printf ("Config file: FILTER IG ... on line %d.\n", line);
28532873
dw_printf ("Warning! Don't mess with IS>RF filtering unless you are an expert and have an unusual situation.\n");
28542874
dw_printf ("Warning! The default is fine for nearly all situations.\n");
2855-
dw_printf ("Warning! Be sure to read carefully and understand Successful-APRS-Gateway-Operation.pdf .\n");
2875+
dw_printf ("Warning! Be sure to read carefully and understand \"Successful-APRS-Gateway-Operation.pdf\" .\n");
28562876
dw_printf ("Warning! If you insist, be sure to add \" | i/180 \" so you don't break messaging.\n");
28572877
}
28582878
else {
@@ -2892,7 +2912,7 @@ void config_init (char *fname, struct audio_s *p_audio_config,
28922912
dw_printf ("Warning! Don't mess with RF>IS filtering unless you are an expert and have an unusual situation.\n");
28932913
dw_printf ("Warning! Expected behavior is for everything to go from RF to IS.\n");
28942914
dw_printf ("Warning! The default is fine for nearly all situations.\n");
2895-
dw_printf ("Warning! Be sure to read carefully and understand Successful-APRS-Gateway-Operation.pdf .\n");
2915+
dw_printf ("Warning! Be sure to read carefully and understand \"Successful-APRS-Gateway-Operation.pdf\" .\n");
28962916
}
28972917
else {
28982918
to_chan = isdigit(*t) ? atoi(t) : -999;
@@ -4528,6 +4548,13 @@ void config_init (char *fname, struct audio_s *p_audio_config,
45284548

45294549
if (t != NULL && strlen(t) > 0) {
45304550
p_igate_config->t2_filter = strdup (t);
4551+
4552+
text_color_set(DW_COLOR_ERROR);
4553+
dw_printf ("Line %d: Warning - IGFILTER is a rarely needed expert level feature.\n", line);
4554+
dw_printf ("If you don't have a special situation and a good understanding of\n");
4555+
dw_printf ("how this works, you probably should not be messing with it.\n");
4556+
dw_printf ("The default behavior is appropriate for most situations.\n");
4557+
dw_printf ("Please read \"Successful-APRS-IGate-Operation.pdf\".\n");
45314558
}
45324559
}
45334560

0 commit comments

Comments
 (0)