[chirp_devel] Porting Sainsonic RST599
Hi! I'm new here and I feel like working on Sainsonic RST599 [1] to avoid duplicate work.
So far I have a standalone code [2] that can download channels (rx,tx,name) and the rest that I didn't figure out yet. Uploading also seems straightforward. Reading command is 'R' (followed by offset and size), writing is 'W'. The radio restarts itself after short period of inactivity :(
32 bytes (actually 240 bits) at 4000 store bitmask of assigned memory channels.
0016-14b6 - 240 memory channels (22 bytes per channel)
Then original software reads something in 16 byte blocks 14e0 - 19e0+16 and 4100 - 4510+16. Data don't look aligned on 16 byte boundary...so I guess just convenience.
I'm hesitatting what would be the closest model from existing ones. Any suggestion?
P.S. Is there an utility BCD decoding code in chirp common to all models? I failed to find it.
Footnotes: [1] http://chirp.danplanet.com/issues/2909
[2] https://gist.github.com/mlt/d2e41c9855c2c993ab89
Hi! I'm new here and I feel like working on Sainsonic RST599 [1] to avoid duplicate work.
Welcome!
P.S. Is there an utility BCD decoding code in chirp common to all models? I failed to find it.
We have this in bitwise. Look for drivers in the tree that use "lbcd" or "bbcd" types in memory structure definitions. If that works for you, defining a structure to pythonify a data blob will definitely be easiest.
--Dan
On Mon, Oct 12, 2015 at 3:39 PM, Dan Smith via chirp_devel chirp_devel@intrepid.danplanet.com wrote:
P.S. Is there an utility BCD decoding code in chirp common to all models? I failed to find it.
We have this in bitwise. Look for drivers in the tree that use "lbcd" or "bbcd" types in memory structure definitions. If that works for you, defining a structure to pythonify a data blob will definitely be easiest.
Hey!
Thank you! I've figured it out and I can read the majority of settings now. I have best practices questions to catch up...
Do we try to maintain compatibility with original software for radios? I noticed that original software stores file in a "messed up" way with blocks order changed. Right now, I try to follow memory addresses and use sparse memmap by using its __setitem__ via subscripts and partially overwriting some data from there. Is it okay thing to do as I didn't see any other drivers doing that? It is easier to work with rather than doing some math for auxiliary block. It is way faster than copying entire memory full of unused segments and I can skip fetching non-set channels as I know bitmask.
Is there (or planned) general purpose table editor widget? It is somewhat ugly to edit FM presets as it is done now. And there is also Automatic Repeaters Offset settings, tone codes, and 4(!) lines of power-on welcome message with various font sizes and alignment. It looks somewhat cluttered now. Some generic table widget would be better. Did I miss it? Is there an example?
Is there an extensive list (wiki?) with all common namings? I mean like how to name things in that data blob as I see code outside of drivers uses some... like autorpt. What would I name frequency ranges? I guess more generic question is: are we trying to achieve cross compatibility like loading settings (besides channels) from other radios?
Also I see some non-DRY code in drivers regarding charset filtering, block reading/writing and checking things (send something & expect 0x06). There are tons of similar looking code between Wouxon and Baofeng. How shall I approach it? Copy/paste and modify as necessary for now? I feel like since I'm writing the new one, I still can do it right. Perhaps it would be nice to have an extra class to derive from that would define ACK for write commands, and form read command via struct "<cHb" and check "Hb" part in return.
Do we try to maintain compatibility with original software for radios? I noticed that original software stores file in a "messed up" way with blocks order changed. Right now, I try to follow memory addresses and use sparse memmap by using its __setitem__ via subscripts and partially overwriting some data from there. Is it okay thing to do as I didn't see any other drivers doing that? It is easier to work with rather than doing some math for auxiliary block. It is way faster than copying entire memory full of unused segments and I can skip fetching non-set channels as I know bitmask.
In general, we store things as a raw dump of the memory in a file. This is sometimes the same as factory software, but often is not. Whatever is convenient is fine. We also often support read-only imports from factory software, which is an easier option in many cases. But, whatever you want to do is fine, as long as you can detect your model's files and they don't cause any false positives with others. We also need to commit to one format and not break stored files that people have from build to build.
Is there (or planned) general purpose table editor widget? It is somewhat ugly to edit FM presets as it is done now. And there is also Automatic Repeaters Offset settings, tone codes, and 4(!) lines of power-on welcome message with various font sizes and alignment. It looks somewhat cluttered now. Some generic table widget would be better. Did I miss it? Is there an example?
I don't think a table view of the settings would be something I'd find more appealing, personally, and I think it would be hard to represent some of the things we have to provide in that fashion. But, you're welcome to work up a proof of concept and try to convince us that it's a better approach.
Is there an extensive list (wiki?) with all common namings? I mean like how to name things in that data blob as I see code outside of drivers uses some... like autorpt. What would I name frequency ranges? I guess more generic question is: are we trying to achieve cross compatibility like loading settings (besides channels) from other radios?
I'm not sure what you're asking exactly. The memory structure definitions you provide to bitwise are really private names and don't need to be standardized for any reason.
Also I see some non-DRY code in drivers regarding charset filtering, block reading/writing and checking things (send something & expect 0x06). There are tons of similar looking code between Wouxon and Baofeng. How shall I approach it? Copy/paste and modify as necessary for now? I feel like since I'm writing the new one, I still can do it right. Perhaps it would be nice to have an extra class to derive from that would define ACK for write commands, and form read command via struct "<cHb" and check "Hb" part in return.
The problem here is that many of these drivers were written by multiple people over many years. Since most of the drivers were written by people borrowing radios, there was no opportunity to refactor a driver that turned out to offer some commonality *and* test that both still worked after that occurred. There is a ton of little stuff like that where someone borrows a piece from a yaseu driver and a piece from a wouxun driver to make a foobar driver. The potential for breakage trying to refactor the two existing into something upon which the third can be built on is high.
It would be nice if we had access to all the models we support so we could clean things up whenever we find commonalities and test that we didn't break anything. That's just not a reality.
If you have the ability to test multiple drivers after doing a refactor, then that's great. But please don't speculatively refactor something that "should work" and ask for it to be applied. Many of these radios are very particular about timing and other related things and breaking things and finding out about it in six months when someone with a rare model realizes it's broken is a bad place to be.
--Dan
participants (2)
-
Dan Smith
-
Mikhail Titov