|
377 | 377 | 5: [400.0, 469.9999], |
378 | 378 | 6: [470.0, 1300.0] |
379 | 379 | } |
380 | | -SPECIALS = { |
381 | | - "F1(50M-76M)A": 200, |
382 | | - "F1(50M-76M)B": 201, |
383 | | - "F2(108M-136M)A": 202, |
384 | | - "F2(108M-136M)B": 203, |
385 | | - "F3(136M-174M)A": 204, |
386 | | - "F3(136M-174M)B": 205, |
387 | | - "F4(174M-350M)A": 206, |
388 | | - "F4(174M-350M)B": 207, |
389 | | - "F5(350M-400M)A": 208, |
390 | | - "F5(350M-400M)B": 209, |
391 | | - "F6(400M-470M)A": 210, |
392 | | - "F6(400M-470M)B": 211, |
393 | | - "F7(470M-600M)A": 212, |
394 | | - "F7(470M-600M)B": 213 |
395 | | - } |
396 | 380 |
|
397 | 381 | SCANLIST_LIST = ["None", "List1", "List2", "Both"] |
398 | | - |
399 | 382 | SCANLIST_SELECT_LIST = ["LIST1", "LIST2", "ALL"] |
400 | 383 |
|
401 | 384 | DTMF_CHARS = "0123456789ABCD*# " |
|
405 | 388 | DTMF_CODE_CHARS = "ABCD*# " |
406 | 389 | DTMF_DECODE_RESPONSE_LIST = ["None", "Ring", "Reply", "Both"] |
407 | 390 |
|
408 | | -KEYACTIONS_LIST = ["None", "Flashlight", "Power", "Monitor", "Scan", |
409 | | - "VOX", "*Alarm ", "FM radio", "*1750Hz tone", |
410 | | - "Lock keypad", "Switch main VFO", "Switch frequency/memory mode", "Switch demodulation"] |
| 391 | +KEYACTIONS_LIST = ["None", |
| 392 | + "Flashlight", |
| 393 | + "Power", |
| 394 | + "Monitor", |
| 395 | + "Scan", |
| 396 | + "VOX", |
| 397 | + "Alarm", |
| 398 | + "FM radio", |
| 399 | + "1750Hz tone", |
| 400 | + "Lock keypad", |
| 401 | + "Switch main VFO", |
| 402 | + "Switch frequency/memory mode", |
| 403 | + "Switch demodulation" |
| 404 | + ] |
411 | 405 |
|
412 | 406 | # the communication is obfuscated using this fine mechanism |
413 | 407 | def xorarr(data: bytes): |
@@ -675,7 +669,7 @@ def Get_SPECIALS(self): |
675 | 669 | for idx, name in enumerate(self.Get_VFO_CHANNEL_NAMES()): |
676 | 670 | specials[name] = 200 + idx |
677 | 671 | return specials |
678 | | - |
| 672 | + |
679 | 673 | def get_prompts(x=None): |
680 | 674 | rp = chirp_common.RadioPrompts() |
681 | 675 | rp.experimental = \ |
@@ -1392,43 +1386,44 @@ def get_settings(self): |
1392 | 1386 | top.append(roinfo) |
1393 | 1387 |
|
1394 | 1388 | # Programmable keys |
1395 | | - tmpval = int(_mem.key1_shortpress_action) |
1396 | | - if tmpval >= len(KEYACTIONS_LIST): |
1397 | | - tmpval = 0 |
1398 | | - rs = RadioSetting("key1_shortpress_action", "Side key 1 short press (F1Shrt)", |
| 1389 | + def GetActualKeyAction(actionNum): |
| 1390 | + hasAlarm = self._memobj.BUILD_OPTIONS.ENABLE_ALARM |
| 1391 | + has1750 = self._memobj.BUILD_OPTIONS.ENABLE_TX1750 |
| 1392 | + lst = KEYACTIONS_LIST.copy() |
| 1393 | + if not hasAlarm: |
| 1394 | + lst.remove("Alarm") |
| 1395 | + if not has1750: |
| 1396 | + lst.remove("1750Hz tone") |
| 1397 | + |
| 1398 | + actionNum = int(actionNum) |
| 1399 | + if actionNum >= len(KEYACTIONS_LIST) or KEYACTIONS_LIST[actionNum] not in lst: |
| 1400 | + actionNum = 0 |
| 1401 | + return lst, KEYACTIONS_LIST[actionNum] |
| 1402 | + |
| 1403 | + rs = RadioSetting("key1_shortpress_action", |
| 1404 | + "Side key 1 short press (F1Shrt)", |
1399 | 1405 | RadioSettingValueList( |
1400 | | - KEYACTIONS_LIST, KEYACTIONS_LIST[tmpval])) |
| 1406 | + *GetActualKeyAction(_mem.key1_shortpress_action))) |
1401 | 1407 | keya.append(rs) |
1402 | 1408 |
|
1403 | | - tmpval = int(_mem.key1_longpress_action) |
1404 | | - if tmpval >= len(KEYACTIONS_LIST): |
1405 | | - tmpval = 0 |
1406 | 1409 | rs = RadioSetting("key1_longpress_action", "Side key 1 long press (F1Long)", |
1407 | 1410 | RadioSettingValueList( |
1408 | | - KEYACTIONS_LIST, KEYACTIONS_LIST[tmpval])) |
| 1411 | + *GetActualKeyAction(_mem.key1_longpress_action))) |
1409 | 1412 | keya.append(rs) |
1410 | 1413 |
|
1411 | | - tmpval = int(_mem.key2_shortpress_action) |
1412 | | - if tmpval >= len(KEYACTIONS_LIST): |
1413 | | - tmpval = 0 |
1414 | 1414 | rs = RadioSetting("key2_shortpress_action", "Side key 2 short press (F2Shrt)", |
1415 | 1415 | RadioSettingValueList( |
1416 | | - KEYACTIONS_LIST, KEYACTIONS_LIST[tmpval])) |
| 1416 | + *GetActualKeyAction(_mem.key2_shortpress_action))) |
1417 | 1417 | keya.append(rs) |
1418 | 1418 |
|
1419 | | - tmpval = int(_mem.key2_longpress_action) |
1420 | | - if tmpval >= len(KEYACTIONS_LIST): |
1421 | | - tmpval = 0 |
1422 | 1419 | rs = RadioSetting("key2_longpress_action", "Side key 2 long press (F2Long)", |
1423 | 1420 | RadioSettingValueList( |
1424 | | - KEYACTIONS_LIST, KEYACTIONS_LIST[tmpval])) |
| 1421 | + *GetActualKeyAction(_mem.key2_longpress_action))) |
1425 | 1422 | keya.append(rs) |
1426 | | - tmpval = int(_mem._0xe90.keyM_longpress_action) |
1427 | | - if tmpval >= len(KEYACTIONS_LIST): |
1428 | | - tmpval = 0 |
| 1423 | + |
1429 | 1424 | rs = RadioSetting("keyM_longpress_action", "Menu key long press (M Long)", |
1430 | 1425 | RadioSettingValueList( |
1431 | | - KEYACTIONS_LIST, KEYACTIONS_LIST[tmpval])) |
| 1426 | + *GetActualKeyAction(_mem._0xe90.keyM_longpress_action))) |
1432 | 1427 | keya.append(rs) |
1433 | 1428 |
|
1434 | 1429 | # DTMF settings |
|
0 commit comments