mirror of
https://github.com/kk7ds/chirp.git
synced 2024-09-21 10:37:15 +00:00
chirpc: add --clear-mem option (#2343)
This patch gives the CLI the means of clearing a memory channel.
This commit is contained in:
parent
28b131ea20
commit
8336361662
16
chirpc
16
chirpc
@ -110,6 +110,9 @@ if __name__ == "__main__":
|
||||
|
||||
memarg.add_argument("--get-mem", action="store_true",
|
||||
help="Get and print memory location")
|
||||
memarg.add_argument("--clear-mem", action="store_true",
|
||||
help="Clear memory location")
|
||||
|
||||
memarg.add_argument("--set-mem-name", help="Set memory name")
|
||||
memarg.add_argument("--set-mem-freq", type=float,
|
||||
help="Set memory frequency")
|
||||
@ -228,6 +231,19 @@ if __name__ == "__main__":
|
||||
print mem
|
||||
sys.exit(0)
|
||||
|
||||
if options.clear_mem:
|
||||
memnum = parse_memory_number(radio, args)
|
||||
try:
|
||||
mem = radio.get_memory(memnum)
|
||||
except errors.InvalidMemoryLocation, e:
|
||||
LOG.exception(e)
|
||||
sys.exit(1)
|
||||
if mem.empty:
|
||||
LOG.warn("memory %d is already empty, exiting", memnum)
|
||||
sys.exit(0)
|
||||
mem.empty = True
|
||||
radio.set_memory(mem)
|
||||
|
||||
if options.raw:
|
||||
memnum = parse_memory_number(radio, args)
|
||||
data = radio.get_raw_memory(memnum)
|
||||
|
Loading…
Reference in New Issue
Block a user