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));
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,
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,
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.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.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");
}
+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));
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);