Merge branch 'develop' of github.com:DJ2LS/FreeDATA into develop

This commit is contained in:
Mashintime 2023-11-17 16:05:09 -05:00
commit 5cc05d26e7
2 changed files with 21 additions and 9 deletions

View file

@ -35,6 +35,8 @@ tuning_range_fmin = -50
enable_fsk = False
enable_low_bandwidth_mode = False
respond_to_cq = True
enable_hmac = False
enable_morse_identifier = False
rx_buffer_size = 16
enable_scatter = False
tx_delay = 0

View file

@ -51,6 +51,16 @@ class DATA:
self.mygrid = config['STATION']['mygrid']
self.enable_fsk = config['MODEM']['enable_fsk']
self.respond_to_cq = config['MODEM']['respond_to_cq']
self.enable_hmac = config['MODEM']['enable_hmac']
self.enable_stats = config['STATION']['enable_stats']
self.enable_morse_identifier = config['MODEM']['enable_morse_identifier']
# Enable general responding to channel openers for example
# this can be combined with a callsign blacklist for example
self.respond_to_call = True
# TODO we need to pass this information from modem when receiving a burst
self.modem_frequency_offset = 0
@ -899,7 +909,7 @@ class DATA:
data_frame_crc_received = helpers.get_crc_32(data_frame)
# check if hmac signing enabled
if Modem.enable_hmac:
if self.enable_hmac:
self.log.info(
"[Modem] [HMAC] Enabled",
)
@ -943,7 +953,7 @@ class DATA:
data=data_frame,
)
if Modem.enable_stats:
if self.enable_stats:
self.stats.push(frame_nack_counter=self.frame_nack_counter, status="wrong_crc", duration=duration)
self.log.info("[Modem] ARQ | RX | Sending NACK", finished=ARQ.arq_seconds_until_finish,
@ -1159,7 +1169,7 @@ class DATA:
speed_list=ARQ.speed_list
)
if Modem.enable_stats:
if self.enable_stats:
duration = time.time() - self.rx_start_of_transmission
self.stats.push(frame_nack_counter=self.frame_nack_counter, status="received", duration=duration)
@ -1864,7 +1874,7 @@ class DATA:
data_in:bytes:
"""
# if we don't want to respond to calls, return False
if not Modem.respond_to_call:
if not self.respond_to_call:
return False
# ignore channel opener if already in ARQ STATE
@ -1947,7 +1957,7 @@ class DATA:
self.send_disconnect_frame()
# transmit morse identifier if configured
if Modem.transmit_morse_identifier:
if self.enable_morse_identifier:
modem.MODEM_TRANSMIT_QUEUE.put(["morse", 1, 0, self.mycallsign])
self.arq_cleanup()
@ -2254,7 +2264,7 @@ class DATA:
# is intended for this station.
# stop processing if we don't want to respond to a call when not in a arq session
if not Modem.respond_to_call and not ARQ.arq_session:
if not self.respond_to_call and not ARQ.arq_session:
return False
# stop processing if not in arq session, but modem state is busy and we have a different session id
@ -2609,7 +2619,7 @@ class DATA:
mycallsign=str(mycallsign, "UTF-8"),
snr=str(snr),
)
if Modem.respond_to_call:
if self.respond_to_call:
self.transmit_ping_ack(snr)
def transmit_ping_ack(self, snr):
@ -2778,7 +2788,7 @@ class DATA:
else:
self.enqueue_frame_for_tx([beacon_frame], c2_mode=FREEDV_MODE.sig0.value, copies=1,
repeat_delay=0)
if Modem.transmit_morse_identifier:
if self.enable_morse_identifier:
modem.MODEM_TRANSMIT_QUEUE.put(["morse", 1, 0, self.mycallsign])
self.beacon_interval_timer = time.time() + self.beacon_interval
@ -2896,7 +2906,7 @@ class DATA:
self.states.radio_frequency,
)
if Modem.respond_to_cq and Modem.respond_to_call:
if self.respond_to_cq and self.respond_to_call:
self.transmit_qrv(dxcallsign, snr)
def transmit_qrv(self, dxcallsign: bytes, snr) -> None: