Skip to content

Commit ce73f6b

Browse files
committed
halscope: fix initialization of gain/scale for new channels
This fixes a glitch introduced during the gtk2-to-gtk3 update. To reproduce the glitch: 1. Check out the parent of this commit. 2. Build everything. 3. Remove any `autosave.halscope` file from the `configs/sim/axis` directory. 4. Start linuxcnc with the `sim/axis/axis` config. 5. Start halscope. Select the signal `Xpos` on channel 1 and `Xvel` on channel 2 (or whatever, this is just an example and not relevant to the problem). Note that the trigger arrow indicator does *not* show up in the trace window, and the "Trigger Level" slider does *not* have any effect (level stays at 0.0 even if you move it). This is one symptom of the bug. 6. Switch the Trigger Run Mode to "Normal". 7. Make some motion in Axis to trigger the scope. Note that the scope triggers but the display *doesn't* show any traces (though the trace names show up now). This is another symptom of the bug. 8. Quit halscope (so it writes `autosave.hal`) and restart it. It loads the new `autosave.halscope` config file, and now everything works. The Trigger Level slider is updated to whatever it was left at when you quit, and if you trigger it the traces show up as expected. Before the gtk3 update (i.e. before #1156 was merged in commit 2ff6c6b), halscope used to force the trigger level slider widget to run its "value changed" callback, but that function was deprecated by gtk3 and the call was simply removed, causing this bug. This commit calls the callback directly there instead, so the callback can initialize the stuff it needs to.
1 parent 49433d4 commit ce73f6b

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/hal/utils/scope_vert.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,6 +1094,11 @@ void channel_changed(void)
10941094
gtk_adjustment_set_lower(adj, chan->min_index);
10951095
gtk_adjustment_set_upper(adj, chan->max_index);
10961096
gtk_adjustment_set_value(adj, chan->scale_index);
1097+
1098+
// Call the `scale_changed()` callback once by hand to initialize
1099+
// the new channel's scale/gain.
1100+
scale_changed(adj, NULL);
1101+
10971102
/* update the channel number and name display */
10981103
snprintf(buf1, BUFLEN, "%2d", vert->selected);
10991104
name = chan->name;

0 commit comments

Comments
 (0)