<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px"><div id="yui_3_16_0_1_1418596573112_8560" dir="ltr"><span id="yui_3_16_0_1_1418596573112_8597">looks like there is a "channel active" bit flag for each channel starting at 0xCB80 (+10h in the chirp saved image), and then repeated again at 0xCC00 (+10h). The first block appears to be the one which is effective in the radio. Unsure why the second block... Experimentation may reveal why.</span></div><div id="yui_3_16_0_1_1418596573112_8560" dir="ltr"><span><br></span></div><div id="yui_3_16_0_1_1418596573112_8560" dir="ltr">Also, to make offsets simpler to deal with, I'm thinking of moving storage of the radio ident string to the end of the chirp image. So 0x10000 main image+ 0x10 ident string. Currently it's 0x10 ident + 0xFF00 (due to the skip of first 0x100 bytes - mimicing the oem sw read).</div><div id="yui_3_16_0_1_1418596573112_8560" dir="ltr"><br></div><div id="yui_3_16_0_1_1418596573112_8560" dir="ltr">-Jens</div><br> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;" id="yui_3_16_0_1_1418596573112_8841"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;" id="yui_3_16_0_1_1418596573112_8840"> <div dir="ltr" id="yui_3_16_0_1_1418596573112_8839"> <hr size="1" id="yui_3_16_0_1_1418596573112_8838"> <font size="2" face="Arial" id="yui_3_16_0_1_1418596573112_8842"> <b><span style="font-weight:bold;">From:</span></b> Jens Jensen <af5mi@yahoo.com><br> <b><span style="font-weight: bold;">To:</span></b> "chirp_devel@intrepid.danplanet.com" <chirp_devel@intrepid.danplanet.com> <br> <b><span style="font-weight: bold;">Sent:</span></b> Sunday, December 14, 2014 5:03 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [chirp_devel] Could use a few hints on tyt - th_9800<br> </font> </div> <div class="y_msg_container" id="yui_3_16_0_1_1418596573112_9269"><br><div id="yiv7632984966"><div id="yui_3_16_0_1_1418596573112_9271"><div style="color:#000;background-color:#fff;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px;" id="yui_3_16_0_1_1418596573112_9270"><div dir="ltr" id="yiv7632984966yui_3_16_0_1_1418596573112_2603"><span>Hi James.</span></div><div dir="ltr" id="yiv7632984966yui_3_16_0_1_1418596573112_2603"><span id="yiv7632984966yui_3_16_0_1_1418596573112_2655">Ok, I too have got this started - let's review and merge our work.</span></div><div dir="ltr" id="yiv7632984966yui_3_16_0_1_1418596573112_2603">My email randomly addresses a few of your questions.</div><div dir="ltr" id="yiv7632984966yui_3_16_0_1_1418596573112_2603"><br clear="none"></div><div dir="ltr" id="yiv7632984966yui_3_16_0_1_1418596573112_2603">Here is my partially functional starter th9800.py, refactored a bit from Tom's start, and a few upload/download bits borrowed from other tyt radio modules.</div><div dir="ltr" id="yiv7632984966yui_3_16_0_1_1418596573112_2603"><span><br clear="none"></span></div><div dir="ltr" id="yiv7632984966yui_3_16_0_1_1418596573112_2603"><span id="yiv7632984966yui_3_16_0_1_1418596573112_2618"><a rel="nofollow" shape="rect" id="yiv7632984966yui_3_16_0_1_1418596573112_2617" target="_blank" href="https://gist.github.com/zerog2k/2ad80b5b58a924a98bdb">https://gist.github.com/zerog2k/2ad80b5b58a924a98bdb</a><br clear="none"></span></div><div dir="ltr" id="yiv7632984966yui_3_16_0_1_1418596573112_2603"><br clear="none"></div><div dir="ltr" id="yiv7632984966yui_3_16_0_1_1418596573112_2603">Since the file-backed and radio-clone classes share quite a bit of commonality, and I'm sure the oem .dat file and the radios memory are possibly identical, only differing by the offsets, and the way you transfer them, I have factored most of this out to a common base class, TYTTH9800Base, then subclassed into the file-backed class and the radio-class, so that only the necessary specific parts are in child classes.</div><div dir="ltr" id="yiv7632984966yui_3_16_0_1_1418596573112_2603"><br clear="none"></div><div dir="ltr" id="yiv7632984966yui_3_16_0_1_1418596573112_2603">Since the memory map will probably be the same, with just differences in offset, I have managed that with a trick to the way the memory string is read, using a format string to change up the offset where it starts applying the map to the image.</div><div dir="ltr" id="yiv7632984966yui_3_16_0_1_1418596573112_2603"><br clear="none"></div><div dir="ltr" id="yiv7632984966yui_3_16_0_1_1418596573112_2603">This experimental th9800.py module will download and upload a memory image, which we can start using to further work out the channel, and later - settings, maps.</div><div dir="ltr" id="yiv7632984966yui_3_16_0_1_1418596573112_2603"><br clear="none"></div><div dir="ltr" id="yiv7632984966yui_3_16_0_1_1418596573112_2603"><b>On radio upload/download.</b></div><div class="yiv7632984966" dir="ltr" id="yiv7632984966yui_3_16_0_1_1418596573112_2603" style="">here are serial session capture logs of oem software:</div><div class="yiv7632984966" dir="ltr" id="yiv7632984966yui_3_16_0_1_1418596573112_2603" style=""><a rel="nofollow" shape="rect" class="yiv7632984966" id="yiv7632984966yui_3_16_0_1_1418596573112_2749" target="_blank" href="http://chirp.danplanet.com/issues/1353#note-14" style="">http://chirp.danplanet.com/issues/1353#note-14</a><br clear="none" class="yiv7632984966" style=""></div><div class="yiv7632984966" id="yiv7632984966yui_3_16_0_1_1418596573112_5236" style=""><br clear="none" class="yiv7632984966" style=""></div><div class="yiv7632984966" dir="ltr" id="yiv7632984966yui_3_16_0_1_1418596573112_5237" style="">An interesting observation is that the oem software skips the first 0x100 bytes on download, but skips a different section (near the end) on upload:</div><div class="yiv7632984966" dir="ltr" id="yiv7632984966yui_3_16_0_1_1418596573112_5237" style=""><div class="yiv7632984966" dir="ltr" id="yiv7632984966yui_3_16_0_1_1418596573112_5237" style=""><br clear="none"></div><div class="yiv7632984966" dir="ltr" id="yiv7632984966yui_3_16_0_1_1418596573112_5237" style="">download:</div><div class="yiv7632984966" dir="ltr" id="yiv7632984966yui_3_16_0_1_1418596573112_5237" style="">0x0100 - 0xFFFF</div><div class="yiv7632984966" dir="ltr" id="yiv7632984966yui_3_16_0_1_1418596573112_5237" style="">(also, on download before the main block, oem sw reads an 80h block at 0xCC00. Wild guess that this might have frequency ranges or capabilities - not sure why this needs to be read early. We'll probably find out later.)</div><div class="yiv7632984966" dir="ltr" id="yiv7632984966yui_3_16_0_1_1418596573112_5237" style=""><br clear="none"></div><div class="yiv7632984966" dir="ltr" id="yiv7632984966yui_3_16_0_1_1418596573112_5237" style="">upload:</div><div class="yiv7632984966" dir="ltr" id="yiv7632984966yui_3_16_0_1_1418596573112_5237" style="">0x0000 - 0xF3FF</div><div class="yiv7632984966" dir="ltr" id="yiv7632984966yui_3_16_0_1_1418596573112_5237" style="">0xFF00 - 0xFFFF</div><div class="yiv7632984966" dir="ltr" id="yiv7632984966yui_3_16_0_1_1418596573112_5237" style=""><br clear="none"></div></div><div class="yiv7632984966" dir="ltr" id="yiv7632984966yui_3_16_0_1_1418596573112_5237" style="">I'm guessing these other sections might contain some special information. We probably want to tread with caution, as it could be something simple, or could be something dangerous to manipulate (especially between radios) such as a calibration or configuration data block, or other individual-radio-specific data.</div><div class="yiv7632984966" dir="ltr" id="yiv7632984966yui_3_16_0_1_1418596573112_5237" style=""><br clear="none"></div><div class="yiv7632984966" dir="ltr" id="yiv7632984966yui_3_16_0_1_1418596573112_5237" style=""><br clear="none"></div><div dir="ltr" id="yiv7632984966yui_3_16_0_1_1418596573112_2603"><b id="yiv7632984966yui_3_16_0_1_1418596573112_7200">Regarding the dev process:</b></div><div dir="ltr" id="yiv7632984966yui_3_16_0_1_1418596573112_2603">basically, chirp uses mercurial "message queue" extension to do patch management. This allows you to work on things and pop/push patches which can be emailed to devel list for review and merging. (I totally prefer github fork-n-pull-request model for so many reasons - but that's probably another thread.) Review:</div><div dir="ltr" id="yiv7632984966yui_3_16_0_1_1418596573112_2603"><a rel="nofollow" shape="rect" id="yiv7632984966yui_3_16_0_1_1418596573112_2932" target="_blank" href="http://chirp.danplanet.com/projects/chirp/wiki/DevelopersProcess">http://chirp.danplanet.com/projects/chirp/wiki/Developers</a></div><div dir="ltr" id="yiv7632984966yui_3_16_0_1_1418596573112_2603"><a rel="nofollow" shape="rect" id="yiv7632984966yui_3_16_0_1_1418596573112_2903" target="_blank" href="http://chirp.danplanet.com/projects/chirp/wiki/DevelopersProcess">http://chirp.danplanet.com/projects/chirp/wiki/DevelopersProcess</a><br clear="none"></div><div id="yiv7632984966yui_3_16_0_1_1418596573112_2603"> </div><div id="yiv7632984966yui_3_16_0_1_1418596573112_2603"><br clear="none"></div><div dir="ltr" id="yiv7632984966yui_3_16_0_1_1418596573112_2603">If you want to talk offline to sync up so we can break up the work, you can email me off the list and we can chat on skype or phone...</div><div dir="ltr" id="yiv7632984966yui_3_16_0_1_1418596573112_2603"><br clear="none"></div><div dir="ltr" id="yiv7632984966yui_3_16_0_1_1418596573112_2603">-Jens</div><div dir="ltr" id="yiv7632984966yui_3_16_0_1_1418596573112_2603"><br clear="none"></div> <div class="qtdSeparateBR"><br><br></div><div class="yiv7632984966yqt4832150168" id="yiv7632984966yqt85034"><div id="yiv7632984966yui_3_16_0_1_1418596573112_2586" style="font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px;"> <div id="yiv7632984966yui_3_16_0_1_1418596573112_2585" style="font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px;"> <div dir="ltr" id="yiv7632984966yui_3_16_0_1_1418596573112_2584"> <hr id="yiv7632984966yui_3_16_0_1_1418596573112_2654" size="1"> <font id="yiv7632984966yui_3_16_0_1_1418596573112_2601" size="2" face="Arial"> <b><span style="font-weight:bold;">From:</span></b> jml <jml@jmlzone.com><br clear="none"> <b><span style="font-weight:bold;">To:</span></b> chirp_devel@intrepid.danplanet.com <br clear="none"> <b><span style="font-weight:bold;">Sent:</span></b> Sunday, December 14, 2014 1:30 PM<br clear="none"> <b><span style="font-weight:bold;">Subject:</span></b> [chirp_devel] Could use a few hints on tyt - th_9800<br clear="none"> </font> </div> <div class="yiv7632984966y_msg_container" id="yiv7632984966yui_3_16_0_1_1418596573112_2602"><br clear="none">Hi,<br clear="none"> Sorry in advance this will be a long email.<br clear="none"><br clear="none">With a little advice from Tom Haward I have gotten started on adding the closing support to the tyt-th9800. First some status and background, then a bunch of questions.<br clear="none"><br clear="none">Status:<br clear="none"> First I do have a tyt9800 and the oem pc (windows xp) software and cable working. I did use portmon and figure out what the radio protocol was.<br clear="none"> I do have the hex dump of my files from the oem software and compared them to what I see in the transfer.<br clear="none"> I have managed to mangle th9800.py to get it to download (on my mac) my radio and hex dump to stdout.<br clear="none"> I have identified some of the memory blocks and bits that Tom did not yet tag in his cut at reading the .dat file.<br clear="none"><br clear="none">Background:<br clear="none"> Its been around 5 years since I did python so I’m a bit rusty, and generally more familiar with C, Perl and TCL (and of course Verilog)<br clear="none"> Being that I hate windows 7 and 8 I decided to go Mac. I find the mac easy since I treat it like linux. I have the mac setup for python with he proper packages to run the script form of chip. (I also have a linux server at my disposal but I am using it for file storage and utilities not Chirp development).<br clear="none"> I am familiar with hg for versioning and have cloned the repository to my mac and even done a pull and update.<br clear="none"><br clear="none">Now for the first of what may be myriad of questions:<br clear="none">1) The channel memory format in the download vs the file are identical, however, the offset is different. So I wanted to re-use the struct that Tom defined and just define a new TH9800_MEM_FORMAT and rename his to TH9800_FILE_FORMAT. I wanted to share the struct but could not figure out how to do that.<br clear="none"><br clear="none">2) Tom Registered as chirp_common.FileBackedRadio, so when I tried to register as chirp_common.CloneModeRaio I got an error so I just added a x to the name of the radio to debug. Obviously I want to share much of his code so I need to better understand how to merge the file IO stuff with with clone stuff.<br clear="none"><br clear="none">3) Other than the template.py is there a cook book or tutorial on how it add things to chirp and how the framework of chirp is preferred to use. eventually I am going to know how to handle the busy lock out on some channels and I want to figure out how to program the 6 shortcut buttons on the face that are in the stat but not supported by the oem software.<br clear="none"><br clear="none">4) When I have used HG in the past I would locally “hg commit” then “hg push”. I am a bit new to how open source software is managed so if I have something worth sharing what is the proper avenue.<br clear="none"><br clear="none">5) I have not yet gotten Toms functions to display the radio data after I have downloaded, but the hex dump to stout is good so I will continue to work on that while I wait for a response, but I think that his functions are in the class TYTTH9800File while the rest of my code is in class TYTTH9800Radio so I will the importing the functions but I think there needs to be some better solution here. Sugegstions?<br clear="none"><br clear="none">Please feel free to point me to additional reading and if someone who is more fluent at python can can take a swag and merging my upload/download with toms code better than I did, I would welcome the help.<br clear="none"><br clear="none">James N1DDK.<br clear="none"><br clear="none">_______________________________________________<br clear="none">chirp_devel mailing list<br clear="none"><a rel="nofollow" shape="rect" id="yiv7632984966yui_3_16_0_1_1418596573112_7205" ymailto="mailto:chirp_devel@intrepid.danplanet.com" target="_blank" href="mailto:chirp_devel@intrepid.danplanet.com">chirp_devel@intrepid.danplanet.com</a><br clear="none"><a rel="nofollow" shape="rect" target="_blank" href="http://intrepid.danplanet.com/mailman/listinfo/chirp_devel">http://intrepid.danplanet.com/mailman/listinfo/chirp_devel</a><br clear="none">Developer docs: <a rel="nofollow" shape="rect" target="_blank" href="http://chirp.danplanet.com/projects/chirp/wiki/Developers">http://chirp.danplanet.com/projects/chirp/wiki/Developers</a><br clear="none"><br clear="none"></div> </div> </div></div> </div></div></div><br><br></div> </div> </div> </div></body></html>