From 172bdbe8916d81c1009ec00fc3ab9af51c0067e8 Mon Sep 17 00:00:00 2001 From: sq5bpf Date: Tue, 20 Jun 2023 11:40:05 +0200 Subject: [PATCH] code cleanup: convert code_flag and masks to a struct --- uvk5.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/uvk5.py b/uvk5.py index 05799ff..a14062f 100644 --- a/uvk5.py +++ b/uvk5.py @@ -57,7 +57,10 @@ struct { ul32 offset; u8 rxcode; u8 txcode; - u8 code_flag; + u8 unknown1:2, + txcodeflag:2, + unknown2:2, + rxcodeflag:2; u8 flags1; u8 flags2; u8 dtmf_flags; @@ -705,14 +708,14 @@ class UVK5Radio(chirp_common.CloneModeRadio): rxmoval = 0 rxtoval = 0 - _mem.code_flag = (_mem.code_flag & 0b11001100) | ( - txmoval << 4) | rxmoval + _mem.rxcodeflag = rxmoval + _mem.txcodeflag = txmoval _mem.rxcode = rxtoval _mem.txcode = txtoval def _get_tone(self, mem, _mem): - rxtype = _mem.code_flag & 0x03 - txtype = (_mem.code_flag >> 4) & 0x03 + rxtype = _mem.rxcodeflag + txtype = _mem.txcodeflag rx_tmode = TMODES[rxtype] tx_tmode = TMODES[txtype]