From 615e52551e37e8c1aab5fa90f74872d441857380 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Tue, 14 Jan 2025 20:01:15 -0800 Subject: [PATCH 1/3] Fix memory dragging off-by-N rows issue Since the introduction of the filter query field, the memory dragging function has been off by a few rows when dropped. This is due to improperly calculating the position of the memory editor in the window, which this patch corrects. --- chirp/wxui/memedit.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/chirp/wxui/memedit.py b/chirp/wxui/memedit.py index 49fbb1b8..0512d45a 100644 --- a/chirp/wxui/memedit.py +++ b/chirp/wxui/memedit.py @@ -674,6 +674,7 @@ def OnData(self, x, y, defResult): payload = self.parse_data() x, y = self._memedit._grid.CalcUnscrolledPosition(x, y) y -= self._memedit._grid.GetColLabelSize() + y -= self._memedit._grid.GetPosition()[1] row, cell = self._memedit._grid.XYToCell(x, y) start_row = self._memedit.mem2row(payload['mems'][0].number) if row < 0 or row == start_row: @@ -703,6 +704,7 @@ def OnDragOver(self, x, y, defResult): x, y = self._memedit._grid.CalcUnscrolledPosition(x, y) y -= self._memedit._grid.GetColLabelSize() + y -= self._memedit._grid.GetPosition()[1] row, cell = self._memedit._grid.XYToCell(x, y) max_row = self._memedit._grid.GetNumberRows() if row >= 0: From 4415263a394c3c00a65dfc30ba5afcc44b4fd5dd Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Tue, 14 Jan 2025 20:10:35 -0800 Subject: [PATCH 2/3] tk280: Fix memory format deprecated behaviors --- chirp/drivers/tk280.py | 35 +++++++++-------------------------- 1 file changed, 9 insertions(+), 26 deletions(-) diff --git a/chirp/drivers/tk280.py b/chirp/drivers/tk280.py index 0aead631..e089affd 100644 --- a/chirp/drivers/tk280.py +++ b/chirp/drivers/tk280.py @@ -56,7 +56,7 @@ # MEM_FORMAT = """ -#seekto 0x0000; +//#seekto 0x0000; struct { // x00-x01, Edit>>Model Information>>Radio Format, // '03 00':Conventional Format, '00 03':Trunked Format @@ -140,7 +140,10 @@ u8 unknown23[6]; u8 unknown133; // FleetSync Enhanced, 00:enable, FF:disable char ident[8]; // radio identification string - u8 unknown26[12]; // Passwords, see passwords struct below + struct { + char radio[6]; // 0xAF-0xB4, 6 digit Radio Password + char data[6]; // 0xB5-0xBA, 6 digit Data Password + } passwords; char lastsoftversion[5]; // software version employed to program the radio char dtmf_prim_code[7]; // DTMF Decode, Primary Code char dtmf_sec_code[7]; // DTMF Decode, Secondary Code @@ -170,19 +173,6 @@ signalling_type:1; //Signalling, '1'=OR, '0'=AND } settings; -#seekto 0xA7; -struct { -// 0xA7, M or P... trying to work around absent model and type in tk-380 -// but doesn't work. Still need the id struct. - char type; -} id; - -#seekto 0xAF; -struct { - char radio[6]; // 0xAF-0xB4, 6 digit Radio Password - char data[6]; // 0xB5-0xBA, 6 digit Data Password -} passwords; - //These are ALL the keys on TK-380 keypad version. These locations are assigned // functions from values in KEYS below #seekto 0x0110; @@ -219,7 +209,7 @@ u8 kPOUND; // Numkey # } keys; -#seekto 0x0140; +//#seekto 0x0140; struct { lbcd tf01_rx[4]; lbcd tf01_tx[4]; @@ -331,7 +321,7 @@ u8 unknown118[2]; // unknown } ost[16]; -#seekto 0x800; +//#seekto 0x800; struct { u8 2t_a_tone_y[4]; // 2t_a_tone_x and 2t_a_tone_z u8 2t_b_tone_y[4]; // 2t_b_tone_x and 2t_b_tone_z @@ -451,7 +441,7 @@ u8 unknown127[2]; } fs_id_list[64]; -#seekto 0x7000; +//#seekto 0x7000; struct { u8 fs_sl_status; // FleetSync, Status List, Status: 10-99 u8 unknown120; @@ -1164,7 +1154,7 @@ def get_settings(self): sett = self._memobj.settings msc = self._memobj.misc keys = self._memobj.keys - passwd = self._memobj.passwords + passwd = self._memobj.settings.passwords fsync = self._memobj.fleetsync optfeat1 = RadioSettingGroup("optfeat1", "Optional Features 1") @@ -1308,13 +1298,6 @@ def get_settings(self): not sett.ptt_release_tone)) optfeat2.append(pttr) - # Save Battery only for portables? - """if self.TYPE[0] == "P": - bs = int(sett.battery_save) == 0x32 and True or False - bsave = RadioSetting("settings.battery_save", "Battery Saver", - RadioSettingValueBoolean(bs)) - optfeat1.append(bsave)""" - # PTT ID Section pdt = MemSetting("misc.ptt_id_type", "PTT ID Type", RadioSettingValueList( From 6fa5b1d9a96fa7a6cb240dc1deb1d3fcdf100f06 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Tue, 14 Jan 2025 20:17:55 -0800 Subject: [PATCH 3/3] tk280: Fix battery save setting This wasn't getting exposed because of the comparison between string and byte(s) and thus wasn't properly being tested before. --- chirp/drivers/tk280.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/chirp/drivers/tk280.py b/chirp/drivers/tk280.py index e089affd..0e457e2e 100644 --- a/chirp/drivers/tk280.py +++ b/chirp/drivers/tk280.py @@ -1200,11 +1200,11 @@ def get_settings(self): current_index=int(sett.signalling_type))) optfeat1.append(sigtyp) - if self.TYPE[0] == "P": + if self.TYPE[0:1] == b"P": bsav = MemSetting( "settings.battery_save", "Battery Save", - RadioSettingValueList(BSAVE.values(), - current_index=sett.battery_save)) + RadioSettingValueMap([(v, k) for k, v in BSAVE.items()], + sett.battery_save)) optfeat1.append(bsav) tot = MemSetting("settings.tot", "Time Out Timer (TOT)",