From a8cdf67eee681bfe6965c568bc26bfbc199c1d2c Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Tue, 13 Aug 2024 14:45:12 -0700 Subject: [PATCH] ga510v2: Fix power level handling The GA510v2 has two bits for a three-level power value, unlike the UV-17 it inherits from. This splits the channel def apart to fix that. Fixes #11475 --- chirp/drivers/baofeng_uv17.py | 6 ++++-- chirp/drivers/ga510.py | 22 +++++++++++++++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/chirp/drivers/baofeng_uv17.py b/chirp/drivers/baofeng_uv17.py index 09b7da0ec..52cd3219a 100644 --- a/chirp/drivers/baofeng_uv17.py +++ b/chirp/drivers/baofeng_uv17.py @@ -196,7 +196,7 @@ class UV17(baofeng_uv17Pro.UV17Pro): LIST_MODE = ["Name", "Frequency"] CHANNELS = 999 - MEM_DEFS = """ + CHANNEL_DEF = """ struct channel { lbcd rxfreq[4]; lbcd txfreq[4]; @@ -215,6 +215,8 @@ class UV17(baofeng_uv17Pro.UV17Pro): scan:1; u8 unknown4; }; + """ + MEM_DEFS = """ struct channelname { char name[11]; }; @@ -320,7 +322,7 @@ class UV17(baofeng_uv17Pro.UV17Pro): struct ani ani; """ - MEM_FORMAT = MEM_DEFS + MEM_LAYOUT + MEM_FORMAT = CHANNEL_DEF + MEM_DEFS + MEM_LAYOUT def _make_frame(self, cmd, addr, length, data=""): """Pack the info in the header format""" diff --git a/chirp/drivers/ga510.py b/chirp/drivers/ga510.py index 13d426e8f..1642a9011 100644 --- a/chirp/drivers/ga510.py +++ b/chirp/drivers/ga510.py @@ -1141,6 +1141,26 @@ class RadioddityGA510v2(baofeng_uv17.UV17): LIST_MODE = ["Name", "Frequency"] CHANNELS = 128 + CHANNEL_DEF = """ + struct channel { + lbcd rxfreq[4]; + lbcd txfreq[4]; + u8 unused1; + ul16 rxtone; + ul16 txtone; + u8 unknown1:1, + bcl:1, + pttid:2, + unknown2:1, + wide:1, + lowpower:2; + u8 scode:4, + unknown3:3, + scan:1; + u8 unknown4; + }; + """ + MEM_LAYOUT = """ #seekto 0x1000; struct settings settings; @@ -1157,6 +1177,6 @@ class RadioddityGA510v2(baofeng_uv17.UV17): #seekto 0x400B; struct channelname names1[128]; """ - MEM_FORMAT = baofeng_uv17.UV17.MEM_DEFS + MEM_LAYOUT + MEM_FORMAT = CHANNEL_DEF + baofeng_uv17.UV17.MEM_DEFS + MEM_LAYOUT _has_workmode_support = False