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

Writing codeplug to Anytone AT-D878UVII Plus resets APRS frequencies on device. #349

Closed toco closed 1 year ago

toco commented 1 year ago

When uploading a code-plug to my Anytone AT-D878UVII Plus the APRS frequencies stored on the device get reset.

Reproduced with qdmr at https://github.com/hmatuschek/qdmr/commit/a335412e6c760300757a217a5dcbd5e94a0018f5 and Anytone firmware 3.02n (this also happened with 3.01 already).

hmatuschek commented 1 year ago

I need to update the APRS settings to the new FW versions anyway. Currently only one FM APRS frequency is supported.

toco commented 1 year ago

Yeah and even that no longer works (or maybe now override it which it didn't before). I also think the config concept in the UI with multiple channels with different source/destination settings doesn't map correctly to the AnyTone capabilities, which is just one source/destination config for FM, but multiple frequencies that can be selected.

hmatuschek commented 1 year ago

I do not understand the need for one APRS configuration but several frequencies. If any, I would suspect to need it the other way around. However, to map that to the concept of qdmr, I would rather add an extension to the one FM-APRS setting allowed for anytone devices, that will hold the additional frequencies.

toco commented 1 year ago

That sounds like a good way to do it.

allesand commented 1 year ago

Hello, I get

 40%] Building CXX object lib/CMakeFiles/libdmrconf.dir/d878uv_codeplug.cc.o
../qdmr/lib/d878uv_codeplug.cc: In member function ‘virtual bool D878UVCodeplug::APRSSettingsElement::fromAPRSSystem(const APRSSystem*, Codeplug::Context&, const ErrorStack&)’:
../qdmr/lib/d878uv_codeplug.cc:2618:3: error: ‘setFrequency’ was not declared in this scope; did you mean ‘Frequency’?
 2618 |   setFrequency(sys->revertChannel()->txFrequency()*1e6);
      |   ^~~~~~~~~~~~
      |   Frequency
../qdmr/lib/d878uv_codeplug.cc: In member function ‘virtual bool D878UVCodeplug::APRSSettingsElement::linkAPRSSystem(APRSSystem*, Codeplug::Context&)’:
../qdmr/lib/d878uv_codeplug.cc:2642:70: error: ‘frequency’ was not declared in this scope; did you mean ‘Frequency’?
 2642 |   FMChannel *ch = ctx.config()->channelList()->findFMChannelByTxFreq(frequency()/1e6);
      |                                                                      ^~~~~~~~~
      |                                                                      Frequency
make[2]: *** [lib/CMakeFiles/libdmrconf.dir/build.make:1806: lib/CMakeFiles/libdmrconf.dir/d878uv_codeplug.cc.o] Fehler 1
make[1]: *** [CMakeFiles/Makefile2:170: lib/CMakeFiles/libdmrconf.dir/all] Fehler 2
make: *** [Makefile:156: all] Fehler 2
hmatuschek commented 1 year ago

This fix requires some rewriting of the present codeplug elements dealing with the positioning settings. So expect some mayhem before it gets better.

hmatuschek commented 1 year ago

Does anyone know, what this "pass all" option means?

toco commented 1 year ago

Show all APRS message types AFAIK.

hmatuschek commented 1 year ago

Ok, thanks.

toco commented 1 year ago

Small correction: PASS ALL shows messages even when they fail CRC checks.

Add new function in CPS->APRS-> Analog -> PASS ALL. Set On PASSALL will receive more APRS message, but some are with corrupted data. Default OFF. This command enables the attempt to display corrupted packets when PASSALL is ON. When PASSALL is OFF, packets will be displayed only if the CRC (error checking) is correct.

https://groups.io/g/ANYTONE-878/topic/90505161?p=%2C%2C%2C20%2C0%2C0%2C0%3A%3A%2C%2C%2C0%2C0%2C0%2C90505161

hmatuschek commented 1 year ago

Ok, I was just puzzled, as this option is stored near the FM APRS transmission options. There is an separate memory region, where the FM APRS reception options are stored.

allesand commented 1 year ago

Hello, I get


 40%] Building CXX object lib/CMakeFiles/libdmrconf.dir/d878uv_codeplug.cc.o
../qdmr/lib/d878uv_codeplug.cc: In member function ‘virtual bool D878UVCodeplug::APRSSettingsElement::fromAPRSSystem(const APRSSystem*, Codeplug::Context&, const ErrorStack&)’:
../qdmr/lib/d878uv_codeplug.cc:2618:3: error: ‘setFrequency’ was not declared in this scope; did you mean ‘Frequency’?
 2618 |   setFrequency(sys->revertChannel()->txFrequency()*1e6);

Builds and runs ok now! Have to set up analog APRS to test, though.

allesand commented 1 year ago

Status report: current version crashes when reading from 878. Writing works, it crashes after finishing:

Debug in lib/anytone_interface.cc@356: Anytone: Left program-mode.
Debug in lib/usbserial.cc@155: Serial port will close now.
Speicherzugriffsfehler (Speicherabzug geschrieben)
hmatuschek commented 1 year ago

Uh, that was a nasty one, smashed the stack a bit and got random crashes everywhere. Fortunately, there is valgrinds memcheck.

hmatuschek commented 1 year ago

Is there any means of selecting, which FM APRS frequency is used? I haven't found anything in the CPS.

hmatuschek commented 1 year ago

With the last commit, it is now possible to add and edit the additional FM APRS frequencies. There are only 7, the first is the default and is taken from the revert channel associated the the qdmr APRS system. There is now also a reference in the AnyTone FM and DMR channel extensions allowing to select the FM APRS frequency. If none is selected, the default (revert channel) is taken.

hmatuschek commented 1 year ago

I believe, this issue is now fixed. Just test the extension and let me know.

allesand commented 1 year ago

I can confirm that reading&writing the config works for both 868 and 878

@toco can you confirm the desired function?

toco commented 1 year ago

I‘m out of country without my laptop. The Rasberry Pi I have with me runs into the Linux USB issue… Can check next week.

toco commented 1 year ago

Copied over from the other issue, had the wrong window open:

Tested on c457377. Things I noticed:

  1. I added two APRS frequencies in the config, on the HT the first one appears twice, the second one appears in the second slot.
  2. Report filters are always shown as "off" on device, even though I set some to "on".
hmatuschek commented 1 year ago

The second point should now be fixed now in this branch.

toco commented 1 year ago

From the other thread

Concerning the first point: You can only define 7 additional FM APRS frequencies in the extension. The first frequency is set by the FM APRS system. That is, within the config:

Ah! With the explanation that makes sense.

toco commented 1 year ago

Looks like it works now, thanks for the very quick turnaround time!

The only thing I'm missing is setting (or not resetting) the selected APRS frequency.

Differences in binary codeplug read from device after changing the selected frequency:

diff <(xxd APRS_freq_1.dfu) <(xxd APRS_freq_2.dfu) 
187c187
< 00000ba0: 0000 0000 0000 2080 0040 0000 0000 0000  ...... ..@......
---
> 00000ba0: 0001 0000 0000 2080 0040 0000 0000 0000  ...... ..@......
2048c2048
< 00007ff0: 10d8 c869 59                             ...iY
---
> 00007ff0: 10a5 d9cf b8                             .....
diff <(xxd APRS_freq_1.dfu) <(xxd APRS_freq_3.dfu)            
187c187
< 00000ba0: 0000 0000 0000 2080 0040 0000 0000 0000  ...... ..@......
---
> 00000ba0: 0002 0000 0000 2080 0040 0000 0000 0000  ...... ..@......
2048c2048
< 00007ff0: 10d8 c869 59                             ...iY
---
> 00007ff0: 1063 ec54 41                             .c.TA
hmatuschek commented 1 year ago

The frequency can be set in the Anytone extension of the channel. There you can select the FM APRS frequency. However, selecting none will select the default one specified in the FM APRS system. So, only the additional frequencies are selectable.