Require that the JSON refresh interval is at least 1, as it is used
to control the webmap refresh rate even if JSON files are not being written.
This commit is contained in:
parent
dc92cfb927
commit
62ec7796d0
2
debian/changelog
vendored
2
debian/changelog
vendored
|
@ -13,6 +13,8 @@ dump1090-mutability (1.10.3010.14mu-11) UNRELEASED; urgency=medium
|
||||||
discard bad position results.
|
discard bad position results.
|
||||||
* Display message rate (30 sec average) on the webmap.
|
* Display message rate (30 sec average) on the webmap.
|
||||||
* Restart lighttpd on package upgrade if we changed its config files.
|
* Restart lighttpd on package upgrade if we changed its config files.
|
||||||
|
* Require that the JSON refresh interval is at least 1, as it is used
|
||||||
|
to control the webmap refresh rate even if JSON files are not being written.
|
||||||
|
|
||||||
-- Oliver Jowett <oliver@mutability.co.uk> Sun, 11 Jan 2015 11:53:48 +0000
|
-- Oliver Jowett <oliver@mutability.co.uk> Sun, 11 Jan 2015 11:53:48 +0000
|
||||||
|
|
||||||
|
|
11
debian/dump1090-mutability.config
vendored
11
debian/dump1090-mutability.config
vendored
|
@ -108,6 +108,10 @@ is_unsigned_int_or_empty() {
|
||||||
else return 1; fi
|
else return 1; fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
is_positive_int() {
|
||||||
|
if echo "$1" | grep -Eq '^(+?[1-9][0-9]*)$'; then return 0; else return 1; fi
|
||||||
|
}
|
||||||
|
|
||||||
is_signed_int() {
|
is_signed_int() {
|
||||||
if echo "$1" | grep -Eq '^(0|[+-]?[1-9][0-9]*)$'; then return 0; else return 1; fi
|
if echo "$1" | grep -Eq '^(0|[+-]?[1-9][0-9]*)$'; then return 0; else return 1; fi
|
||||||
}
|
}
|
||||||
|
@ -201,13 +205,10 @@ db_go || true; db_get $NAME/auto-start; if [ "$RET" = "true" ]; then
|
||||||
db_input_verify medium $NAME/net-bind-address is_ipaddrish_or_empty || true
|
db_input_verify medium $NAME/net-bind-address is_ipaddrish_or_empty || true
|
||||||
|
|
||||||
db_input_verify low $NAME/stats-interval is_unsigned_int || true
|
db_input_verify low $NAME/stats-interval is_unsigned_int || true
|
||||||
db_input_verify low $NAME/json-interval is_unsigned_int || true
|
|
||||||
|
|
||||||
db_go || true; db_get $NAME/json-interval; if [ -n "$RET" ] && [ "$RET" -gt 0 ]; then
|
db_input_verify low $NAME/json-interval is_positive_int || true
|
||||||
# only if json-interval was given and non-zero
|
|
||||||
db_input low $NAME/json-dir || true
|
|
||||||
db_input low $NAME/json-location-accuracy || true
|
db_input low $NAME/json-location-accuracy || true
|
||||||
fi
|
db_input low $NAME/json-dir || true
|
||||||
|
|
||||||
db_input low $NAME/log-decoded-messages || true
|
db_input low $NAME/log-decoded-messages || true
|
||||||
db_input low $NAME/extra-args || true
|
db_input low $NAME/extra-args || true
|
||||||
|
|
8
debian/dump1090-mutability.templates
vendored
8
debian/dump1090-mutability.templates
vendored
|
@ -235,6 +235,8 @@ Description: Directory to write JSON aircraft state to:
|
||||||
As this can be written frequently, you should select a location
|
As this can be written frequently, you should select a location
|
||||||
that is not on a sdcard. The default path under /run is on tmpfs
|
that is not on a sdcard. The default path under /run is on tmpfs
|
||||||
and will not write to the sdcard.
|
and will not write to the sdcard.
|
||||||
|
.
|
||||||
|
A blank path disables writing JSON state.
|
||||||
Type: string
|
Type: string
|
||||||
Default: /run/dump1090-mutability
|
Default: /run/dump1090-mutability
|
||||||
|
|
||||||
|
@ -246,8 +248,6 @@ Description: Interval between writing JSON aircraft state, in seconds:
|
||||||
.
|
.
|
||||||
Here you can control how often the JSON state is updated, which determines
|
Here you can control how often the JSON state is updated, which determines
|
||||||
how frequently the virtual radar view updates.
|
how frequently the virtual radar view updates.
|
||||||
.
|
|
||||||
A value of 0 will disable writing JSON state entirely.
|
|
||||||
Type: string
|
Type: string
|
||||||
Default: 1
|
Default: 1
|
||||||
|
|
||||||
|
@ -293,6 +293,10 @@ Template: dump1090-mutability/invalid-is_unsigned_int_or_empty
|
||||||
Description: Value must be an unsigned integer, or blank.
|
Description: Value must be an unsigned integer, or blank.
|
||||||
Type: error
|
Type: error
|
||||||
|
|
||||||
|
Template: dump1090-mutability/invalid-is_positive_int
|
||||||
|
Description: Value must be a positive integer.
|
||||||
|
Type: error
|
||||||
|
|
||||||
Template: dump1090-mutability/invalid-is_signed_int
|
Template: dump1090-mutability/invalid-is_signed_int
|
||||||
Description: Value must be an integer.
|
Description: Value must be an integer.
|
||||||
Type: error
|
Type: error
|
||||||
|
|
|
@ -667,7 +667,7 @@ void backgroundTasks(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Modes.json_aircraft_path && Modes.json_interval > 0) {
|
if (Modes.json_aircraft_path) {
|
||||||
time_t now = time(NULL);
|
time_t now = time(NULL);
|
||||||
if (now >= next_json) {
|
if (now >= next_json) {
|
||||||
writeJsonToFile(Modes.json_aircraft_path, generateAircraftJson);
|
writeJsonToFile(Modes.json_aircraft_path, generateAircraftJson);
|
||||||
|
@ -879,6 +879,8 @@ int main(int argc, char **argv) {
|
||||||
strcat(Modes.json_metadata_path, "/receiver.json");
|
strcat(Modes.json_metadata_path, "/receiver.json");
|
||||||
} else if (!strcmp(argv[j], "--write-json-every") && more) {
|
} else if (!strcmp(argv[j], "--write-json-every") && more) {
|
||||||
Modes.json_interval = atoi(argv[++j]);
|
Modes.json_interval = atoi(argv[++j]);
|
||||||
|
if (Modes.json_interval < 1)
|
||||||
|
Modes.json_interval = 1;
|
||||||
} else if (!strcmp(argv[j], "--json-location-accuracy") && more) {
|
} else if (!strcmp(argv[j], "--json-location-accuracy") && more) {
|
||||||
Modes.json_location_accuracy = atoi(argv[++j]);
|
Modes.json_location_accuracy = atoi(argv[++j]);
|
||||||
#endif
|
#endif
|
||||||
|
@ -932,7 +934,7 @@ int main(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
if (Modes.net) modesInitNet();
|
if (Modes.net) modesInitNet();
|
||||||
|
|
||||||
if (Modes.json_metadata_path && Modes.json_interval > 0) {
|
if (Modes.json_metadata_path) {
|
||||||
writeJsonToFile(Modes.json_metadata_path, generateReceiverJson); // once only on startup
|
writeJsonToFile(Modes.json_metadata_path, generateReceiverJson); // once only on startup
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue