]> git.zerfleddert.de Git - rigol/commitdiff
add vertical status information
authorMichael Gernoth <michael@gernoth.net>
Sat, 19 Jun 2010 16:28:47 +0000 (18:28 +0200)
committerMichael Gernoth <michael@gernoth.net>
Sat, 19 Jun 2010 16:28:47 +0000 (18:28 +0200)
rigold.c
scope.c
scope.h

index c399dc55526bd5b6f5cffd745c39c0d7f0fde881..d8e4b19486526a4d7bdff680fdebef88ba020d9a 100644 (file)
--- a/rigold.c
+++ b/rigold.c
@@ -60,6 +60,9 @@ static int send_command_output(int s, struct scope *sc, char *cmd)
 
 static void serve_index(int s, struct scope *sc, char *param)
 {
 
 static void serve_index(int s, struct scope *sc, char *param)
 {
+       int i;
+       struct channel_s *ch;
+
        send_text(s, "HTTP/1.0 200 OK\n");
        send_text(s, "Content-type: text/html\n\n");
        send_text(s, "<html><head><title>%s</title></head><body bgcolor=\"#ffffff\" text=\"#000000\">\n", scope_idn(sc));
        send_text(s, "HTTP/1.0 200 OK\n");
        send_text(s, "Content-type: text/html\n\n");
        send_text(s, "<html><head><title>%s</title></head><body bgcolor=\"#ffffff\" text=\"#000000\">\n", scope_idn(sc));
@@ -68,6 +71,7 @@ static void serve_index(int s, struct scope *sc, char *param)
 
        claimscope(sc);
        update_scope_status(sc);
 
        claimscope(sc);
        update_scope_status(sc);
+       releasescope(sc);
 
        send_text(s, "System: Language: %s, Counter: %d, Beep: %d<br><br>\n",
                sc->status.system.lang,
 
        send_text(s, "System: Language: %s, Counter: %d, Beep: %d<br><br>\n",
                sc->status.system.lang,
@@ -112,18 +116,6 @@ static void serve_index(int s, struct scope *sc, char *param)
                sc->status.measure.ch1.pdelay,
                sc->status.measure.ch1.ndelay);
 
                sc->status.measure.ch1.pdelay,
                sc->status.measure.ch1.ndelay);
 
-       send_text(s, "Acquire: Type: %s, Mode: %s, Averages: %d<br>\n",
-               sc->status.acquire.type,
-               sc->status.acquire.mode,
-               sc->status.acquire.averages);
-
-       send_text(s, "Horizontal: Mode: %s, Offset: %lg, Delayed Offset: %lg, Scale: %lg, Format: %s<br>\n",
-               sc->status.timebase.mode,
-               sc->status.timebase.offset,
-               sc->status.timebase.delayed_offset,
-               sc->status.timebase.scale,
-               sc->status.timebase.format);
-
        send_text(s, "Measure CH2:<br>\n");
        send_text(s, "VPP: %lg, VMAX: %lg, VMIN: %lg, VAMPLITUDE: %lg, VTOP: %lg, VBASE: %lg, VAVERAGE: %lg, VRMS: %lg<br>\n",
                sc->status.measure.ch2.vpp,
        send_text(s, "Measure CH2:<br>\n");
        send_text(s, "VPP: %lg, VMAX: %lg, VMIN: %lg, VAMPLITUDE: %lg, VTOP: %lg, VBASE: %lg, VAVERAGE: %lg, VRMS: %lg<br>\n",
                sc->status.measure.ch2.vpp,
@@ -155,19 +147,14 @@ static void serve_index(int s, struct scope *sc, char *param)
                sc->status.measure.ch2.pdelay,
                sc->status.measure.ch2.ndelay);
 
                sc->status.measure.ch2.pdelay,
                sc->status.measure.ch2.ndelay);
 
-       send_text(s, "Acquire: Type: %s, Mode: %s, Averages: %d<br>\n",
+       send_text(s, "<br>Acquire: Type: %s, Mode: %s, Averages: %d, CH1: %.10lg samples/s, CH2: %.10lg samples/s<br>\n",
                sc->status.acquire.type,
                sc->status.acquire.mode,
                sc->status.acquire.type,
                sc->status.acquire.mode,
-               sc->status.acquire.averages);
-
-       send_text(s, "Horizontal: Mode: %s, Offset: %lg, Delayed Offset: %lg, Scale: %lg, Format: %s<br><br>\n",
-               sc->status.timebase.mode,
-               sc->status.timebase.offset,
-               sc->status.timebase.delayed_offset,
-               sc->status.timebase.scale,
-               sc->status.timebase.format);
+               sc->status.acquire.averages,
+               sc->status.acquire.srate_ch1,
+               sc->status.acquire.srate_ch2);
 
 
-       send_text(s, "Display: Type: %s, Grid: %s, Persist: %d, MNUDisplay: %s, MNUStatus: %d, Screen: %s, Brightness: %d, Intensity: %d<br><br>\n",
+       send_text(s, "<br>Display: Type: %s, Grid: %s, Persist: %d, MNUDisplay: %s, MNUStatus: %d, Screen: %s, Brightness: %d, Intensity: %d<br><br>\n",
                sc->status.display.type,
                sc->status.display.grid,
                sc->status.display.persist,
                sc->status.display.type,
                sc->status.display.grid,
                sc->status.display.persist,
@@ -176,21 +163,35 @@ static void serve_index(int s, struct scope *sc, char *param)
                sc->status.display.screen,
                sc->status.display.brightness,
                sc->status.display.intensity);
                sc->status.display.screen,
                sc->status.display.brightness,
                sc->status.display.intensity);
+       
+       for (i = 1; i <= 2; i++) {
+               if (i == 1) {
+                       ch = &(sc->status.channel.ch1);
+               } else {
+                       ch = &(sc->status.channel.ch2);
+               }
+               send_text(s, "Channel %d: ", i);
+
+               send_text(s, "BWLimit: %d, Coupling: %s, Displayed: %d, Inverted: %d, Offset: %lg, Probe: %lgX, Scale: %lg, Filter: %d, Memory Depth: %d, Vernier: %s<br>\n",
+                       ch->bwlimit_enabled,
+                       ch->coupling,
+                       ch->displayed,
+                       ch->inverted,
+                       ch->offset,
+                       ch->probe,
+                       ch->scale,
+                       ch->filter_enabled,
+                       ch->memory_depth,
+                       ch->vernier);
+       }
 
 
-       send_text(s, "Channel 1: ");
-       send_command_output(s, sc, ":CHAN1:DISP?");
-       send_text(s, ", ");
-       send_command_output(s, sc, ":CHAN1:MEMD?");
-       send_text(s, " sample depth, %.10lg samples/s<br>\n", sc->status.acquire.srate_ch1);
-       send_text(s, "Channel 2: ");
-       send_command_output(s, sc, ":CHAN2:DISP?");
-       send_text(s, ", ");
-       send_command_output(s, sc, ":CHAN2:MEMD?");
-       send_text(s, " sample depth, %.10lg samples/s<br>\n", sc->status.acquire.srate_ch2);
-
-       releasescope(sc);
+       send_text(s, "<br>Horizontal: Mode: %s, Offset: %lg, Delayed Offset: %lg, Scale: %lg, Format: %s<br>\n",
+               sc->status.timebase.mode,
+               sc->status.timebase.offset,
+               sc->status.timebase.delayed_offset,
+               sc->status.timebase.scale,
+               sc->status.timebase.format);
 
 
-       send_text(s, sc->status.system.lang);
 
        send_text(s, "<br>\n");
        send_text(s, "<form method=\"get\" action=\"\">\n");
 
        send_text(s, "<br>\n");
        send_text(s, "<form method=\"get\" action=\"\">\n");
diff --git a/scope.c b/scope.c
index 6013893107b34b609c2d3a87351a1fd3096bc197..9b75ba4ef654564d762f1221857dc1c7f9822cd7 100644 (file)
--- a/scope.c
+++ b/scope.c
@@ -198,6 +198,37 @@ void update_scope_measurements(struct scope *sc)
 
 }
 
 
 }
 
+void update_scope_channel(struct scope *sc, int channel)
+{
+       struct channel_s *ch;
+       char cmd[128];
+       int offs;
+
+       if (channel == 1) {
+               ch = &(sc->status.channel.ch1);
+               strcpy(cmd, ":CHAN1:");
+       } else if (channel == 2) {
+               ch = &(sc->status.channel.ch2);
+               strcpy(cmd, ":CHAN2:");
+       } else {
+               fprintf(stderr, "Unknown channel %d!\n", channel);
+               return;
+       }
+
+       offs=strlen(cmd);
+
+       strcpy(cmd + offs, "BWL?"); ch->bwlimit_enabled = scope_get_truth_value(sc, cmd);
+       strcpy(cmd + offs, "COUP?"); COPY_SCOPE_STRING(sc, cmd, ch->coupling);
+       strcpy(cmd + offs, "DISP?"); ch->displayed = scope_get_truth_value(sc, cmd);
+       strcpy(cmd + offs, "INV?"); ch->inverted = scope_get_truth_value(sc, cmd);
+       strcpy(cmd + offs, "OFFS?"); ch->offset = scope_get_double(sc, cmd);
+       strcpy(cmd + offs, "PROB?"); ch->probe = scope_get_double(sc, cmd);
+       strcpy(cmd + offs, "SCAL?"); ch->scale = scope_get_double(sc, cmd);
+       strcpy(cmd + offs, "FILT?"); ch->filter_enabled = scope_get_truth_value(sc, cmd);
+       strcpy(cmd + offs, "MEMD?"); ch->memory_depth = scope_get_int(sc, cmd);
+       strcpy(cmd + offs, "VERN?"); COPY_SCOPE_STRING(sc, cmd, ch->vernier);
+}
+
 int update_scope_status(struct scope *sc)
 {
        bzero(&(sc->status), sizeof(sc->status));
 int update_scope_status(struct scope *sc)
 {
        bzero(&(sc->status), sizeof(sc->status));
@@ -220,6 +251,9 @@ int update_scope_status(struct scope *sc)
        sc->status.display.brightness = scope_get_int(sc, ":DISP:BRIG?");
        sc->status.display.intensity = scope_get_int(sc, ":DISP:INT?");
 
        sc->status.display.brightness = scope_get_int(sc, ":DISP:BRIG?");
        sc->status.display.intensity = scope_get_int(sc, ":DISP:INT?");
 
+       update_scope_channel(sc, 1);
+       update_scope_channel(sc, 2);
+
        COPY_SCOPE_STRING(sc, ":ACQ:TYPE?", sc->status.acquire.type);
        COPY_SCOPE_STRING(sc, ":ACQ:MODE?", sc->status.acquire.mode);
 
        COPY_SCOPE_STRING(sc, ":ACQ:TYPE?", sc->status.acquire.type);
        COPY_SCOPE_STRING(sc, ":ACQ:MODE?", sc->status.acquire.mode);
 
diff --git a/scope.h b/scope.h
index 86ce9df009d67399d1f53fa179b43d9496e7d687..453aaf6c99f35549e34aeba582f936dd80c6ef9d 100644 (file)
--- a/scope.h
+++ b/scope.h
@@ -26,7 +26,16 @@ struct measure_s {
 };
 
 struct channel_s {
 };
 
 struct channel_s {
-       /* TODO */
+       int bwlimit_enabled;
+       char coupling[32];
+       int displayed;
+       int inverted;
+       double offset;
+       double probe;
+       double scale;
+       int filter_enabled;
+       int memory_depth;
+       char vernier[32];
 };
 
 struct scope {
 };
 
 struct scope {
Impressum, Datenschutz