kopia lustrzana https://gitlab.com/Teuniz/DSRemote
Work in progress.
rodzic
bfc2cef8cf
commit
6121b7ea83
2
global.h
2
global.h
|
@ -35,7 +35,7 @@
|
||||||
|
|
||||||
|
|
||||||
#define PROGRAM_NAME "DSRemote"
|
#define PROGRAM_NAME "DSRemote"
|
||||||
#define PROGRAM_VERSION "0.34_1701021130"
|
#define PROGRAM_VERSION "0.34_1701061734"
|
||||||
|
|
||||||
#define MAX_PATHLEN 4096
|
#define MAX_PATHLEN 4096
|
||||||
|
|
||||||
|
|
|
@ -302,6 +302,9 @@ void UI_Mainwindow::save_memory_waveform(int job)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sprintf(str, "Downloading channel %i waveform data...", chn + 1);
|
||||||
|
progress.setLabelText(str);
|
||||||
|
|
||||||
sprintf(str, ":WAV:SOUR CHAN%i", chn + 1);
|
sprintf(str, ":WAV:SOUR CHAN%i", chn + 1);
|
||||||
|
|
||||||
tmc_write(str);
|
tmc_write(str);
|
||||||
|
|
56
utils.c
56
utils.c
|
@ -1599,12 +1599,63 @@ void hextobin(char *dest, const char *str)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
double round_to_3digits(double val)
|
||||||
|
{
|
||||||
|
int i, exp=0, polarity=1;
|
||||||
|
|
||||||
|
if(!dblcmp(val, 0.0))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(val < 0)
|
||||||
|
{
|
||||||
|
polarity = -1;
|
||||||
|
|
||||||
|
val *= -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
while(val < 99.999)
|
||||||
|
{
|
||||||
|
val *= 10;
|
||||||
|
|
||||||
|
exp--;
|
||||||
|
}
|
||||||
|
|
||||||
|
while(val > 999.999)
|
||||||
|
{
|
||||||
|
val /= 10;
|
||||||
|
|
||||||
|
exp++;
|
||||||
|
}
|
||||||
|
|
||||||
|
val = nearbyint(val);
|
||||||
|
|
||||||
|
for(i=0; i<exp; i++)
|
||||||
|
{
|
||||||
|
val *= 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i=0; i>exp; i--)
|
||||||
|
{
|
||||||
|
val /= 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
return val * polarity;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
double round_up_step125(double val, double *ratio)
|
double round_up_step125(double val, double *ratio)
|
||||||
{
|
{
|
||||||
int i, exp=0;
|
int i, exp=0;
|
||||||
|
|
||||||
double ltmp;
|
double ltmp;
|
||||||
|
|
||||||
|
if(!dblcmp(val, 0.0))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
while(val < 0.999)
|
while(val < 0.999)
|
||||||
{
|
{
|
||||||
val *= 10;
|
val *= 10;
|
||||||
|
@ -1674,6 +1725,11 @@ double round_down_step125(double val, double *ratio)
|
||||||
|
|
||||||
double ltmp;
|
double ltmp;
|
||||||
|
|
||||||
|
if(!dblcmp(val, 0.0))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
while(val < 0.999)
|
while(val < 0.999)
|
||||||
{
|
{
|
||||||
val *= 10;
|
val *= 10;
|
||||||
|
|
1
utils.h
1
utils.h
|
@ -92,6 +92,7 @@ int convert_to_metric_suffix(char *, double, int);
|
||||||
|
|
||||||
double round_up_step125(double, double *); /* Rounds the value up to 1-2-5 steps */
|
double round_up_step125(double, double *); /* Rounds the value up to 1-2-5 steps */
|
||||||
double round_down_step125(double, double *); /* Rounds the value down to 1-2-5 steps */
|
double round_down_step125(double, double *); /* Rounds the value down to 1-2-5 steps */
|
||||||
|
double round_to_3digits(double); /* Rounds the value to max 3 digits */
|
||||||
|
|
||||||
int strtoipaddr(unsigned int *, const char *); /* convert a string "192.168.1.12" to an integer */
|
int strtoipaddr(unsigned int *, const char *); /* convert a string "192.168.1.12" to an integer */
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ UI_wave_window::UI_wave_window(struct device_settings *p_devparms, short *wbuf[M
|
||||||
|
|
||||||
mainwindow = (UI_Mainwindow *)parnt;
|
mainwindow = (UI_Mainwindow *)parnt;
|
||||||
|
|
||||||
setMinimumSize(840, 635);
|
setMinimumSize(840, 655);
|
||||||
setWindowTitle("Wave Inspector");
|
setWindowTitle("Wave Inspector");
|
||||||
|
|
||||||
devparms = (struct device_settings *)calloc(1, sizeof(struct device_settings));
|
devparms = (struct device_settings *)calloc(1, sizeof(struct device_settings));
|
||||||
|
@ -90,7 +90,16 @@ UI_wave_window::UI_wave_window(struct device_settings *p_devparms, short *wbuf[M
|
||||||
|
|
||||||
devparms->wave_mem_view_sample_start = wavslider->value();
|
devparms->wave_mem_view_sample_start = wavslider->value();
|
||||||
|
|
||||||
|
menubar = new QMenuBar(this);
|
||||||
|
|
||||||
|
helpmenu = new QMenu(this);
|
||||||
|
helpmenu->setTitle("Help");
|
||||||
|
helpmenu->addAction("How to operate", mainwindow, SLOT(helpButtonClicked()));
|
||||||
|
helpmenu->addAction("About", mainwindow, SLOT(show_about_dialog()));
|
||||||
|
menubar->addMenu(helpmenu);
|
||||||
|
|
||||||
g_layout = new QGridLayout(this);
|
g_layout = new QGridLayout(this);
|
||||||
|
g_layout->setMenuBar(menubar);
|
||||||
g_layout->addWidget(wavcurve, 0, 0);
|
g_layout->addWidget(wavcurve, 0, 0);
|
||||||
g_layout->addWidget(wavslider, 1, 0);
|
g_layout->addWidget(wavslider, 1, 0);
|
||||||
|
|
||||||
|
@ -162,6 +171,9 @@ void UI_wave_window::wavslider_value_changed(int val)
|
||||||
devparms->viewer_center_position = (double)(((devparms->wavebufsz - (devparms->hordivisions * samples_per_div)) / 2) - devparms->wave_mem_view_sample_start) /
|
devparms->viewer_center_position = (double)(((devparms->wavebufsz - (devparms->hordivisions * samples_per_div)) / 2) - devparms->wave_mem_view_sample_start) /
|
||||||
devparms->samplerate * -1.0;
|
devparms->samplerate * -1.0;
|
||||||
|
|
||||||
|
|
||||||
|
devparms->viewer_center_position = round_to_3digits(devparms->viewer_center_position);
|
||||||
|
|
||||||
wavcurve->update();
|
wavcurve->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,8 @@
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QSlider>
|
#include <QSlider>
|
||||||
|
#include <QMenuBar>
|
||||||
|
#include <QMenu>
|
||||||
|
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
@ -66,6 +68,10 @@ struct device_settings *devparms;
|
||||||
|
|
||||||
UI_Mainwindow *mainwindow;
|
UI_Mainwindow *mainwindow;
|
||||||
|
|
||||||
|
QMenuBar *menubar;
|
||||||
|
|
||||||
|
QMenu *helpmenu;
|
||||||
|
|
||||||
QGridLayout *g_layout;
|
QGridLayout *g_layout;
|
||||||
|
|
||||||
WaveCurve *wavcurve;
|
WaveCurve *wavcurve;
|
||||||
|
|
Ładowanie…
Reference in New Issue