<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p><span>Implementing </span><font face="Menlo-Regular">get_bank(),
set_bank(), and clear_bank() in the radio class adheres to the
separation-of-concerns principle by adding a level of
abstraction. The radio class "owns" the memory structure, so
it's in charge of the details of how it associates a memory with
a bank. The BankModel class is there for the UI. The UI only
cares about the fact that a memory is associated with a bank,
but couldn't care less how the association is recorded in the
radio's memory.<br>
</font></p>
<p><font face="Menlo-Regular">BTW, did you really mean 0 through 21?
Or, </font><font face="Menlo-Regular">0 through 20, or </font><font
face="Menlo-Regular">1 through 21?</font></p>
<div class="moz-cite-prefix">On 5/29/2023 12:38 PM, Joseph Scanlan
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:04605C79-A20A-4650-BA41-7C92FEF9C726@n7xsd.us">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<span>Why did you choose to implement </span><font
face="Menlo-Regular">get_bank(), set_bank(), and clear_bank() in
the radio class instead of the bank model class?</font>
<div><font face="Menlo-Regular"><br>
</font></div>
<div><font face="Menlo-Regular">I could add this to my description
instead:</font></div>
<div><font face="Menlo-Regular"><br>
</font></div>
<blockquote style="margin: 0 0 0 40px; border: none; padding:
0px;"><font face="Menlo-Regular">For example, with 4 banks, if
we have bank capacity’s of [21, 4, 0, 3] then </font><span
style="font-family: Menlo-Regular;">memories 0 through 21
belong to Bank 1, memories 22 through 25 belong to Bank 2, </span><span
style="font-family: Menlo-Regular;">memories 26 through 28
belong to Bank 4, and the remaining memories don’t </span><span
style="font-family: Menlo-Regular;">belong to any bank.</span></blockquote>
<font face="Menlo-Regular">
<div><font face="Menlo-Regular"><br>
</font></div>
With land mobile radios, the radio user can’t change much. The
radio tech programs the radios. The typical ham will fill both
roles.</font>
<div><font face="Menlo-Regular"><br>
</font></div>
<div><font face="Menlo-Regular">When a tech uses the Icom
software, they see a page for each bank and can add, delete,
move, and edit frequencies in the bank. This gives the tech
the ability to place channels in any order.</font><span
style="font-family: Menlo-Regular;"> They don’t see the
entire list of memories at once.</span><font
face="Menlo-Regular"><br>
</font>
<div>
<div><br>
<blockquote type="cite">
<div>On May 28, 2023, at 20:21, Craig Jones via
chirp_devel <a class="moz-txt-link-rfc2396E" href="mailto:chirp_devel@intrepid.danplanet.com"><chirp_devel@intrepid.danplanet.com></a>
wrote:</div>
<br class="Apple-interchange-newline">
<div>
<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8">
<div>
<p>Do I understand correctly that you could add this
to the description?<br>
</p>
<blockquote>
<p>For example, if the banks[16] array contains
[2,3,5,7,0,0,0,0,0,...] then that means that
memory[0:2] belong to Bank A, memory[2:5] belong
to Bank B, memory[5:10] to C, memory[10:17] to D,
and memory[17:] aren't in any bank.</p>
</blockquote>
<p>If so, that's wild, with wacky implications:</p>
<ul>
<li>I don't see a logical location number in the mem
struct, so that means the "Location Number" of
every channel is constantly changing when you
add/remove a channel to a bank?</li>
<li>It also means the user can't control the order
of the memory locations?</li>
<li>At first, I was thinking that you would keep a
cross-indexing array in your bank model which gets
populated on the way in (download or file load)
and interpreted on the way out (upload or save),
but I guess you'll actually have to rearrange
memory with every bank change if the UI is going
to be able to keep up in real time.</li>
<li>BTW, if my example is correct, the "capacity" is
misleading. I'd change it to "current_count" or
current_size<br>
</li>
</ul>
<div class="moz-cite-prefix">On 5/28/2023 2:55 PM,
Joseph Scanlan wrote:<br>
</div>
<blockquote type="cite"
cite="mid:FB8916FB-4FE7-4805-82BE-58BB3EC29E1D@n7xsd.us">
<meta http-equiv="content-type" content="text/html;
charset=UTF-8">
Here is my class description. Does it make at least
a little sense to someone who hasn’t spent time with
the driver?
<div><br>
</div>
<div>
<div style="margin: 0px; font-style: normal;
font-variant-caps: normal; font-stretch: normal;
line-height: normal; font-size-adjust: none;
font-kerning: auto; font-variant-alternates:
normal; font-variant-ligatures: normal;
font-variant-numeric: normal;
font-variant-east-asian: normal;
font-variant-position: normal;
font-feature-settings: normal;
font-optical-sizing: auto;
font-variation-settings: normal;"><span
style="font-variant-ligatures:
no-common-ligatures;"> </span><span
style="font-variant-ligatures:
no-common-ligatures;">"""</span></div>
<div style="margin: 0px; font-style: normal;
font-variant-caps: normal; font-stretch: normal;
line-height: normal; font-size-adjust: none;
font-kerning: auto; font-variant-alternates:
normal; font-variant-ligatures: normal;
font-variant-numeric: normal;
font-variant-east-asian: normal;
font-variant-position: normal;
font-feature-settings: normal;
font-optical-sizing: auto;
font-variation-settings: normal;"><span
style="font-variant-ligatures:
no-common-ligatures;"> The Icom land mobile
bank model.</span></div>
<div style="margin: 0px; font-style: normal;
font-variant-caps: normal; font-stretch: normal;
line-height: normal; font-size-adjust: none;
font-kerning: auto; font-variant-alternates:
normal; font-variant-ligatures: normal;
font-variant-numeric: normal;
font-variant-east-asian: normal;
font-variant-position: normal;
font-feature-settings: normal;
font-optical-sizing: auto;
font-variation-settings: normal; min-height:
16px;"><span style="font-variant-ligatures:
no-common-ligatures"></span><br>
</div>
<div style="margin: 0px; font-style: normal;
font-variant-caps: normal; font-stretch: normal;
line-height: normal; font-size-adjust: none;
font-kerning: auto; font-variant-alternates:
normal; font-variant-ligatures: normal;
font-variant-numeric: normal;
font-variant-east-asian: normal;
font-variant-position: normal;
font-feature-settings: normal;
font-optical-sizing: auto;
font-variation-settings: normal;"><span
style="font-variant-ligatures:
no-common-ligatures;"> The radio stores
bank capacity in an array of 16 bit, unsigned</span></div>
<div style="margin: 0px; font-style: normal;
font-variant-caps: normal; font-stretch: normal;
line-height: normal; font-size-adjust: none;
font-kerning: auto; font-variant-alternates:
normal; font-variant-ligatures: normal;
font-variant-numeric: normal;
font-variant-east-asian: normal;
font-variant-position: normal;
font-feature-settings: normal;
font-optical-sizing: auto;
font-variation-settings: normal;"><span
style="font-variant-ligatures:
no-common-ligatures;"> integers. There is
no other mapping. This implies</span></div>
<div style="margin: 0px; font-style: normal;
font-variant-caps: normal; font-stretch: normal;
line-height: normal; font-size-adjust: none;
font-kerning: auto; font-variant-alternates:
normal; font-variant-ligatures: normal;
font-variant-numeric: normal;
font-variant-east-asian: normal;
font-variant-position: normal;
font-feature-settings: normal;
font-optical-sizing: auto;
font-variation-settings: normal;"><span
style="font-variant-ligatures:
no-common-ligatures;"> - memories in a
bank are contiguous,</span></div>
<div style="margin: 0px; font-style: normal;
font-variant-caps: normal; font-stretch: normal;
line-height: normal; font-size-adjust: none;
font-kerning: auto; font-variant-alternates:
normal; font-variant-ligatures: normal;
font-variant-numeric: normal;
font-variant-east-asian: normal;
font-variant-position: normal;
font-feature-settings: normal;
font-optical-sizing: auto;
font-variation-settings: normal;"><span
style="font-variant-ligatures:
no-common-ligatures;"> - memories in a
bank are in the order that they apear in the</span></div>
<div style="margin: 0px; font-style: normal;
font-variant-caps: normal; font-stretch: normal;
line-height: normal; font-size-adjust: none;
font-kerning: auto; font-variant-alternates:
normal; font-variant-ligatures: normal;
font-variant-numeric: normal;
font-variant-east-asian: normal;
font-variant-position: normal;
font-feature-settings: normal;
font-optical-sizing: auto;
font-variation-settings: normal;"><span
style="font-variant-ligatures:
no-common-ligatures;"> "memory" array,</span></div>
<div style="margin: 0px; font-style: normal;
font-variant-caps: normal; font-stretch: normal;
line-height: normal; font-size-adjust: none;
font-kerning: auto; font-variant-alternates:
normal; font-variant-ligatures: normal;
font-variant-numeric: normal;
font-variant-east-asian: normal;
font-variant-position: normal;
font-feature-settings: normal;
font-optical-sizing: auto;
font-variation-settings: normal;"><span
style="font-variant-ligatures:
no-common-ligatures;"> - each memory can
only be in one bank,</span></div>
<div style="margin: 0px; font-style: normal;
font-variant-caps: normal; font-stretch: normal;
line-height: normal; font-size-adjust: none;
font-kerning: auto; font-variant-alternates:
normal; font-variant-ligatures: normal;
font-variant-numeric: normal;
font-variant-east-asian: normal;
font-variant-position: normal;
font-feature-settings: normal;
font-optical-sizing: auto;
font-variation-settings: normal;"><span
style="font-variant-ligatures:
no-common-ligatures;"> - all memories not
in a bank are at the end of the "memory"
array.</span></div>
<div style="margin: 0px; font-style: normal;
font-variant-caps: normal; font-stretch: normal;
line-height: normal; font-size-adjust: none;
font-kerning: auto; font-variant-alternates:
normal; font-variant-ligatures: normal;
font-variant-numeric: normal;
font-variant-east-asian: normal;
font-variant-position: normal;
font-feature-settings: normal;
font-optical-sizing: auto;
font-variation-settings: normal;"><span
style="font-variant-ligatures:
no-common-ligatures;"> Here, "memory" array
refers to the struct in "MEM_FORMAT".</span></div>
<div style="margin: 0px; font-style: normal;
font-variant-caps: normal; font-stretch: normal;
line-height: normal; font-size-adjust: none;
font-kerning: auto; font-variant-alternates:
normal; font-variant-ligatures: normal;
font-variant-numeric: normal;
font-variant-east-asian: normal;
font-variant-position: normal;
font-feature-settings: normal;
font-optical-sizing: auto;
font-variation-settings: normal;"><span
style="font-variant-ligatures:
no-common-ligatures;"> “”"</span></div>
<div style="margin: 0px; font-style: normal;
font-variant-caps: normal; font-stretch: normal;
line-height: normal; font-size-adjust: none;
font-kerning: auto; font-variant-alternates:
normal; font-variant-ligatures: normal;
font-variant-numeric: normal;
font-variant-east-asian: normal;
font-variant-position: normal;
font-feature-settings: normal;
font-optical-sizing: auto;
font-variation-settings: normal;"><span
style="font-variant-ligatures:
no-common-ligatures;"><br>
</span></div>
<div style="margin: 0px; font-style: normal;
font-variant-caps: normal; font-stretch: normal;
line-height: normal; font-size-adjust: none;
font-kerning: auto; font-variant-alternates:
normal; font-variant-ligatures: normal;
font-variant-numeric: normal;
font-variant-east-asian: normal;
font-variant-position: normal;
font-feature-settings: normal;
font-optical-sizing: auto;
font-variation-settings: normal;"><span
style="font-variant-ligatures:
no-common-ligatures;">Do all models look the
same in the banks tab? This is what I see:</span></div>
<div style="margin: 0px; font-style: normal;
font-variant-caps: normal; font-stretch: normal;
line-height: normal; font-size-adjust: none;
font-kerning: auto; font-variant-alternates:
normal; font-variant-ligatures: normal;
font-variant-numeric: normal;
font-variant-east-asian: normal;
font-variant-position: normal;
font-feature-settings: normal;
font-optical-sizing: auto;
font-variation-settings: normal;"><span
style="font-variant-ligatures:
no-common-ligatures;"><br>
</span></div>
<div><span style="font-variant-ligatures:
no-common-ligatures"><span
id="cid:part1.fD6AZEpx.mdYJvDVP@k6nnl.com"><Banks
tab.png></span></span></div>
<div><span style="font-variant-ligatures:
no-common-ligatures"><br>
</span></div>
<div><span style="font-variant-ligatures:
no-common-ligatures">Thanks for the spelling
correction.</span></div>
<div><br>
<blockquote type="cite">
<div>On May 24, 2023, at 15:00, Craig Jones
via chirp_devel <a
class="moz-txt-link-rfc2396E"
href="mailto:chirp_devel@intrepid.danplanet.com"
moz-do-not-send="true"><chirp_devel@intrepid.danplanet.com></a>
wrote:</div>
<br class="Apple-interchange-newline">
<div>
<meta http-equiv="Content-Type"
content="text/html; charset=UTF-8">
<div>
<p>I was wondering what "capacity" meant.
So, if that's just the count, where is
the actual linkage between the bank and
the memories? Anyway, the Anytone model
I'm working on right now is the same
(each mem is limited to one bank, or
none):</p>
<div style="color: #d6deeb;background-color: #000000;font-family: 'Cascadia Code', Consolas, 'Courier New', monospace;font-weight: normal;font-size: 12px;line-height: 16px;white-space: pre;"><div><span style="color: #c792ea;font-style: italic;">class</span><span style="color: #d6deeb;"> </span><span style="color: #ffcb8b;">AnytoneBankModel</span><span style="color: #d6deeb;">(</span><span style="color: #addb67;">chirp_common</span><span style="color: #d6deeb;">.</span><span style="color: #addb67;">BankModel</span><span style="color: #d6deeb;">):</span></div><div><span style="color: #d6deeb;"> </span><span style="color: #d9f5dd;">"""</span></div><div><span style="color: #ecc48d;"> The Anytone bank model, for the radios that support it, is that a memory</span></div><div><span style="color: #ecc48d;"> channel can only belong to one bank at a time. There are 10 banks (A-J </span></div><div><span style="color: #ecc48d;"> with no alternate names). The mapping is done in a block of bytes that </span></div><div><span style="color: #ecc48d;"> correspond to the 750 memories (one byte per memory). The possible values </span></div><div><span style="color: #ecc48d;"> are 0-9 (A-J) or 15 (x0F) for "off".</span></div><div><span style="color: #ecc48d;"> </span><span style="color: #d9f5dd;">"""</span></div>
<div><span style="color: #d6deeb;"> </span><span style="color: #c792ea;font-style: italic;">def</span><span style="color: #d6deeb;"> </span><span style="color: #82aaff;">__init__</span><span style="color: #d9f5dd;">(</span><span style="color: #7fdbca;">self</span><span style="color: #d6deeb;">, </span><span style="color: #7fdbca;">radio</span><span style="color: #d6deeb;">, </span><span style="color: #7fdbca;">name</span><span style="color: #76aba8;">=</span><span style="color: #d9f5dd;">"</span><span style="color: #ecc48d;">Banks</span><span style="color: #d9f5dd;">"</span><span style="color: #d6deeb;">, </span><span style="color: #7fdbca;">num_banks</span><span style="color: #76aba8;">=</span><span style="color: #f78c6c;">10</span><span style="color: #d6deeb;">, </span><span style="color: #7fdbca;">num_memories</span><span style="color: #76aba8;">=</span><span style="color: #f78c6c;">750</span><span style="color: #d9f5dd;">)</span><span style="color: #d6deeb;">:</span></div><div><span style="color: #d6deeb;"> </span><span style="color: #addb67;">super</span><span style="color: #d6deeb;">(</span><span style="color: #82aaff;">AnytoneBankModel</span><span style="color: #d9f5dd;">,</span><span style="color: #82aaff;"> </span><span style="color: #8eace3;">self</span><span style="color: #d6deeb;">).</span><span style="color: #82aaff;">__init__</span><span style="color: #d6deeb;">(</span><span style="color: #82aaff;">radio</span><span style="color: #d9f5dd;">,</span><span style="color: #82aaff;"> name</span><span style="color: #d6deeb;">)</span></div><div><span style="color: #d6deeb;"> </span><span style="color: #8eace3;">self</span><span style="color: #d6deeb;">._bank_bounds </span><span style="color: #76aba8;">=</span><span style="color: #d6deeb;"> </span><span style="color: #82aaff;">range</span><span style="color: #d6deeb;">(</span><span style="color: #82aaff;">num_banks</span><span style="color: #d6deeb;">)</span></div><div><span style="color: #d6deeb;"> </span><span style="color: #8eace3;">self</span><span style="color: #d6deeb;">._mem_bounds </span><span style="color: #76aba8;">=</span><span style="color: #d6deeb;"> </span><span style="color: #82aaff;">range</span><span style="color: #d6deeb;">(</span><span style="color: #f78c6c;">1</span><span style="color: #d9f5dd;">,</span><span style="color: #82aaff;"> num_memories </span><span style="color: #76aba8;">+</span><span style="color: #82aaff;"> </span><span style="color: #f78c6c;">1</span><span style="color: #d6deeb;">)</span></div><div><span style="color: #d6deeb;"> </span><span style="color: #8eace3;">self</span><span style="color: #d6deeb;">._banks </span><span style="color: #76aba8;">=</span><span style="color: #d6deeb;"> </span><span style="color: #d9f5dd;">[</span></div><div><span style="color: #d6deeb;"> </span><span style="color: #d6deeb;"><span style="color: #d6deeb;"></span><span style="color: #addb67;">chirp_common</span><span style="color: #d6deeb;"></span>.</span><span style="color: #b2ccd6;">Bank</span><span style="color: #d6deeb;">(</span><span style="color: #8eace3;">self</span><span style="color: #d9f5dd;">,</span><span style="color: #82aaff;"> i</span><span style="color: #d9f5dd;">,</span><span style="color: #82aaff;"> string.ascii_uppercase</span><span style="color: #d6deeb;">[</span><span style="color: #82aaff;">i</span><span style="color: #d6deeb;">]) </span><span style="color: #c792ea;font-style: italic;">for</span><span style="color: #d6deeb;"> i </span><span style="color: #c792ea;font-style: italic;">in</span><span style="color: #d6deeb;"> </span><span style="color: #8eace3;">self</span><span style="color: #d6deeb;">._bank_bounds</span></div><div><span style="color: #d6deeb;"> </span><span style="color: #d9f5dd;">]</span></div>
<div><span style="color: #d6deeb;"> </span><span style="color: #c792ea;font-style: italic;">def</span><span style="color: #d6deeb;"> </span><span style="color: #82aaff;">get_num_mappings</span><span style="color: #d9f5dd;">(</span><span style="color: #7fdbca;">self</span><span style="color: #d9f5dd;">)</span><span style="color: #d6deeb;">:</span></div><div><span style="color: #d6deeb;"> </span><span style="color: #c792ea;font-style: italic;">return</span><span style="color: #d6deeb;"> </span><span style="color: #82aaff;">len</span><span style="color: #d6deeb;">(</span><span style="color: #8eace3;">self</span><span style="color: #82aaff;">._banks</span><span style="color: #d6deeb;">)</span></div>
<div><span style="color: #d6deeb;"> </span><span style="color: #c792ea;font-style: italic;">def</span><span style="color: #d6deeb;"> </span><span style="color: #82aaff;">get_mappings</span><span style="color: #d9f5dd;">(</span><span style="color: #7fdbca;">self</span><span style="color: #d9f5dd;">)</span><span style="color: #d6deeb;">:</span></div><div><span style="color: #d6deeb;"> </span><span style="color: #c792ea;font-style: italic;">return</span><span style="color: #d6deeb;"> </span><span style="color: #8eace3;">self</span><span style="color: #d6deeb;">._banks</span></div>
<div><span style="color: #d6deeb;"> </span><span style="color: #c792ea;font-style: italic;">def</span><span style="color: #d6deeb;"> </span><span style="color: #82aaff;">add_memory_to_mapping</span><span style="color: #d9f5dd;">(</span><span style="color: #7fdbca;">self</span><span style="color: #d6deeb;">, </span><span style="color: #7fdbca;">memory</span><span style="color: #d6deeb;">, </span><span style="color: #7fdbca;">bank</span><span style="color: #d9f5dd;">)</span><span style="color: #d6deeb;">:</span></div><div><span style="color: #d6deeb;"> </span><span style="color: #8eace3;">self</span><span style="color: #d6deeb;">._radio.</span><span style="color: #b2ccd6;">set_bank</span><span style="color: #d6deeb;">(</span><span style="color: #82aaff;">memory.number</span><span style="color: #d9f5dd;">,</span><span style="color: #82aaff;"> bank.</span><span style="color: #b2ccd6;">get_index</span><span style="color: #d6deeb;">())</span></div>
<div><span style="color: #d6deeb;"> </span><span style="color: #c792ea;font-style: italic;">def</span><span style="color: #d6deeb;"> </span><span style="color: #82aaff;">remove_memory_from_mapping</span><span style="color: #d9f5dd;">(</span><span style="color: #7fdbca;">self</span><span style="color: #d6deeb;">, </span><span style="color: #7fdbca;">memory</span><span style="color: #d6deeb;">, </span><span style="color: #7fdbca;">mapping</span><span style="color: #d9f5dd;">)</span><span style="color: #d6deeb;">:</span></div><div><span style="color: #d6deeb;"> </span><span style="color: #8eace3;">self</span><span style="color: #d6deeb;">._radio.</span><span style="color: #b2ccd6;">clr_bank</span><span style="color: #d6deeb;">(</span><span style="color: #82aaff;">memory.number</span><span style="color: #d6deeb;">)</span></div>
<div><span style="color: #d6deeb;"> </span><span style="color: #c792ea;font-style: italic;">def</span><span style="color: #d6deeb;"> </span><span style="color: #82aaff;">get_mapping_memories</span><span style="color: #d9f5dd;">(</span><span style="color: #7fdbca;">self</span><span style="color: #d6deeb;">, </span><span style="color: #7fdbca;">bank</span><span style="color: #d9f5dd;">)</span><span style="color: #d6deeb;">:</span></div><div><span style="color: #d6deeb;"> </span><span style="color: #d9f5dd;">"""</span><span style="color: #ecc48d;">Returns a list of all memories assigned to the given bank</span><span style="color: #d9f5dd;">"""</span></div><div><span style="color: #d6deeb;"> memories </span><span style="color: #76aba8;">=</span><span style="color: #d6deeb;"> </span><span style="color: #d9f5dd;">[]</span></div><div><span style="color: #d6deeb;"> </span><span style="color: #c792ea;font-style: italic;">for</span><span style="color: #d6deeb;"> i </span><span style="color: #c792ea;font-style: italic;">in</span><span style="color: #d6deeb;"> </span><span style="color: #8eace3;">self</span><span style="color: #d6deeb;">._mem_bounds:</span></div><div><span style="color: #d6deeb;"> bank_index </span><span style="color: #76aba8;">=</span><span style="color: #d6deeb;"> </span><span style="color: #8eace3;">self</span><span style="color: #d6deeb;">._radio.</span><span style="color: #b2ccd6;">get_bank</span><span style="color: #d6deeb;">(</span><span style="color: #82aaff;">i</span><span style="color: #d6deeb;">)</span></div><div><span style="color: #d6deeb;"> </span><span style="color: #c792ea;font-style: italic;">if</span><span style="color: #d6deeb;"> bank_index </span><span style="color: #c792ea;">is</span><span style="color: #d6deeb;"> </span><span style="color: #c792ea;">not</span><span style="color: #d6deeb;"> </span><span style="color: #ff5874;">None</span><span style="color: #d6deeb;"> </span><span style="color: #c792ea;">and</span><span style="color: #d6deeb;"> bank_index </span><span style="color: #76aba8;">==</span><span style="color: #d6deeb;"> bank.</span><span style="color: #b2ccd6;">get_index</span><span style="color: #d6deeb;">():</span></div><div><span style="color: #d6deeb;"> memories.</span><span style="color: #b2ccd6;">append</span><span style="color: #d6deeb;">(</span><span style="color: #8eace3;">self</span><span style="color: #82aaff;">._radio.</span><span style="color: #b2ccd6;">get_memory</span><span style="color: #d6deeb;">(</span><span style="color: #82aaff;">i</span><span style="color: #d6deeb;">))</span></div><div><span style="color: #d6deeb;"> </span><span style="color: #c792ea;font-style: italic;">return</span><span style="color: #d6deeb;"> memories</span></div>
<div><span style="color: #d6deeb;"> </span><span style="color: #c792ea;font-style: italic;">def</span><span style="color: #d6deeb;"> </span><span style="color: #82aaff;">get_memory_mappings</span><span style="color: #d9f5dd;">(</span><span style="color: #7fdbca;">self</span><span style="color: #d6deeb;">, </span><span style="color: #7fdbca;">memory</span><span style="color: #d9f5dd;">)</span><span style="color: #d6deeb;">:</span></div><div><span style="color: #d6deeb;"> bank_index </span><span style="color: #76aba8;">=</span><span style="color: #d6deeb;"> </span><span style="color: #8eace3;">self</span><span style="color: #d6deeb;">._radio.</span><span style="color: #b2ccd6;">get_bank</span><span style="color: #d6deeb;">(</span><span style="color: #82aaff;">memory.number</span><span style="color: #d6deeb;">)</span></div><div><span style="color: #d6deeb;"> </span><span style="color: #c792ea;font-style: italic;">return</span><span style="color: #d6deeb;"> </span><span style="color: #d9f5dd;">[]</span><span style="color: #d6deeb;"> </span><span style="color: #c792ea;font-style: italic;">if</span><span style="color: #d6deeb;"> bank_index </span><span style="color: #c792ea;">is</span><span style="color: #d6deeb;"> </span><span style="color: #ff5874;">None</span><span style="color: #d6deeb;"> </span><span style="color: #c792ea;font-style: italic;">else</span><span style="color: #d6deeb;"> </span><span style="color: #d9f5dd;">[</span><span style="color: #8eace3;">self</span><span style="color: #d6deeb;">._banks[bank_index]</span><span style="color: #d9f5dd;">]</span></div>
</div>
<div><br class="webkit-block-placeholder">
</div>
<p>BTW, "scrabmler_code" is misspelled. <br>
</p>
<p><br>
</p>
<div class="moz-cite-prefix">On 5/24/2023
1:52 PM, Joseph Scanlan wrote:<br>
</div>
<blockquote type="cite"
cite="mid:1A32FA73-3D49-4E29-A057-EDF42C3E0204@n7xsd.us">
<pre class="moz-quote-pre" wrap="">A memory can not be in more than one bank simultaneously.
A memory need not be in a bank.
Memories are stored sequentially starting from [0]. Each number in banks holds the count of memories in that bank. The count can be 0. So to find the start index of the first memory in a bank we have to sum the sizes of all previous banks.
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">On May 23, 2023, at 14:06, Craig Jones via chirp_devel <a class="moz-txt-link-rfc2396E" href="mailto:chirp_devel@intrepid.danplanet.com" moz-do-not-send="true"><chirp_devel@intrepid.danplanet.com></a> wrote:
I just went through that myself. The first two questions: 1. Can one
memory belong to multiple banks simultaneously? 2. Does every memory
have to belong to at least one bank? The answers determine which base
class you use for the bank model.
You need to implement a bank model so that Chirp can inquire, for
example, which memories are in bank C?
You also need to implement get_bank(), set_bank(), clear_bank() for a
memory (in the radio class), which will be called by the bank model.
Hopefully, that's enough to get you started.
On 5/23/2023 1:47 PM, Joseph Scanlan via chirp_devel wrote:
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">Does anyone have an example that will help me understand MemoryMapping, MappingModel, Bank, and BankModel classes? I’m working on a driver for the Icom IC-F520 land mobile radio.
The F520 has 256 channels and 16 banks. This is how they look in MEM_FORMAT:
struct {
u16 capacity;
} banks[16];
struct {
char name[10];
u32 inhibit:1,
freq_rx:31;
u32 inhibit_tx:1,
freq_tx:31;
u8 rx_tone_off:1,
rx_tone_digital:1,
unk01:6;
u8 rx_tone;
u8 tx_tone_off:1,
tx_tone_digital:1,
unk02:6;
u8 tx_tone;
u8 unk03:3,
tot_on:1,
lockout_repeater:1,
lockout_busy:1,
power_rf:2;
u8 log_in:2,
log_out:2,
unk04:1,
text_on:1,
unk05:1,
two_tone_unk1:1;
u8 unk06:4,
two_tone_unk2:2
auto_reset_a:1,
unk07:1;
u8 narrow:1,
scrambler_on:1,
scrambler_inhibit:1,
compander_on:1,
unk08:4;
u8 unk09;
u8 scrabmler_code;
u16 unk10;
u16 unk11;
u8 unk12:6,
two_tone_index:2;
} memory[256];
_______________________________________________
chirp_devel mailing list
<a class="moz-txt-link-abbreviated moz-txt-link-freetext" href="mailto:chirp_devel@intrepid.danplanet.com" moz-do-not-send="true">chirp_devel@intrepid.danplanet.com</a>
<a class="moz-txt-link-freetext" href="http://intrepid.danplanet.com/mailman/listinfo/chirp_devel" moz-do-not-send="true">http://intrepid.danplanet.com/mailman/listinfo/chirp_devel</a>
Developer docs: <a class="moz-txt-link-freetext" href="http://chirp.danplanet.com/projects/chirp/wiki/Developers" moz-do-not-send="true">http://chirp.danplanet.com/projects/chirp/wiki/Developers</a>
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">--
This email has been checked for viruses by AVG antivirus software.
<a class="moz-txt-link-abbreviated" href="http://www.avg.com/" moz-do-not-send="true">www.avg.com</a>
_______________________________________________
chirp_devel mailing list
<a class="moz-txt-link-abbreviated moz-txt-link-freetext" href="mailto:chirp_devel@intrepid.danplanet.com" moz-do-not-send="true">chirp_devel@intrepid.danplanet.com</a>
<a class="moz-txt-link-freetext" href="http://intrepid.danplanet.com/mailman/listinfo/chirp_devel" moz-do-not-send="true">http://intrepid.danplanet.com/mailman/listinfo/chirp_devel</a>
Developer docs: <a class="moz-txt-link-freetext" href="http://chirp.danplanet.com/projects/chirp/wiki/Developers" moz-do-not-send="true">http://chirp.danplanet.com/projects/chirp/wiki/Developers</a>
</pre>
</blockquote>
</blockquote>
<div
id="DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2"><br>
<table style="border-top: 1px solid
#D3D4DE;">
<tbody>
<tr>
<td style="width: 55px;
padding-top: 13px;"><a
href="http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient"
target="_blank"
moz-do-not-send="true"><img
src="https://s-install.avcdn.net/ipm/preview/icons/icon-envelope-tick-green-avg-v1.png"
alt="" style="width: 46px;
height: 29px;"
moz-do-not-send="true"
width="46" height="29"></a></td>
<td style="width: 470px;
padding-top: 12px; color:
#41424e; font-size: 13px;
font-family: Arial, Helvetica,
sans-serif; line-height: 18px;">Virus-free.<a
href="http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient"
target="_blank" style="color:
#4453ea;"
moz-do-not-send="true">www.avg.com</a></td>
</tr>
</tbody>
</table>
<a
href="x-msg://1/#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2"
width="1" height="1"
moz-do-not-send="true"> </a></div>
</div>
_______________________________________________<br>
chirp_devel mailing list<br>
<a class="moz-txt-link-abbreviated
moz-txt-link-freetext"
href="mailto:chirp_devel@intrepid.danplanet.com"
moz-do-not-send="true">chirp_devel@intrepid.danplanet.com</a><br>
<a class="moz-txt-link-freetext"
href="http://intrepid.danplanet.com/mailman/listinfo/chirp_devel"
moz-do-not-send="true">http://intrepid.danplanet.com/mailman/listinfo/chirp_devel</a><br>
Developer docs: <a
class="moz-txt-link-freetext"
href="http://chirp.danplanet.com/projects/chirp/wiki/Developers"
moz-do-not-send="true">http://chirp.danplanet.com/projects/chirp/wiki/Developers</a></div>
</blockquote>
</div>
<br>
</div>
</blockquote>
</div>
_______________________________________________<br>
chirp_devel mailing list<br>
<a class="moz-txt-link-abbreviated" href="mailto:chirp_devel@intrepid.danplanet.com">chirp_devel@intrepid.danplanet.com</a><br>
<a class="moz-txt-link-freetext" href="http://intrepid.danplanet.com/mailman/listinfo/chirp_devel">http://intrepid.danplanet.com/mailman/listinfo/chirp_devel</a><br>
Developer docs:
<a class="moz-txt-link-freetext" href="http://chirp.danplanet.com/projects/chirp/wiki/Developers">http://chirp.danplanet.com/projects/chirp/wiki/Developers</a></div>
</blockquote>
</div>
<br>
</div>
</div>
</blockquote>
</body>
</html>