Ejemplo n.º 1
0
    def set_memory(self, mem):
        bit = 1 << (mem.number % 8)
        byte = int(mem.number / 8)

        _mem = self._memobj.memory[mem.number]
        _usd = self._memobj.used[byte]
        _skp = self._memobj.skips[byte]
        _psk = self._memobj.pskips[byte]

        _mem.set_raw("\x00" * (_mem.size() // 8))

        if mem.empty:
            _usd |= bit
            return

        _usd &= ~bit

        if chirp_common.is_12_5(mem.freq):
            _mem.freq = (mem.freq // 6250) | 0x800000
        else:
            _mem.freq = mem.freq // 5000
        _mem.offset = mem.offset // 5000
        _mem.name = mem.name.ljust(6)[:6]
        _mem.rtone = chirp_common.TONES.index(mem.rtone)
        _mem.ctone = chirp_common.TONES.index(mem.ctone)
        _mem.dtcs = chirp_common.DTCS_CODES.index(mem.dtcs)
        _mem.tuning_step = TUNING_STEPS.index(mem.tuning_step)
        _mem.narrow = mem.mode == "NFM"
        _mem.duplex = DUPLEX.index(mem.duplex)
        _mem.dtcs_polarity = DTCS_POLARITY.index(mem.dtcs_polarity)
        _mem.tmode = TMODES.index(mem.tmode)
        if mem.power:
            _mem.power = POWER_LEVELS.index(mem.power)
        else:
            _mem.power = 0

        if mem.skip == "S":
            _skp |= bit
            _psk &= ~bit
        elif mem.skip == "P":
            _skp &= ~bit
            _psk |= bit
        else:
            _skp &= ~bit
            _psk &= ~bit
Ejemplo n.º 2
0
Archivo: ict70.py Proyecto: cl4u2/chirp
    def set_memory(self, mem):
        bit = 1 << (mem.number % 8)
        byte = int(mem.number / 8)

        _mem = self._memobj.memory[mem.number]
        _usd = self._memobj.used[byte]
        _skp = self._memobj.skips[byte]
        _psk = self._memobj.pskips[byte]

        _mem.set_raw("\x00" * (_mem.size() / 8))

        if mem.empty:
            _usd |= bit
            return

        _usd &= ~bit

        if chirp_common.is_12_5(mem.freq):
            _mem.freq = (mem.freq / 6250) | 0x800000
        else:
            _mem.freq = mem.freq / 5000
        _mem.offset = mem.offset / 5000
        _mem.name = mem.name.ljust(6)[:6]
        _mem.rtone = chirp_common.TONES.index(mem.rtone)
        _mem.ctone = chirp_common.TONES.index(mem.ctone)
        _mem.dtcs = chirp_common.DTCS_CODES.index(mem.dtcs)
        _mem.tuning_step = TUNING_STEPS.index(mem.tuning_step)
        _mem.narrow = mem.mode == "NFM"
        _mem.duplex = DUPLEX.index(mem.duplex)
        _mem.dtcs_polarity = DTCS_POLARITY.index(mem.dtcs_polarity)
        _mem.tmode = TMODES.index(mem.tmode)
        if mem.power:
            _mem.power = POWER_LEVELS.index(mem.power)
        else:
            _mem.power = 0

        if mem.skip == "S":
            _skp |= bit
            _psk &= ~bit
        elif mem.skip == "P":
            _skp &= ~bit
            _psk |= bit
        else:
            _skp &= ~bit
            _psk &= ~bit
Ejemplo n.º 3
0
def _get_freq(mem):
    freq = (int(mem.freq) * 100000) + \
        (mem.freq_10khz * 10000) + \
        (mem.freq_1khz * 1000)

    if mem.is_12_5:
        if chirp_common.is_12_5(freq):
            pass
        elif mem.freq_1khz == 2:
            freq += 500
        elif mem.freq_1khz == 5:
            freq += 2500
        elif mem.freq_1khz == 7:
            freq += 500
        else:
            raise Exception("Unable to resolve 12.5kHz: %i" % freq)

    return freq
Ejemplo n.º 4
0
def _get_freq(mem):
    freq = (int(mem.freq) * 100000) + \
        (mem.freq_10khz * 10000) + \
        (mem.freq_1khz * 1000)

    if mem.is_12_5:
        if chirp_common.is_12_5(freq):
            pass
        elif mem.freq_1khz == 2:
            freq += 500
        elif mem.freq_1khz == 5:
            freq += 2500
        elif mem.freq_1khz == 7:
            freq += 500
        else:
            raise Exception("Unable to resolve 12.5kHz: %i" % freq)

    return freq
Ejemplo n.º 5
0
 def test_is_12_5(self):
     for freq in self._125:
         self.assertTrue(chirp_common.is_12_5(freq))
Ejemplo n.º 6
0
def _set_freq(mem, freq):
    mem.freq = freq / 100000
    mem.freq_10khz = (freq / 10000) % 10
    khz = (freq / 1000) % 10
    mem.freq_1khz = khz
    mem.is_12_5 = chirp_common.is_12_5(freq)
Ejemplo n.º 7
0
 def test_is_12_5(self):
     for freq in self._125:
         self.assertTrue(chirp_common.is_12_5(freq))
Ejemplo n.º 8
0
def _set_freq(mem, freq):
    mem.freq = freq / 100000
    mem.freq_10khz = (freq / 10000) % 10
    khz = (freq / 1000) % 10
    mem.freq_1khz = khz
    mem.is_12_5 = chirp_common.is_12_5(freq)