This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
fixeria gerrit-no-reply at lists.osmocom.orgfixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/23745 ) Change subject: trx_toolkit: change coding of 'PWR' and 'SCPIR' fields ...................................................................... trx_toolkit: change coding of 'PWR' and 'SCPIR' fields During an internal discussion, it was decided to keep field 'PWR' as-is and move 'SCPIR' into a separate octet. This is easier to parse, less confusing, and would save us some CPU cycles. Change-Id: I482f72fd9305c51f43a0339d03904fb693d90ac9 Related: OS#4006, SYS#4895 --- M src/target/trx_toolkit/trxd_proto.py 1 file changed, 6 insertions(+), 31 deletions(-) Approvals: Jenkins Builder: Verified pespin: Looks good to me, but someone else must approve fixeria: Looks good to me, approved diff --git a/src/target/trx_toolkit/trxd_proto.py b/src/target/trx_toolkit/trxd_proto.py index 80d8de8..7afa484 100644 --- a/src/target/trx_toolkit/trxd_proto.py +++ b/src/target/trx_toolkit/trxd_proto.py @@ -75,35 +75,6 @@ return 1 * GMSK_BURST_LEN raise ValueError('Unknown modulation type') -class Power(codec.Codec): - ''' SCPIR and Tx power reduction (TRXDv2 and higher). - - +-----------------+---------------------------------+ - | 7 6 5 4 3 2 1 0 | Description | - +-----------------+---------------------------------+ - | . . . . x x x x | Power REDuction (in 2 dB steps) | - +-----------------+---------------------------------+ - | . x x x . . . . | SCPIR value (in 2 dB steps) | - +-----------------+---------------------------------+ - | x . . . . . . . | SCPIR sign indicator | - +-----------------+---------------------------------+ - - ''' - - def from_bytes(self, vals: dict, data: bytes) -> int: - blob = ord(data) # Convert a byte to an int - vals['red'] = (blob & 0b1111) * 2 - vals['scpir'] = ((blob >> 4) & 0b111) * 2 - if blob & (1 << 7): # negative sign - vals['scpir'] *= -1 - return 1 - - def to_bytes(self, vals: dict) -> bytes: - blob = (vals['red'] & 0b1111) \ - | (abs(vals['scpir']) << 4) // 2 \ - | (0x80 if (vals['scpir'] < 0) else 0x00) - return bytes((blob,)) - class BurstBits(codec.Buf): ''' Soft-/hard-bits with variable length. ''' @@ -188,14 +159,18 @@ STRUCT = ( Header(ver=2, batched=True), MTS(), - Power(), + codec.Uint('pwr'), + codec.Int('scpir'), + codec.Spare(len=3), BurstBits('hard-bits'), ) STRUCT = ( Header(ver=2), MTS(), - Power(), + codec.Uint('pwr'), + codec.Int('scpir'), + codec.Spare(len=3), codec.Uint32BE('fn'), BurstBits('hard-bits'), codec.Sequence(item=BPDU()).f('bpdu'), -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/23745 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: I482f72fd9305c51f43a0339d03904fb693d90ac9 Gerrit-Change-Number: 23745 Gerrit-PatchSet: 2 Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier at sysmocom.de> Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de> Gerrit-Reviewer: pespin <pespin at sysmocom.de> Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210416/9cd3f9b4/attachment.htm>