[chirp_devel] [PATCH 0 of 4 ] Clone help messages
The following patches give messages to the users to help them remember the clone procedure. They implement feature #1163 for some of the yaesu radio, radio derived from yaesu clone that does not have (yet) a specific message will inherit generic "go to clone" messages.
The use of _(msg) (locale translated messages) in radios breaks run_test, I was unable to solve this but it should be as simple as adding in the right place:
# we don't really need translations during tests # just define it def _(string): return string
More radio to come in next days ...
# HG changeset patch # User Marco Filippi iz3gme.marco@gmail.com # Date 1381240997 -7200 # Node ID df2b549f5cc6cb5cb74b734f12da6b65cef1e5db # Parent 917830c94a36e21a0b30cad52a62f5df3430ea94 [yaesu_clone] Add messages to help users remember clone procedure part of feature #1163
diff --git a/chirp/yaesu_clone.py b/chirp/yaesu_clone.py --- a/chirp/yaesu_clone.py +++ b/chirp/yaesu_clone.py @@ -59,6 +59,9 @@
data = "" blocks = 0 + status = chirp_common.Status() + status.msg = radio._START_CLONE_TX_MSG + radio.status_fn(status) for block in radio._block_lengths: blocks += 1 if blocks == len(radio._block_lengths): @@ -124,7 +127,11 @@ if buf and buf[0] != chr(CMD_ACK): buf = pipe.read(block) if not buf or buf[-1] != chr(CMD_ACK): - raise Exception("Radio did not ack block %i" % blocks) + if blocks == 0: + raise Exception(_("Radio did not ack first block\n") + + radio._START_CLONE_RX_MSG) + else : + raise Exception(_("Radio did not ack block %i") % blocks) else: _chunk_write(pipe, radio.get_mmap()[pos:], radio.status_fn, radio._block_size) @@ -178,6 +185,12 @@ VENDOR = "Yaesu" _model = "ABCDE"
+ _START_CLONE_TX_MSG = _("Waiting for radio to start clone process\n" + "Please put radio in Clone-TX now") + _START_CLONE_RX_MSG = _("This is often because, " + "before to press the OK button, " + "you forget to put radio in Clone-RX") + def _checksums(self): """Return a list of checksum objects that need to be calculated""" return []
# HG changeset patch # User Marco Filippi iz3gme.marco@gmail.com # Date 1381241015 -7200 # Node ID 8b5e2c9cda5cffee7d67285de302bb19e42d7804 # Parent df2b549f5cc6cb5cb74b734f12da6b65cef1e5db [vx7] Add messages to help users remember clone procedure part of feature #1163
diff --git a/chirp/vx7.py b/chirp/vx7.py --- a/chirp/vx7.py +++ b/chirp/vx7.py @@ -183,6 +183,16 @@ _block_lengths = [ 10, 8, 16193 ] _block_size = 8
+ _START_CLONE_TX_MSG = _("Waiting for VX-7 to start clone process\n" + "If you didn't already please:\n" + "- switch on the radio while pressing MON-F " + "button to push it to clone mode\n" + "- start send pressing BAND button on the radio") + _START_CLONE_RX_MSG = _("This is often because, before to press the OK " + "button, you forget to:\n" + "- switch on the radio while pressing MON-F " + "button to push it to clone mode\n" + "- start receive pressing V/M button on the radio") def _checksums(self): return [ yaesu_clone.YaesuChecksum(0x0592, 0x0610), yaesu_clone.YaesuChecksum(0x0612, 0x0690),
# HG changeset patch # User Marco Filippi iz3gme.marco@gmail.com # Date 1381241046 -7200 # Node ID 8c40aba830d23eec3f53ef93af4a2bac95075f44 # Parent 8b5e2c9cda5cffee7d67285de302bb19e42d7804 [ft60] Add messages to help users remember clone procedure part of feature #1163
diff --git a/chirp/ft60.py b/chirp/ft60.py --- a/chirp/ft60.py +++ b/chirp/ft60.py @@ -27,6 +27,9 @@
def _download(radio): data = "" + status = chirp_common.Status() + status.msg = radio._START_CLONE_TX_MSG + radio.status_fn(status) for i in range(0, 10): chunk = radio.pipe.read(8) if len(chunk) == 8: @@ -71,7 +74,11 @@ _send(radio.pipe, radio.get_mmap()[offset:offset+64]) ack = radio.pipe.read(1) if ack != ACK: - raise Exception("Radio did not ack block %i" % i) + if i == 0: + raise Exception(_("Radio did not ack first block\n") + + radio._START_CLONE_RX_MSG) + else : + raise Exception(_("Radio did not ack block %i") % i)
if radio.status_fn: status = chirp_common.Status() @@ -166,6 +173,20 @@
_memsize = 28617
+ _START_CLONE_TX_MSG = _("Waiting for FT60 to start clone process\n" + "If you didn't already please:\n" + "- switch on the radio while pressing MONI " + "button\n" + "- Rotate the DIAL job to select "F8 CLONE"\n" + "- press the [F/W] key\n" + "- start send pressing PTT switch") + _START_CLONE_RX_MSG = _("This is often because, before to press the OK " + "button, you forget to:\n" + "- switch on the radio while pressing MONI " + "button\n" + "- Rotate the DIAL job to select "F8 CLONE"\n" + "- press the [F/W] key\n" + "- start receive pressing MONI button") def get_features(self): rf = chirp_common.RadioFeatures() rf.memory_bounds = (1, 999)
# HG changeset patch # User Marco Filippi iz3gme.marco@gmail.com # Date 1381241078 -7200 # Node ID 48a7440ca0bad50ac8099e6d61e943e85dce1084 # Parent 8c40aba830d23eec3f53ef93af4a2bac95075f44 [ft8x7] Add messages to help users remember clone procedure part of feature #1163
diff --git a/chirp/ft817.py b/chirp/ft817.py --- a/chirp/ft817.py +++ b/chirp/ft817.py @@ -272,6 +272,18 @@
SPECIAL_MEMORIES_REV = dict(zip(SPECIAL_MEMORIES.values(), SPECIAL_MEMORIES.keys())) + + _START_CLONE_TX_MSG = _("Waiting for FT817 to start clone process\n" + "If you didn't already please:\n" + "- switch on the radio while pressing both <- -> " + "buttons to push it to clone mode\n" + "- start send pressing A button on the radio") + _START_CLONE_RX_MSG = _("This is often because, before to press the OK " + "button, you forget to:\n" + "- switch on the radio while pressing both <- -> " + "buttons to push it to clone mode\n" + "- start receive pressing C button on the radio") +
def _read(self, block, blocknum): for _i in range(0, 60): @@ -304,8 +316,10 @@ data = "" blocks = 0 status = chirp_common.Status() - status.msg = "Cloning from radio" + status.msg = self._START_CLONE_TX_MSG status.max = len(self._block_lengths) + 39 + status.cur = 0 + self.status_fn(status) for block in self._block_lengths: if blocks == 8: # repeated read of 40 block same size (memory area) @@ -318,6 +332,7 @@ blocks += 1 status.cur = blocks self.status_fn(status) + status.msg = _("Clone in progress")
status.msg = "Clone completed, checking for spurious bytes" self.status_fn(status) @@ -340,7 +355,6 @@ blocks = 0 pos = 0 status = chirp_common.Status() - status.msg = "Cloning to radio" status.max = len(self._block_lengths) + 39 for block in self._block_lengths: if blocks == 8: @@ -370,7 +384,11 @@ if not buf or buf[0] != chr(CMD_ACK): if os.getenv("CHIRP_DEBUG"): print util.hexprint(buf) - raise Exception("Radio did not ack block %i" % blocks) + if blocks == 0: + raise Exception(_("Radio did not ack first block\n") + + self._START_CLONE_RX_MSG) + else : + raise Exception(_("Radio did not ack block %i") % blocks) pos += block blocks += 1 status.cur = blocks diff --git a/chirp/ft857.py b/chirp/ft857.py --- a/chirp/ft857.py +++ b/chirp/ft857.py @@ -412,6 +412,16 @@ "91:XVTR SEL", "MONI", "Q.SPL", "TCALL", "ATC", "USER"]
+ _START_CLONE_TX_MSG = _("Waiting for FT857 to start clone process\n" + "If you didn't already please:\n" + "- switch on the radio while pressing both <- -> " + "buttons to push it to clone mode\n" + "- start send pressing C button on the radio") + _START_CLONE_RX_MSG = _("This is often because, before to press the OK " + "button, you forget to:\n" + "- switch on the radio while pressing both <- -> " + "buttons to push it to clone mode\n" + "- start receive pressing A button on the radio") def get_features(self): rf = ft817.FT817Radio.get_features(self) rf.has_cross = True
On Tue, Oct 8, 2013 at 7:16 AM, Marco Filippi IZ3GME iz3gme.marco@gmail.com wrote:
@@ -304,8 +316,10 @@ data = "" blocks = 0 status = chirp_common.Status()
status.msg = "Cloning from radio"
status.msg = self._START_CLONE_TX_MSG
I don't think this is the best place to print the instructions. There should be an intermediary step so that the clone does not timeout while they are reading instructions. It could be added just after the experimental driver warning. In fact, the experimental driver warning code is almost exactly what we need, but without the Yes/No prompt.
if blocks == 0:
raise Exception(_("Radio did not ack first block\n")
+ self._START_CLONE_RX_MSG)
This never prints because the first iteration of the loop is blocks == 1. Again, it would be more useful to display the instructions prior to starting the clone loop.
Tom KD7LXL
Hi Tom
I don't think this is the best place to print the instructions. There should be an intermediary step so that the clone does not timeout while they are reading instructions. It could be added just after the experimental driver warning. In fact, the experimental driver warning code is almost exactly what we need, but without the Yes/No prompt.
Well ... I do prefer messages that do not force me to press one more "ok" every time. In my opinion the right place would be the upload/download dialog itself so users can read instructions before to start clone process but this would involve changes to the dialog to display the correct message at every radio model change. Nothing I can do in the little time I have today ;)
if blocks == 0:
raise Exception(_("Radio did not ack first block\n")
+ self._START_CLONE_RX_MSG)
This never prints because the first iteration of the loop is blocks ==
- Again, it would be more useful to display the instructions prior to
starting the clone loop.
blocks start from 0 and is incremented only after receiving a good ACK. Anyway I'm pretty sure that while testing I saw each message for each of the patch I sent, don't you?
73 de IZ3GME Marco
On Tue, Oct 8, 2013 at 9:43 AM, Marco IZ3GME iz3gme.marco@gmail.com wrote:
blocks start from 0 and is incremented only after receiving a good ACK. Anyway I'm pretty sure that while testing I saw each message for each of the patch I sent, don't you?
No, I only saw the TX msg displayed after applying your patch.
blocks = 0 pos = 0 for block in radio._block_lengths: blocks += 1 if blocks != len(radio._block_lengths): #print "Sending %i-%i" % (pos, pos+block) pipe.write(radio.get_mmap()[pos:pos+block]) buf = pipe.read(1) if buf and buf[0] != chr(CMD_ACK): buf = pipe.read(block) if not buf or buf[-1] != chr(CMD_ACK): if blocks == 0: raise Exception(_("Radio did not ack first block\n") + radio._START_CLONE_RX_MSG) else : raise Exception(_("Radio did not ack block %i") % blocks)
Looks to me like blocks is incremented before the ACK (not after). That would explain why I never saw the message. With no radio connected, the error I get is "Radio did not ack block 1".
Tom KD7LXL
I find it! That code is from yaesu_clone.py so ... you are right! the vx7 doesn't display the message I was double checking the ft8x7 as per the message subject :(
73 de IZ3GME Marco
On 10/08/2013 06:47 PM, Tom Hayward wrote:
On Tue, Oct 8, 2013 at 9:43 AM, Marco IZ3GME iz3gme.marco@gmail.com wrote:
blocks start from 0 and is incremented only after receiving a good ACK. Anyway I'm pretty sure that while testing I saw each message for each of the patch I sent, don't you?
No, I only saw the TX msg displayed after applying your patch.
blocks = 0 pos = 0 for block in radio._block_lengths: blocks += 1 if blocks != len(radio._block_lengths): #print "Sending %i-%i" % (pos, pos+block) pipe.write(radio.get_mmap()[pos:pos+block]) buf = pipe.read(1) if buf and buf[0] != chr(CMD_ACK): buf = pipe.read(block) if not buf or buf[-1] != chr(CMD_ACK): if blocks == 0: raise Exception(_("Radio did not ack first block\n") + radio._START_CLONE_RX_MSG) else : raise Exception(_("Radio did not ack block %i") % blocks)
Looks to me like blocks is incremented before the ACK (not after). That would explain why I never saw the message. With no radio connected, the error I get is "Radio did not ack block 1".
Tom KD7LXL _______________________________________________ chirp_devel mailing list chirp_devel@intrepid.danplanet.com http://intrepid.danplanet.com/mailman/listinfo/chirp_devel Developer docs: http://chirp.danplanet.com/projects/chirp/wiki/Developers
participants (3)
-
Marco Filippi IZ3GME
-
Marco IZ3GME
-
Tom Hayward