Work in progress.

merge-requests/1/head
Teuniz 2017-01-06 17:34:49 +01:00
rodzic bfc2cef8cf
commit 6121b7ea83
6 zmienionych plików z 81 dodań i 3 usunięć

Wyświetl plik

@ -35,7 +35,7 @@
#define PROGRAM_NAME "DSRemote"
#define PROGRAM_VERSION "0.34_1701021130"
#define PROGRAM_VERSION "0.34_1701061734"
#define MAX_PATHLEN 4096

Wyświetl plik

@ -302,6 +302,9 @@ void UI_Mainwindow::save_memory_waveform(int job)
continue;
}
sprintf(str, "Downloading channel %i waveform data...", chn + 1);
progress.setLabelText(str);
sprintf(str, ":WAV:SOUR CHAN%i", chn + 1);
tmc_write(str);

58
utils.c
Wyświetl plik

@ -1599,13 +1599,64 @@ 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)
{
int i, exp=0;
double ltmp;
while(val < 0.999)
if(!dblcmp(val, 0.0))
{
return 0;
}
while(val < 0.999)
{
val *= 10;
@ -1674,6 +1725,11 @@ double round_down_step125(double val, double *ratio)
double ltmp;
if(!dblcmp(val, 0.0))
{
return 0;
}
while(val < 0.999)
{
val *= 10;

Wyświetl plik

@ -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_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 */

Wyświetl plik

@ -38,7 +38,7 @@ UI_wave_window::UI_wave_window(struct device_settings *p_devparms, short *wbuf[M
mainwindow = (UI_Mainwindow *)parnt;
setMinimumSize(840, 635);
setMinimumSize(840, 655);
setWindowTitle("Wave Inspector");
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();
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->setMenuBar(menubar);
g_layout->addWidget(wavcurve, 0, 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->samplerate * -1.0;
devparms->viewer_center_position = round_to_3digits(devparms->viewer_center_position);
wavcurve->update();
}

Wyświetl plik

@ -38,6 +38,8 @@
#include <QDialog>
#include <QGridLayout>
#include <QSlider>
#include <QMenuBar>
#include <QMenu>
#include "mainwindow.h"
#include "global.h"
@ -66,6 +68,10 @@ struct device_settings *devparms;
UI_Mainwindow *mainwindow;
QMenuBar *menubar;
QMenu *helpmenu;
QGridLayout *g_layout;
WaveCurve *wavcurve;