hmatuschek / qdmr

A GUI application for configuring and programming cheap DMR radios under Linux and MacOS X.
https://dm3mat.darc.de/qdmr/
GNU General Public License v3.0
223 stars 46 forks source link

[Anytone D878UVII+] Function Keys PF1-3 read wrong #375

Closed smrqdt closed 1 year ago

smrqdt commented 1 year ago

qdmr 0.11.3 mixes up PF1, PF2 and PF3 key functions when reading from and re-writing to Anytone D878IV II Plus with firmware 3.02n.

Steps to reproduce:

  1. Program PF1-3 on device
  2. read codeplug into qdmr from device
  3. write codeplug back to device
  4. observe changed key functions on device
Key before after
PF1 short Slot Switch Off funcKeyAShort
PF1 long Digi Monitor Encryption funcKeyALong
PF2 short Monitor Voltage funcKeyBShort
PF2 long Off Call funcKeyBLong
PF3 short TX Power TX Power funcKeyCShort
PF3 long APRS Send Vox funcKeyCLong

Anytone CPS before using qdmr

Keys_before_qdmr

qdmr codeplug

excerpt from yaml

    keySettings:
      funcKey1Short: ToggleMainChannel
      funcKey1Long: SubChannel
      funcKey2Short: ToggleVFO
      funcKey2Long: ChannelType
      funcKey3Short: Power
      funcKey3Long: APRSSend
      funcKey4Short: Repeater
      funcKey4Long: SMS
      funcKey5Short: Reverse
      funcKey5Long: Dial
      funcKey6Short: Encryption
      funcKey6Long: Off
      funcKeyAShort: Off
      funcKeyALong: Encryption
      funcKeyBShort: Voltage
      funcKeyBLong: Call
      funcKeyCShort: Power
      funcKeyCLong: VOX
      funcKeyDShort: Off
      funcKeyDLong: Off
      longPressDuration: 2 s
      autoKeyLock: false
      knobLock: true
      keypadLock: true
      sideKeysLock: true
      forcedKeyLock: false

Anytone CPS after programming with qdmr

Keys_after_qdmr

I can provide the Anytone codeplugs before/after if useful.

Versions

Anytone D878UVII Plus with Firmware 3.02n qmdr 0.11.3

toco commented 1 year ago

I have the same issue, didn’t have the time to analyze and report yet.

allesand commented 1 year ago

The mix up must be happening when reading from the radio - since I shared configs between my 868 and 878, I only edited and wrote. That worked. Plus, from the yaml it looks like it writes exactly what it (falsly) read from the radio. I am AFK right now, will check when back.. Can you confirm that writing works for you when you set the keys as they should be in the Anytone extensions?

smrqdt commented 1 year ago

You’re right, writing works fine. After changing the functions in qdmr they’re correctly written to the radio.

I was first under the impression the numbered and lettered Keys where swapped because of Power/Vox for PF3, but the other keys don’t match. I was confused by the read functions for funcKey3-6 which don’t exist on D878UVII. Maybe some descriptions telling which key is which would be nice (and maybe Off as default for non-existing keys?).

allesand commented 1 year ago

You’re right, writing works fine. After changing the functions in qdmr they’re correctly written to the radio.

Thanks for testing, so it is the "read" process that needs fixing.

I was first under the impression the numbered and lettered Keys where swapped because of Power/Vox for PF3, but the other keys don’t match. I was confused by the read functions for funcKey3-6 which don’t exist on D878UVII. Maybe some descriptions telling which key is which would be nice (and maybe Off as default for non-existing keys?).

@hmatuschek mentinoned in https://github.com/hmatuschek/qdmr/issues/298#issuecomment-1568093684 that the 578 has more keys. Since "tooltips" are supported, maybe some explanation on the actual labels on the device is possible?

allesand commented 1 year ago

Some observations: this is the list with key settings:

typedef enum { Off = 0x00, Voltage = 0x01, Power = 0x02, Repeater = 0x03, Reverse = 0x04, Encryption = 0x05, Call = 0x06, VOX = 0x07, ToggleVFO = 0x08, SubPTT = 0x09, Scan = 0x0a, WFM = 0x0b, Alarm = 0x0c, RecordSwitch = 0x0d, Record = 0x0e, SMS = 0x0f, Dial = 0x10, Monitor = 0x12, ToggleMainChannel = 0x13, HotKey1 = 0x14, HotKey2 = 0x15, HotKey3 = 0x16, HotKey4 = 0x17, HotKey5 = 0x18, HotKey6 = 0x19, WorkAlone = 0x1a, SkipChannel = 0x1b, DMRMonitor = 0x1c, SubChannel = 0x1d, PriorityZone = 0x1e, VFOScan = 0x1f, MICSoundQuality = 0x20, LastCallReply = 0x21, ChannelType = 0x22, Roaming = 0x24, ChannelRanging = 0x25, MaxVolume = 0x26, Slot = 0x27, APRSType = 0x28, Zone = 0x29, RoamingSet = 0x2a, APRSSet = 0x2b, Mute=0x2c, CtcssDcsSet=0x2d, TBSTSend = 0x2e, Bluetooth = 0x2f, GPS = 0x30, ChannelName = 0x31, CDTScan = 0x32, APRSSend = 0x33, APRSInfo = 0x34 I set the keys to the settings starting with "Voltage" and they are read "off by one": when I set a key to "VOX" (0x07), qdmr displays "Call" (0x06). But - the table above show values off by more that one position?

One thing that cloud contribute is the "Monitor" (0x12) function. It can only be set to a short press and then the long press is not selectable

hmatuschek commented 1 year ago

Ok, I have to investigate that one a bit more. I've used the same code-table for the encoding and decoding of the function keys. Either the mapping is wrong, or (what I actually believe) there are different mappings for the different modes (long/short) and possibly for the different keys. This setting is and was always a real headache.

francais01 commented 1 year ago

I also fixed up the entries for my 878 in a saved qdmr file and then wrote it to the radio. After that the key functions were restored, so it looks like the write works fine.

hmatuschek commented 1 year ago

By the way, you do not need to edit the yaml files by hand. Enable Show device extensions in the Settings dialog. Then you should find a tree view of the extensions for all devices. You will then find the AnyTone key settings in the general Settings tab (right) under Anytone -> keySettings.

allesand commented 1 year ago

For the 578, new firmware has been released: http://www.wouxun.us/category.php?category_id=94 (Changelog http://www.wouxun.us/Software/AnyTone-Software/AT-D578UVII-PLUS-v2.06.2-Changelog.pdf) So it is very likely that the 878 will receive new firmware shortly, too. Upgrade recommendation for this new version for the 578 is not to re-use the old configuration but to start with an empty config (and do CVS export/import etc.) so it sounds like internal structures may have changed. Maybe it is worth waiting for the new firmware for the 878 and pick up from there?

hmatuschek commented 1 year ago

Probably. However, it sounds like, they broke the codeplug format (again). As there is no firmware version information in the handshake, I cannot check for compatibility.

Once upon a time, AnyTone had backward comparability of the binary codeplug format even across models (e.g., You could -- in principle -- load a 878 codeplug onto a 868 and vice versa.). Now, they break it constantly even with minor FW updates.

allesand commented 1 year ago

As inconvenient as this bug is - qdmr writes correctly, so problems only arise when making changes outside qdmr and needing to read from the radio. Since it sounds like "big changes ahead": then save the dev/debug energy for the probably changed codeplug format in the coming firmware. Since "keySettings:" is a pretty obvious block in the yaml file that should not change position, a diff should fix things when needing to read and before write? Maybe faster than using the GUI. Yes, somewhat "hacky", but should work?

allesand commented 1 year ago

@hmatuschek While above "workaround" mitigates the problem, it is still frustrating that qdmr is reading "wrong". Regarding this issue: an 878 only has funcKey1-2 and A-C. Still, qdmr reads values for all other keys as well. The radio actually has values for non-existent keys in the config? Is there a way to set the non-existent keys to "Off" on read?

Onto the actual problem: Trying to find an "offset". Settings how they should be: funcKeyAShort: DMRMonitor (DMRMonitor = 0x1c) funcKeyALong: Scan (Scan = 0x0a) funcKeyBShort: Monitor (Monitor = 0x12) funcKeyBLong: Off (Off = 0x00) funcKeyCShort: Voltage (Voltage = 0x01) funcKeyCLong: Power (Power = 0x02)

Settings how they are read: funcKeyAShort: Off (Off = 0x00) funcKeyALong: Encryption (Encryption = 0x05) funcKeyBShort: Voltage (Voltage = 0x01) funcKeyBLong: Call (Call = 0x06) funcKeyCShort: Power (Power = 0x02) funcKeyCLong: VOX (VOX = 0x07)

Interesting thing here: values on read are increasing 0-1-2 and 5-6-7 When I set funcKeyCLong to "TalkAround/Repeater" (right after Tx Power/Power in the radio menu), it stays at "VOX", though, and: the values qdmr reads from my radio (with different settings) are the exact same ones @smrqdt reported above! Is qdmr reading the same positions it is writing to? Since writing works?

Set funcKeyCLong to "FM Radio/WFM = 0x0b: on read, still displayed as "VOX" (0x07). It should change, shouldn't it? What can be the reason that it does not and why are the values so remarkable in a row?

hmatuschek commented 1 year ago

OMG, look at the diff: https://github.com/hmatuschek/qdmr/commit/8837668ef53eb75193d7ca04b5aab9458bf45a2e

The clue: The values you mentioned, are the default values for those settings. So, they are never set. (I first checked, if the addresses are OK, they where.) Please let me know, if that patch fixed it. (branch fix-d878uv2-key-function-decoding)

allesand commented 1 year ago

@smrqdt @toco @francais01 : please give fix-d878uv2-key-function-decoding a try - for me, qdmr is reading the correct values now! Thanks @hmatuschek ! Well, sometimes a step back and a second try leads to success - nice job! To err is human.. With the 878, funcKey 3-6 seem to have "random" values on read? Is the mapping "qdmr names" <-> "buttons on the radio" already documented somewhere? Would a tool tip be possible?

toco commented 1 year ago

Tested with 0438e77 and it looks good to me.

toco commented 1 year ago

Is the mapping "qdmr names" <-> "buttons on the radio" already documented somewhere? Would a tool tip be possible?

I agree this would be helpful. To me it looks like the mapping is:

qdmr AnyTone D878UVII+
funcKey1 P1
funcKey2 P2
funcKeyA PF1
funcKeyB PF2
funcKeyC PF3
image
hmatuschek commented 1 year ago

Thanks for the overview. In fact, this is (somewhat cryptic) documented in the manual: (scroll down to Keypad settings extension fields).

https://github.com/hmatuschek/qdmr/blob/0438e77cb3a186185e5245a75e3849ed327d6f6f/doc/manual/codeplug/anytone/settings.xml#L678-L679

allesand commented 1 year ago

Very nicely documented!

Breadcrumb: Anytone function key description manual link section differences models 878 578 mapping picture table