diff --git a/apps/dds/static/js/dds_conversion.js b/apps/dds/static/js/dds_conversion.js index 520c7d6..1d8bb16 100644 --- a/apps/dds/static/js/dds_conversion.js +++ b/apps/dds/static/js/dds_conversion.js @@ -1,13 +1,37 @@ - - function freq2Binary(mclock, frequency) { - - var freq_bin = parseInt(frequency * (Math.pow(2,48)/mclock)); - return freq_bin; - - } - - function binary2Freq(mclock, binary) { +function freq2Binary(mclock, frequency) { - var frequency = (1.0*binary) / (Math.pow(2,48)/mclock); - return frequency; - } \ No newline at end of file + var freq_bin = parseInt(frequency * (Math.pow(2,48)/mclock)); + return freq_bin; + +} + +function binary2Freq(mclock, binary) { + + var frequency = (1.0*binary) / (Math.pow(2,48)/mclock); + return frequency; +} + + +function binary2FreqDelta(mclock, binary) { + + var frequency = (1.0*binary) / (Math.pow(2,48)/mclock); + return frequency; +} + +function freqDelta2Binary(mclock, frequency) { + + var freq_bin = parseInt(frequency * (Math.pow(2,48)/mclock)); + return freq_bin; +} + +function binary2Ramp(mclock, binary) { + + var frequency = (1.0*mclock) / (binary+1); + return frequency; +} + +function freqRamp2Binary(mclock, frequency) { + + var freq_bin = parseInt(mclock/frequency-1); + return freq_bin; +} \ No newline at end of file diff --git a/apps/dds_rest/models.py b/apps/dds_rest/models.py index 4aea976..260e2bb 100644 --- a/apps/dds_rest/models.py +++ b/apps/dds_rest/models.py @@ -98,23 +98,26 @@ class DDSRestConfiguration(Configuration): def status_device(self): print("Status ") try: - answer = api.status(ip = self.device.ip_address, - port = self.device.port_address) - if 'clock' in answer: - self.device.status = 1 + self.device.status = 0 + payload = self.request('status') + if payload['status']=='generating RF': + self.device.status = 3 + elif payload['status']=='no generating RF': + self.device.status = 2 else: - self.device.status = answer[0] - self.message = 'DDS - {}'.format(answer[2:]) + self.device.status = 1 + self.device.save() + self.message = 'DDS REST status: {}'.format(payload['status']) + return False except Exception as e: - self.message = str(e) - self.device.status = 0 + if 'No route to host' not in str(e): + self.device.status = 4 + self.device.save() + self.message = 'DDS REST status: {}'.format(str(e)) + return False self.device.save() - - if self.device.status in (0, '0'): - return False - else: - return True + return True def reset_device(self): @@ -189,12 +192,23 @@ class DDSRestConfiguration(Configuration): print(amplitudeI) amplitudeQ = self.amplitudeQ print(amplitudeQ) + delta_frequency = self.delta_frequency + print(delta_frequency) + update_clock = self.update_clock + print(update_clock) + ramp_rate_clock = self.ramp_rate_clock + print(ramp_rate_clock) cadena_json = {'clock': (b64encode(pack(' {% endblock %} \ No newline at end of file diff --git a/apps/main/models.py b/apps/main/models.py index 6e42f2a..1a43504 100644 --- a/apps/main/models.py +++ b/apps/main/models.py @@ -137,7 +137,7 @@ class Device(models.Model): ip_address = models.GenericIPAddressField(protocol='IPv4', default='0.0.0.0') port_address = models.PositiveSmallIntegerField(default=2000) description = models.TextField(blank=True, null=True) - status = models.PositiveSmallIntegerField(default=0, choices=DEV_STATES) + status = models.PositiveSmallIntegerField(default=4, choices=DEV_STATES) conf_active = models.PositiveIntegerField(default=0, verbose_name='Current configuration') class Meta: diff --git a/apps/main/static/css/header.css b/apps/main/static/css/header.css index 109f491..f6182de 100644 --- a/apps/main/static/css/header.css +++ b/apps/main/static/css/header.css @@ -7,6 +7,10 @@ padding: 0 0; } +.dropdown-menu a{ + color: #000000 !important; +} + .nav-social a { text-align: center; line-height: 23px; diff --git a/apps/main/templates/footer_igp.html b/apps/main/templates/footer_igp.html index 891e33b..86e3708 100644 --- a/apps/main/templates/footer_igp.html +++ b/apps/main/templates/footer_igp.html @@ -7,7 +7,7 @@

Lunes a Viernes de 8:30 a 16:30

  • -
    +

    Calle Badajoz Nº 169 Urb. Mayorazgo

    I Etapa Ate, Lima 15012 - Perú

  • diff --git a/apps/main/templates/header_igp.html b/apps/main/templates/header_igp.html index 6ab7925..a96ac39 100644 --- a/apps/main/templates/header_igp.html +++ b/apps/main/templates/header_igp.html @@ -36,6 +36,22 @@  roj@igp.gob.pe + + {% if user.is_authenticated %} + + {% else %} + + {% endif %} @@ -49,7 +65,7 @@ href="/"> - +