Beispiel #1
0
 def test_required_step(self):
     steps = {2.5: self._025,
              5.0: self._005,
              6.25: self._625,
              12.5: self._125,
              }
     for step, freqs in steps.items():
         for freq in freqs:
             self.assertEqual(step, chirp_common.required_step(freq))
Beispiel #2
0
 def test_required_step(self):
     steps = {2.5: self._025,
              5.0: self._005,
              6.25: self._625,
              12.5: self._125,
              }
     for step, freqs in steps.items():
         for freq in freqs:
             self.assertEqual(step, chirp_common.required_step(freq))
Beispiel #3
0
def _decode_freq(freqraw):
    freq = int(freqraw) * 10000
    if freq > 8000000000:
        freq = (freq - 8000000000) + 5000

    if freq > 4000000000:
        freq -= 4000000000
        for i in range(0, 3):
            freq += 2500
            if chirp_common.required_step(freq) == 12.5:
                break

    return freq
Beispiel #4
0
def _decode_freq(freqraw):
    freq = int(freqraw) * 10000
    if freq > 8000000000:
        freq = (freq - 8000000000) + 5000

    if freq > 4000000000:
        freq -= 4000000000
        for i in range(0, 3):
            freq += 2500
            if chirp_common.required_step(freq) == 12.5:
                break

    return freq
Beispiel #5
0
    def set_memory(self, mem):
        _mem = self._get_mem(mem.number)
        byte = (mem.number - 1) / 8
        bit = 1 << ((mem.number - 1) % 8)

        if mem.empty and self._memobj.invisible_bits[byte] & bit:
            self._memobj.invalid_bits[byte] |= bit
            return
        if mem.empty:
            self._memobj.invisible_bits[byte] |= bit
            return

        if self._memobj.invalid_bits[byte] & bit:
            _wipe_memory(_mem)

        self._memobj.invisible_bits[byte] &= ~bit
        self._memobj.invalid_bits[byte] &= ~bit

        _mem.unknown2 = 0x02  # Channels don't display without this
        _mem.unknown7 = 0x01  # some bit in this field is related to
        _mem.unknown8 = 0xFF  # being able to transmit

        if chirp_common.required_step(mem.freq) == 12.5:
            mult = 6250
            _mem.step = 0x05
        else:
            mult = 5000
            _mem.step = 0x00

        _mem.freq = mem.freq / mult
        _mem.tone = chirp_common.TONES.index(mem.rtone)
        _mem.dtcs = chirp_common.DTCS_CODES.index(mem.dtcs)
        _mem.tmode = TMODES.index(mem.tmode)
        _mem.duplex = DUPLEX.index(mem.duplex)
        _mem.offset = mem.offset / 5000 / 10
        _mem.isfm = mem.mode == "FM"
        _mem.skip = mem.skip == "S"
        try:
            _mem.power = POWER.index(mem.power)
        except ValueError:
            _mem.power = 3  # High

        for i in range(0, 8):
            try:
                _mem.name[i] = CHARSET.index(mem.name[i])
            except IndexError:
                _mem.name[i] = 0x40
        _mem.showname = bool(mem.name.strip())
Beispiel #6
0
    def set_memory(self, mem):
        _mem = self._get_mem(mem.number)
        byte = (mem.number - 1) / 8
        bit = 1 << ((mem.number - 1) % 8)

        if mem.empty and self._memobj.invisible_bits[byte] & bit:
            self._memobj.invalid_bits[byte] |= bit
            return
        if mem.empty:
            self._memobj.invisible_bits[byte] |= bit
            return

        if self._memobj.invalid_bits[byte] & bit:
            _wipe_memory(_mem)

        self._memobj.invisible_bits[byte] &= ~bit
        self._memobj.invalid_bits[byte] &= ~bit

        _mem.unknown2 = 0x02  # Channels don't display without this
        _mem.unknown7 = 0x01  # some bit in this field is related to
        _mem.unknown8 = 0xFF  # being able to transmit

        if chirp_common.required_step(mem.freq) == 12.5:
            mult = 6250
            _mem.step = 0x05
        else:
            mult = 5000
            _mem.step = 0x00

        _mem.freq = mem.freq / mult
        _mem.tone = chirp_common.TONES.index(mem.rtone)
        _mem.dtcs = chirp_common.DTCS_CODES.index(mem.dtcs)
        _mem.tmode = TMODES.index(mem.tmode)
        _mem.duplex = DUPLEX.index(mem.duplex)
        _mem.offset = mem.offset / 5000 / 10
        _mem.isfm = mem.mode == "FM"
        _mem.skip = mem.skip == "S"
        try:
            _mem.power = POWER.index(mem.power)
        except ValueError:
            _mem.power = 3  # High

        for i in range(0, 8):
            try:
                _mem.name[i] = CHARSET.index(mem.name[i])
            except IndexError:
                _mem.name[i] = 0x40
        _mem.showname = bool(mem.name.strip())
Beispiel #7
0
    def do_oddsteps(self, rf):
        odd_steps = {
            145: [145.85625, 145.86250],
            445: [445.85625, 445.86250],
            862: [862.73125, 862.73750],
        }

        m = self._mem(rf)

        for low, high in rf.valid_bands:
            for band, totest in odd_steps.items():
                if band < low or band > high:
                    continue
                for testfreq in totest:
                    if chirp_common.required_step(testfreq) not in\
                            rf.valid_tuning_steps:
                        continue

                    m.freq = testfreq
                    self._wrapper.do("set_memory", m)
                    n = self._wrapper.do("get_memory", m.number)
                    self.compare_mem(m, n)
Beispiel #8
0
    def do_oddsteps(self, rf):
        odd_steps = {
            145: [145.85625, 145.86250],
            445: [445.85625, 445.86250],
            862: [862.73125, 862.73750],
            }

        m = self._mem(rf)

        for low, high in rf.valid_bands:
            for band, totest in odd_steps.items():
                if band < low or band > high:
                    continue
                for testfreq in totest:
                    if chirp_common.required_step(testfreq) not in\
                            rf.valid_tuning_steps:
                        continue

                    m.freq = testfreq
                    self._wrapper.do("set_memory", m)
                    n = self._wrapper.do("get_memory", m.number)
                    self.compare_mem(m, n)
Beispiel #9
0
    def do_oddsteps(self, rf):
        odd_steps = {
            145000000: [145856250, 145862500],
            445000000: [445856250, 445862500],
            862000000: [862731250, 862737500],
            }

        m = self._mem(rf)

        for low, high in rf.valid_bands:
            for band, totest in odd_steps.items():
                if band < low or band > high:
                    continue
                for testfreq in totest:
                    step = chirp_common.required_step(testfreq)
                    if step not in rf.valid_tuning_steps:
                        continue
                    m.freq = testfreq
                    m.tuning_step = step
                    self._wrapper.do("set_memory", m)
                    n = self._wrapper.do("get_memory", m.number)
                    self.compare_mem(m, n, ignore=['tuning_step'])