Ejemplo n.º 1
0
 def set_nraw(self):
     nraw = mlx.calc_nraw(self.reg_dict)
     self.nraw_var.set(nraw)
     fmod = mlx.calc_mod_freq(self.reg_dict)
     update_entry(self.fmod_entry, fmod)
     update_entry(self.duty_cycle_entry, mlx.calc_duty_cycle(self.reg_dict))
     return
Ejemplo n.º 2
0
    def set_nxy(self):
        # We update the nrows ncols etc
        col_start, col_end, row_start, row_end = epc_calc_roi(self.reg_dict)
        nrows, ncols = epc_calc_img_size(self.reg_dict)

        update_entry(self.nrows_entry, nrows, disable=True)
        update_entry(self.ncols_entry, ncols, disable=True)
        return
Ejemplo n.º 3
0
 def set_clks(self):
     update_entry(self.mclk_entry, self.mclk, disable=False)
     update_entry(self.demod_entry, self.demod_clk, disable=False)
     self.demod_var.set(self.reg_dict["mod_clk_src"][2])
     self.mod_freq_var.set(self.reg_dict["mod_clk_div"][2] + 1)
     f_led = epc_calc_mod_freq(self.reg_dict, self.mclk, self.demod_clk)
     update_entry(self.mod_freq_entry, f_led, disable=True)
     return
Ejemplo n.º 4
0
    def set_int_time(self):
        # Used to update the information displayed from internal variables
        hdr_enabled = epc_calc_hdr(self.reg_dict)
        self.hdr_var.set(hdr_enabled)

        int_len2 = self.reg_dict["int_len2_hi"][2] * \
            256 + self.reg_dict["int_len2_low"][2]
        int_len = self.reg_dict["int_len_hi"][2] * \
            256 + self.reg_dict["int_len_low"][2]
        mult_val = self.reg_dict["int_mult_hi"][2] * \
            256 + self.reg_dict["int_mult_low"][2]
        int_times = epc_calc_int_times(self.reg_dict, self.mclk,
                                       self.demod_clk)

        update_entry(self.int_time_mult, mult_val, True)
        update_entry(self.int_len, int_len, True)
        update_entry(self.int_len2, int_len2, True)

        update_entry(self.int_time, np.round(int_times[0], 4), False)
        if hdr_enabled:
            update_entry(self.int_time2, np.round(int_times[1], 4),
                         not hdr_enabled)
        else:
            update_entry(self.int_time2, 0, not hdr_enabled)

        return
Ejemplo n.º 5
0
 def set_light_phase(self):
     light_phase = epc_calc_light_phase(self.reg_dict, self.mclk,
                                        self.demod_clk)
     update_entry(self.light_ph, np.round(light_phase, 1), False)
     return
Ejemplo n.º 6
0
    def set_nxy(self):
        # We update the number of rows and columns
        col_start, col_end, row_start, row_end = self.reg_to_roi()
        #print("col_start: " + str(col_start) + " col_end: " + str(col_end))
        #print("row_start: " + str(row_start) + " row_end: " + str(row_end))
        bin_mode = self.reg_dict["BINNING_MODE"][2]
        nrows = (row_end - row_start) + 1
        ncols = (col_end - col_start) + 1

        # XXX : Clean up this f**k up.
        if bin_mode == 0:
            if (ncols < 8):
                # We want to force the minimum ROI
                col_end = col_start + 7
                ncols = 8
            if (nrows < 2):
                # Force the minimum ROI
                row_end = row_start + 1
                nrows = 2
            # x4 in cols
            col_inc = ncols % 4
            col_end -= col_inc
            # x2 in rows
            row_inc = nrows % 2
            row_end -= row_inc
        elif bin_mode == 1:
            if (ncols < 16):
                col_end = col_start + 15
                ncols = 16
            if nrows < 2:
                row_end = row_start + 1
                nrows = 2
            col_inc = ncols % 8
            col_end -= col_inc
            ncols -= col_inc
            row_inc = nrows % 2
            row_end -= row_inc
            nrows -= row_inc
            nrows = int(nrows / 2)
            ncols = int(ncols / 2)
        elif bin_mode == 2:
            if ncols < 32:
                col_end = col_start + 31
                ncols = 32
            if nrows < 4:
                row_end = row_start + 3
                nrows = 4
            col_inc = ncols % 16
            col_end -= col_inc
            ncols -= col_inc
            row_inc = nrows % 4
            row_end -= row_inc
            nrows -= row_inc
            nrows = int(nrows / 4)
            ncols = int(ncols / 4)
        elif bin_mode == 3:
            if ncols < 64:
                col_end = col_start + 63
                ncols = 64
            if nrows < 8:
                row_end = row_start + 7
                nrows = 8
            col_inc = ncols % 32
            col_end -= col_inc
            ncols -= col_inc
            row_inc = nrows % 8
            row_end -= row_inc
            nrows -= row_inc
            nrows = int(nrows / 8)
            ncols = int(ncols / 8)

        # Update the start and end values based on our new values
        mlx.set_roi(self.reg_dict, col_start, col_end, row_start, row_end,
                    self._mlx75027)
        update_entry(self.col_start_entry, col_start)
        update_entry(self.col_end_entry, col_end)
        update_entry(self.row_start_entry, row_start)
        update_entry(self.row_end_entry, row_end)

        update_entry(self.nrows_entry, nrows, disable=True)
        update_entry(self.ncols_entry, ncols, disable=True)
        return
Ejemplo n.º 7
0
    def set_frame(self):
        update_entry(self.frame_startup_entry,
                     mlx.calc_startup_time(self.reg_dict, self._mlx75027))
        update_entry(self.frame_dead_entry,
                     mlx.calc_deadtime(self.reg_dict, self._mlx75027))
        update_entry(self.pretime_entry,
                     mlx.calc_pretime(self.reg_dict, self._mlx75027))

        int_times = mlx.calc_int_times(self.reg_dict)
        pretimes = mlx.calc_all_pretimes(self.reg_dict, self._mlx75027)
        idle_times = mlx.calc_idle_time(self.reg_dict, self._mlx75027)
        for n in range(0, 8):
            if (n + 1) > mlx.calc_nraw(self.reg_dict):
                disable = True
            else:
                disable = False

            update_entry(self.inttime_entrys[n], int_times[n], disable=disable)
            update_entry(self.pretime_entrys[n], pretimes[n], disable=True)

            heat = self.reg_dict["Px_PREHEAT"][2] & (1 << n)
            if heat:
                self.preheat_vars[n].set(1)
            else:
                self.preheat_vars[n].set(0)

            mix = self.reg_dict["Px_PREMIX"][2] & (1 << n)
            if mix:
                self.premix_vars[n].set(1)
            else:
                self.premix_vars[n].set(0)

            led = self.reg_dict["Px_LEDEN"][2] & (1 << n)
            if led:
                self.illum_vars[n].set(1)
            else:
                self.illum_vars[n].set(0)

            dmix0 = self.reg_dict["P" + str(n + 1) + "_DMIX0"][2]
            self.dmix0_vars[n].set(self.mod_modes[dmix0])

            dmix1 = self.reg_dict["P" + str(n + 1) + "_DMIX1"][2]
            self.dmix1_vars[n].set(self.mod_modes[dmix1])

            ledmod = self.reg_dict["P" + str(n + 1) + "_STATIC_LED"][2]
            self.led_vars[n].set(self.mod_modes[ledmod])

            self.phi_vars[n].set(
                self.phi_shifts[self.reg_dict["P" + str(n) +
                                              "_PHASE_SHIFT"][2]])

            update_entry(self.idle_entrys[n], idle_times[n])

        frame_time = mlx.calc_frame_time(self.reg_dict, self._mlx75027)
        depth_fps, raw_fps = mlx.calc_fps(self.reg_dict, self._mlx75027)

        update_entry(self.frame_fps_entry, depth_fps, disable=True)
        update_entry(self.frame_time_entry, frame_time, disable=True)

        return