kopia lustrzana https://github.com/projecthorus/horusdemodlib
Added v2 sample and test, removed assert for rtty decoder, added option to use local lists for uploader
rodzic
e3ee7d4ae4
commit
b1908f7cc7
|
@ -59,6 +59,13 @@ enable_testing()
|
|||
)
|
||||
set_tests_properties(test_horus_binary PROPERTIES PASS_REGULAR_EXPRESSION "1C9A9545")
|
||||
|
||||
add_test(NAME test_horus_binary_v2
|
||||
COMMAND sh -c "cd ${CMAKE_CURRENT_BINARY_DIR}/src;
|
||||
sox -t raw -r 8000 -e signed-integer -b 16 -c 1 ${CMAKE_CURRENT_SOURCE_DIR}/samples/horus_v2_100bd.raw -r 48000 -t raw - |
|
||||
./horus_demod -m binary - -"
|
||||
)
|
||||
set_tests_properties(test_horus_binary_v2 PROPERTIES PASS_REGULAR_EXPRESSION "0102030405060708091DBB")
|
||||
|
||||
add_test(NAME test_horus_rtty_7n1
|
||||
COMMAND sh -c "cd ${CMAKE_CURRENT_BINARY_DIR}/src;
|
||||
sox ${CMAKE_CURRENT_SOURCE_DIR}/samples/rtty_7n1.wav -r 48000 -t raw - |
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
["test_field 6", "none"],
|
||||
["test_field 7", "none"],
|
||||
["test_field 8", "none"],
|
||||
["test_field 9", "none"],
|
||||
["test_field 9", "none"]
|
||||
]
|
||||
}
|
||||
}
|
|
@ -1 +1 @@
|
|||
__version__ = "0.1.21"
|
||||
__version__ = "0.2.1"
|
||||
|
|
|
@ -269,7 +269,7 @@ if __name__ == "__main__":
|
|||
parser = argparse.ArgumentParser(description="Project Horus Binary Telemetry Decoder", formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
||||
parser.add_argument("--test", action="store_true", default=False, help="Run unit tests.")
|
||||
parser.add_argument("--update", action="store_true", default=False, help="Download latest payload ID and custom fields files before continuing.")
|
||||
parser.add_argument("--decode", type=str, default=None, help="Attempt to decode a hexadecial packet.")
|
||||
parser.add_argument("--decode", type=str, default=None, help="Attempt to decode a hexadecial packet supplied as an argument.")
|
||||
parser.add_argument("-v", "--verbose", action="store_true", default=False, help="Verbose output (set logging level to DEBUG)")
|
||||
args = parser.parse_args()
|
||||
|
||||
|
@ -284,8 +284,14 @@ if __name__ == "__main__":
|
|||
)
|
||||
|
||||
if args.update:
|
||||
# Download latest list from github.
|
||||
init_payload_id_list()
|
||||
init_custom_field_list()
|
||||
else:
|
||||
# Use whatever is available in the current directory
|
||||
logging.info("Using existing payload/custom-field files.")
|
||||
init_payload_id_list(nodownload=True)
|
||||
init_custom_field_list(nodownload=True)
|
||||
|
||||
if args.decode is not None:
|
||||
try:
|
||||
|
@ -303,7 +309,7 @@ if __name__ == "__main__":
|
|||
['horus_binary_v1', b'\x01\x12\x00\x00\x00\x23\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x1C\x9A\x95\x45', 'error'],
|
||||
['horus_binary_v2_16byte', b'\x01\x12\x02\x00\x02\xbc\xeb!AR\x10\x00\xff\x00\xe1\x7e', ''],
|
||||
# id seq_no HH MM SS lat lon alt spd sat tmp bat custom data -----------------------| crc16
|
||||
['horus_binary_v2_32byte', b'\xFF\xFF\x12\x00\x00\x00\x23\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe8\x82', '']
|
||||
['horus_binary_v2_32byte', b'\x00\x01\x02\x00\x0C\x22\x38\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\xB4\xC6', '']
|
||||
]
|
||||
|
||||
for _test in tests:
|
||||
|
|
|
@ -32,7 +32,7 @@ HORUS_CUSTOM_FIELDS = {
|
|||
["test_int_field", "none"]
|
||||
]
|
||||
},
|
||||
"4FSKTEST32": {
|
||||
"4FSKTEST-V2": {
|
||||
"struct": "<BBBBBBBBB",
|
||||
"fields": [
|
||||
["test_field 1", "none"],
|
||||
|
@ -147,14 +147,18 @@ def download_latest_payload_id_list(url=PAYLOAD_ID_LIST_URL, filename=None, time
|
|||
|
||||
|
||||
|
||||
def init_payload_id_list(filename="payload_id_list.txt"):
|
||||
def init_payload_id_list(filename="payload_id_list.txt", nodownload=False):
|
||||
""" Initialise and update the local payload ID list. """
|
||||
|
||||
_list = download_latest_payload_id_list(filename=filename)
|
||||
if _list:
|
||||
HORUS_PAYLOAD_LIST = _list
|
||||
if not nodownload:
|
||||
_list = download_latest_payload_id_list(filename=filename)
|
||||
|
||||
if _list:
|
||||
HORUS_PAYLOAD_LIST = _list
|
||||
else:
|
||||
logging.warning("Could not download Payload ID List - attempting to use local version.")
|
||||
HORUS_PAYLOAD_LIST = read_payload_list(filename=filename)
|
||||
else:
|
||||
logging.warning("Could not download Payload ID List - attempting to use local version.")
|
||||
HORUS_PAYLOAD_LIST = read_payload_list(filename=filename)
|
||||
|
||||
return HORUS_PAYLOAD_LIST
|
||||
|
@ -280,13 +284,17 @@ def download_latest_custom_field_list(url=HORUS_CUSTOM_FIELD_URL, filename=None,
|
|||
return _custom_field_list
|
||||
|
||||
|
||||
def init_custom_field_list(filename="custom_field_list.json"):
|
||||
def init_custom_field_list(filename="custom_field_list.json", nodownload=False):
|
||||
""" Initialise and update the local custom field list """
|
||||
_list = download_latest_custom_field_list(filename=filename)
|
||||
if _list:
|
||||
HORUS_CUSTOM_FIELDS = _list
|
||||
|
||||
if not nodownload:
|
||||
_list = download_latest_custom_field_list(filename=filename)
|
||||
if _list:
|
||||
HORUS_CUSTOM_FIELDS = _list
|
||||
else:
|
||||
logging.warning("Could not download Custom Field List - attempting to use local version.")
|
||||
HORUS_CUSTOM_FIELDS = read_custom_field_list(filename=filename)
|
||||
else:
|
||||
logging.warning("Could not download Custom Field List - attempting to use local version.")
|
||||
HORUS_CUSTOM_FIELDS = read_custom_field_list(filename=filename)
|
||||
|
||||
return HORUS_CUSTOM_FIELDS
|
||||
|
|
Plik binarny nie jest wyświetlany.
|
@ -499,7 +499,9 @@ int extract_horus_rtty(struct horus *hstates, char ascii_out[], int uw_loc, int
|
|||
|
||||
/* make sure we don't overrun storage */
|
||||
|
||||
assert(nout <= horus_get_max_ascii_out_len(hstates));
|
||||
if(nout > horus_get_max_ascii_out_len(hstates)){
|
||||
return 0;
|
||||
}
|
||||
|
||||
hstates->crc_ok = crc_ok;
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ int main(int argc,char *argv[]) {
|
|||
/* all zeros is nastiest sequence for demod before scrambling */
|
||||
while(framecnt > 0){
|
||||
memset(&input_payload, 0, nbytes);
|
||||
input_payload.PayloadID = 257;
|
||||
input_payload.PayloadID = 256;
|
||||
input_payload.Hours = 12;
|
||||
input_payload.Minutes = 34;
|
||||
input_payload.Seconds = 56;
|
||||
|
|
Ładowanie…
Reference in New Issue