Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix memory dragging off-by-N rows issue #1229

Merged
merged 3 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 12 additions & 29 deletions chirp/drivers/tk280.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -219,7 +209,7 @@
u8 kPOUND; // Numkey #
} keys;

#seekto 0x0140;
//#seekto 0x0140;
struct {
lbcd tf01_rx[4];
lbcd tf01_tx[4];
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -1210,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)",
Expand Down Expand Up @@ -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(
Expand Down
2 changes: 2 additions & 0 deletions chirp/wxui/memedit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down