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

RD-5R: conversion to yaml fails #2

Open
bzed opened this issue Sep 1, 2020 · 4 comments
Open

RD-5R: conversion to yaml fails #2

bzed opened this issue Sep 1, 2020 · 4 comments

Comments

@bzed
Copy link

bzed commented Sep 1, 2020

Hi,

converting the default codeplug from a freshly installed and resetted RD-5R fails:

bzed@think ~workspace/ham/RD-5R/OpenGD77 % gd77xfer export defaults.bin defaults.yaml
2020-09-02 00:38:31,218 xfer.py:153 export Namespace(cmd='export', input_file=<_io.BufferedReader name='defaults.bin'>, output_file=<_io.BufferedWriter name='defaults.yaml'>, port='/dev/ttyACM0', verbose=False)
Traceback (most recent call last):
  File "/home/bzed/workspace/ham/RD-5R/OpenGD77/opengd77xfer/bin/gd77xfer", line 8, in <module>
    sys.exit(main())
  File "/home/bzed/workspace/ham/RD-5R/OpenGD77/opengd77xfer/lib/python3.8/site-packages/opengd77/xfer.py", line 161, in main
    write_yaml(cp, args.output_file)
  File "/home/bzed/workspace/ham/RD-5R/OpenGD77/opengd77xfer/lib/python3.8/site-packages/opengd77/xfer.py", line 119, in write_yaml
    yaml.dump(cp, f)
  File "/home/bzed/workspace/ham/RD-5R/OpenGD77/opengd77xfer/lib/python3.8/site-packages/ruamel/yaml/main.py", line 451, in dump
    return self.dump_all([data], stream, _kw, transform=transform)
  File "/home/bzed/workspace/ham/RD-5R/OpenGD77/opengd77xfer/lib/python3.8/site-packages/ruamel/yaml/main.py", line 465, in dump_all
    self._context_manager.dump(data)
  File "/home/bzed/workspace/ham/RD-5R/OpenGD77/opengd77xfer/lib/python3.8/site-packages/ruamel/yaml/main.py", line 817, in dump
    self._yaml.representer.represent(data)
  File "/home/bzed/workspace/ham/RD-5R/OpenGD77/opengd77xfer/lib/python3.8/site-packages/ruamel/yaml/representer.py", line 85, in represent
    node = self.represent_data(data)
  File "/home/bzed/workspace/ham/RD-5R/OpenGD77/opengd77xfer/lib/python3.8/site-packages/ruamel/yaml/representer.py", line 112, in represent_data
    node = self.yaml_representers[data_types[0]](self, data)
  File "/home/bzed/workspace/ham/RD-5R/OpenGD77/opengd77xfer/lib/python3.8/site-packages/opengd77/codeplug.py", line 509, in to_yaml
    return representer.represent_dict(node.as_dict())
  File "/home/bzed/workspace/ham/RD-5R/OpenGD77/opengd77xfer/lib/python3.8/site-packages/opengd77/codeplug.py", line 501, in as_dict
    'zones': [x for x in self.zones if  x.valid],
  File "/home/bzed/workspace/ham/RD-5R/OpenGD77/opengd77xfer/lib/python3.8/site-packages/opengd77/codeplug.py", line 501, in <listcomp>
    'zones': [x for x in self.zones if  x.valid],
  File "/home/bzed/workspace/ham/RD-5R/OpenGD77/opengd77xfer/lib/python3.8/site-packages/opengd77/codeplug.py", line 330, in __iter__
    yield self[i]
  File "/home/bzed/workspace/ham/RD-5R/OpenGD77/opengd77xfer/lib/python3.8/site-packages/opengd77/codeplug.py", line 315, in __getitem__
    z = Zone(chunk)
  File "/home/bzed/workspace/ham/RD-5R/OpenGD77/opengd77xfer/lib/python3.8/site-packages/opengd77/codeplug.py", line 59, in __init__
    super().__init__(data, **kw)
  File "/home/bzed/workspace/ham/RD-5R/OpenGD77/opengd77xfer/lib/python3.8/site-packages/opengd77/binvar.py", line 44, in __init__
    raise ValueError(f"need data of len={self.SIZE}, got {l}")
ValueError: need data of len=176, got 48

(I've hacked the ValueError to show the size it actually got).

The read codeplug binary is here:
https://shell.bzed.at/~bzed/.publish/2020-09-02-xYOPd9hS7fs/defaults.bin

Converting it fails with the same error, so I guess you should either be able to fix the conversion, or reading the data was not successful. I'm happy to help, its just too late to read and debug your code now.

@bzed
Copy link
Author

bzed commented Sep 1, 2020

Cleaning the codeplug with opengd77cps and writing it fixed this issue.
Maybe there was something form the original codeplug left in the eeprom. No idea. Seems to work fine now.

@kzyapkov
Copy link
Owner

kzyapkov commented Sep 2, 2020

My GD-77 and BF DM860 spent an average of 2.4 seconds running the original firmware. I tried to support the original format, but now I think this is useless and would only complicate the code. I need an OpenGD77 tool.

I'll come back to this project and implement import soon, I hope.

@kzyapkov kzyapkov closed this as completed Sep 2, 2020
@bzed
Copy link
Author

bzed commented Sep 2, 2020

@kzyapkov my rd-5r was actually running opengd77 already, but for whatever reason it seems it still had some broken codeplug from the oridinal firmware...

@kzyapkov
Copy link
Owner

kzyapkov commented Sep 2, 2020

Understood. Zones are the one thing OpenGD77 changes in the original codeplug format I think, and there's a funky addressing/counting scheme I don't quite understand. My code fails because zones in your codeplug only support 16 channels. I'll try to make it fail more gracefully (meaningful error) or migrate the format.

@kzyapkov kzyapkov reopened this Sep 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants