-// uint8_t offsets[17];
-uint8_t offsets[] = {0x20,0x75,0x30,0x3f,0x20,0xbd,0x3f,0x02,0x20,0x00,0x71,0x01,0x2e,0x0b,0x3f,0x02,0x50};
-//uint8_t offsets[] = {0xff, 0x75, 0x30, 0x3f, 0x20, 0xbd,
-// 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-//};
-
- sr_dbg("hantek-dso: sending CTRL_SETOFFSET");
-
-// memset(offsets, 0, sizeof(offsets));
-// /* Channel 1 */
-// ch_levels = ctx->channel_levels[0][VOLTAGE_10mV - ctx->voltage_ch1];
-// offset = (ch_levels[1] - ch_levels[0]) * ctx->voffset_ch1 + ch_levels[0];
-// offsets[0] = (offset >> 8) | 0x20;
-// offsets[1] = offset & 0xff;
-//
-// /* Channel 2 */
-// ch_levels = ctx->channel_levels[1][VOLTAGE_10mV - ctx->voltage_ch2];
-// offset = (ch_levels[1] - ch_levels[0]) * ctx->voffset_ch2 + ch_levels[0];
-// offsets[2] = (offset >> 8) | 0x20;
-// offsets[3] = offset & 0xff;
-//
-// /* Trigger */
-// offset = MAX_VERT_TRIGGER * ctx->voffset_trigger;
-// offsets[4] = (offset >> 8) | 0x20;
-// offsets[5] = offset & 0xff;
-
- if ((ret = libusb_control_transfer(ctx->usb->devhdl,
+ uint8_t offsets[17];
+
+ sr_dbg("Preparing CTRL_SETOFFSET.");
+
+ memset(offsets, 0, sizeof(offsets));
+ /* Channel 1 */
+ ch_levels = devc->channel_levels[0][devc->voltage_ch1];
+ offset = (ch_levels[1] - ch_levels[0]) * devc->voffset_ch1 + ch_levels[0];
+ offsets[0] = (offset >> 8) | 0x20;
+ offsets[1] = offset & 0xff;
+ sr_dbg("CH1 offset: %3.2f (%.2x%.2x).", devc->voffset_ch1,
+ offsets[0], offsets[1]);
+
+ /* Channel 2 */
+ ch_levels = devc->channel_levels[1][devc->voltage_ch2];
+ offset = (ch_levels[1] - ch_levels[0]) * devc->voffset_ch2 + ch_levels[0];
+ offsets[2] = (offset >> 8) | 0x20;
+ offsets[3] = offset & 0xff;
+ sr_dbg("CH2 offset: %3.2f (%.2x%.2x).", devc->voffset_ch2,
+ offsets[2], offsets[3]);
+
+ /* Trigger */
+ offset = MAX_VERT_TRIGGER * devc->voffset_trigger;
+ offsets[4] = (offset >> 8) | 0x20;
+ offsets[5] = offset & 0xff;
+ sr_dbg("Trigger offset: %3.2f (%.2x%.2x).", devc->voffset_trigger,
+ offsets[4], offsets[5]);
+
+ if ((ret = libusb_control_transfer(devc->usb->devhdl,