[chirp_devel] chirp_devel Digest, Vol 20, Issue 13

Dan Smith
Wed Jan 2 16:44:19 PST 2013


> I really have no idea how to debug past this.  No knowing Python or
> this code, all I can do is capture the errors and pass along
> out.txt. 

Okay, maybe there was some misunderstanding about the intentions here.
I thought you were looking to learn enough Python to write the driver
(several people have). If not, this may not be a very realistic
endeavor (but read on).

> I've tried commenting out the majority of the code and
> still get the same errors.

I commented out the majority of the code and it seems to get pretty
far. Attached is an updated copy where I did the following:

- Spotted the rtone and ctone fields in your two memories and moved the
  appropriate bits in the structure definition to match
- Guessed about where the dtcs code is stored
- Spotted the "used" bits (which tell us which memories have valid data
  in them) and changed the structure definition to match
- Commented out the code that looks for:
 - skip and pskip bits
 - tuning_step
 - mode
 - duplex
 - power
 - dtcs polarity
 - tone mode

With the attached code, I'm able to open your .img file and see your
first two memories (frequency, tones, alpha labels, and offsets).

If you right-click on one of the memories and choose "Show Raw
Memory" you can see how chirp has parsed the data into the structure
definition. The "Diff Raw Memories" option is pretty handy for sussing
out the differences between two almost-identical memories (and is how I
typically most of my bit sniffing for these).

At a very minimum, the following needs to be done:

 - Finding the tone mode bits (None, Tone, TSQL, DTCS, etc)
 - Finding the mode bits (FM and AM presumably?)
 - Changing set_memory() to match the changes in the structure as needed
 - Removing all the commented-out code that remains after finding this
   stuff
 - Test/fix uploading to the radio

Ideally we'd also find the remaining bits covered by the commented-out
code, but even if we don't, I think it'd be usable with just the above.

I suppose if you're not interested in attempting any of the code stuff,
I can make those changes if you're willing to sniff out the bits. I
normally won't develop by proxy like this, but the radio appears pretty
simplistic, and it's pretty close to usable right now.

I've attached the updated .py file, and included a diff of the changes
I made below. How would you like to proceed? I sense your frustration
with what I expect is a difference of expectations about what this
process would be, but I appreciate the work you've done so far and I
think we're pretty close to having something worth putting into the
tree.

Thanks Drew!

-- 
Dan Smith
www.danplanet.com
KK7DS


% diff -u chirp/icv80.py.orig chirp/icv80.py
--- chirp/icv80.py.orig	2013-01-02 16:31:14.126653149 -0800
+++ chirp/icv80.py	2013-01-02 16:33:17.178657828 -0800
@@ -22,24 +22,16 @@
   ul16 freq;
   ul16 offset;
   char name[5];
-  char junk[2];
   u8 unknown2:2,
      rtone:6;
   u8 unknown3:2,
      ctone:6;
   u8 unknown4:1,
      dtcs:7;
-  u8 tuning_step:4,
-     narrow:1,
-     unknown5:1,
-     duplex:2;
-  u8 unknown6:1,
-     power:2,
-     dtcs_polarity:2,
-     tmode:3;
+  u8 unknown[4];
 } memory[200];
 
-#seekto 0x12E0;
+#seekto 0x0D10;
 u8 used[38];
 
 #seekto 0x1306;
@@ -105,8 +97,8 @@
 
         _mem = self._memobj.memory[number]
         _usd = self._memobj.used[byte]
-        _skp = self._memobj.skips[byte]
-        _psk = self._memobj.pskips[byte]
+        #_skp = self._memobj.skips[byte]
+        #_psk = self._memobj.pskips[byte]
 
         mem = chirp_common.Memory()
         mem.number = number
@@ -124,13 +116,13 @@
         mem.rtone = chirp_common.TONES[_mem.rtone]
         mem.ctone = chirp_common.TONES[_mem.ctone]
         mem.dtcs = chirp_common.DTCS_CODES[_mem.dtcs]
-        mem.tuning_step = TUNING_STEPS[_mem.tuning_step]
-        mem.mode = _mem.narrow and "NFM" or "FM"
-        mem.duplex = DUPLEX[_mem.duplex]
-        mem.power = POWER_LEVELS[_mem.power]
-        mem.dtcs_polarity = DTCS_POLARITY[_mem.dtcs_polarity]
-        mem.tmode = TMODES[_mem.tmode]
-        mem.skip = (_psk & bit and "P") or (_skp & bit and "S") or ""
+        #mem.tuning_step = TUNING_STEPS[_mem.tuning_step]
+        #mem.mode = _mem.narrow and "NFM" or "FM"
+        #mem.duplex = DUPLEX[_mem.duplex]
+        #mem.power = POWER_LEVELS[_mem.power]
+        #mem.dtcs_polarity = DTCS_POLARITY[_mem.dtcs_polarity]
+        #mem.tmode = TMODES[_mem.tmode]
+        #mem.skip = (_psk & bit and "P") or (_skp & bit and "S") or ""
         
         return mem

-------------- next part --------------
A non-text attachment was scrubbed...
Name: icv80.py
Type: text/x-python
Size: 5113 bytes
Desc: not available
Url : http://intrepid.danplanet.com/pipermail/chirp_devel/attachments/20130102/83692827/attachment-0001.py 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
Url : http://intrepid.danplanet.com/pipermail/chirp_devel/attachments/20130102/83692827/attachment-0001.bin 


More information about the chirp_devel mailing list