Skip to content

Halscope always 16 channels, and add user configurable samples#3722

Merged
andypugh merged 4 commits intoLinuxCNC:masterfrom
grandixximo:master
Jan 22, 2026
Merged

Halscope always 16 channels, and add user configurable samples#3722
andypugh merged 4 commits intoLinuxCNC:masterfrom
grandixximo:master

Conversation

@grandixximo
Copy link

The default memory has been increased, and user can set custom memory and restart to get less or more.

During the work on the jerk control have been using the scope a lot, this makes it a better tool for debugging.

@grandixximo grandixximo mentioned this pull request Jan 20, 2026
@grandixximo
Copy link
Author

I think I pulled at the wrong time, I will try to fix it

Luca Toniolo added 2 commits January 21, 2026 13:10
- Add GUI control for sample count in acquire dialog with config file
  persistence (SAMPLES command read before scope_rt loads)
- Always enable all 16 channels - remove confusing record length radio
  buttons that forced tradeoff between channels and samples
- Initialize sample_len and rec_len in init_horiz() so sampling works
  immediately without opening acquire dialog
- Add bounds checking for num_samples (min 1000, max 1000000)
- Increase default window size to 1050x550 for better channel display
- Show restart message when sample count changed (requires reload)
@grandixximo
Copy link
Author

Is retro compatibility important?
Like if switch back to 2.9, you want to open the 2.10 new halscope files, should that be supported?
I would need to add my new settings in a comment as the .halscope file, is that acceptable? or screw retro-compatibility?

2.10 can open 2.9 settings, but 2.9 will not understand 2.10 settings

@grandixximo
Copy link
Author

grandixximo commented Jan 21, 2026

I implemented full bidirectional compatibility, so whomever switches branches won't be bothered by the changes

@hansu
Copy link
Member

hansu commented Jan 21, 2026

What happens if 2.9 halscope reads a 2.10 halscope file? If it still reads all "old" parameters except the new ones it would be no problem. But I haven't looked into it if it may fail to read the file at all?

@grandixximo
Copy link
Author

grandixximo commented Jan 21, 2026

What happens if 2.9 halscope reads a 2.10 halscope file? If it still reads all "old" parameters except the new ones it would be no problem. But I haven't looked into it if it may fail to read the file at all?

Previous commit 2.9 would just not open the new files, probably cause I had the new config in the header, but I think it makes more sense to have it in the header as a comment which 2.10 can parse, and 2.9 ignores, already pushed the commit to fix this...

@andypugh
Copy link
Collaborator

I am not sure that Halscope usefully opens files?
You can save-out the data files but AFAIK you can't load one in to analyse it.
#966
While you are at it.... :-)

@hansu
Copy link
Member

hansu commented Jan 21, 2026

I am not sure that Halscope usefully opens files?

It can open configuration files...

@grandixximo
Copy link
Author

On it

@grandixximo
Copy link
Author

Simple job for my stochastic parrot 🤭
I tested, everything seems in order, you can open a log and view it, even if you don't have the pins of the original logger, phantom log pins will be created for you, and forced to be enabled, the CVS also contains the configuration, so everything will look like what it did in the original log scaling and position, but it can be changed zoomed etc, rolling will clear the loaded log.

@andypugh
Copy link
Collaborator

Thanks for this.

@andypugh andypugh merged commit 891b22b into LinuxCNC:master Jan 22, 2026
14 checks passed
@snowgoer540
Copy link
Contributor

This seems in a few ways a step in the right direction for modern hardware, but it seems there are also a few issues...

  1. On my system, no matter what I do, I cant get it to increase the number of samples. It is locked at "Current: 32000 samples (2000 per channel)". I've tried everything I can think of, it appends the autosave.halscope file correctly, but upon the next launch of halscope, the only thing that has changed is the "Samples (16 channels):" field. It shows the value I saved, but it remains at "Current: 32000 samples (2000 per channel)".
  2. I am a bit unsure why you did away with the chooser for the number of channels (and subsequently the samples per channel). In the new version the number of Samples I choose is divided among all 16 channels, always, whether I use them or not. So if I want 32000 samples on 1 channel. I have to make my Samples 512,000 (32000 * 16). Is that the intent?
  3. When I launch halscope. I get these errors in the terminal window:

halscope: command not implemented: '# SAMPLES 32000'
halscope: config file 'autosave.halscope' caused 1 warnings

I think (pretty sure) that is because in the function "read_config_file" in scope.c, there is no way to handle comments. So it tries incorrectly to execute the command # SAMPLES 32000, when that line should be ignored.

@grandixximo
Copy link
Author

This seems in a few ways a step in the right direction for modern hardware, but it seems there are also a few issues...

1. On my system, no matter what I do, I cant get it to increase the number of samples.  It is locked at "Current: 32000 samples (2000 per channel)".  I've tried everything I can think of, it appends the autosave.halscope file correctly, but upon the next launch of halscope, the only thing that has changed is the "Samples (16 channels):" field.  It shows the value I saved, but it remains at "Current: 32000 samples (2000 per channel)".

2. I am a bit unsure why you did away with the chooser for the number of channels (and subsequently the samples per channel).  In the new version the number of Samples I choose is divided among all 16 channels, always, whether I use them or not.  So if I want 32000 samples on 1 channel. I have to make my Samples 512,000 (32000 * 16).  Is that the intent?

3. When I launch halscope. I get these errors in the terminal window:

halscope: command not implemented: '# SAMPLES 32000' halscope: config file 'autosave.halscope' caused 1 warnings

I think (pretty sure) that is because in the function "read_config_file" in scope.c, there is no way to handle comments. So it tries incorrectly to execute the command # SAMPLES 32000, when that line should be ignored.

Need restart linuxcnc to get bigger buffer.
I can ask user to input per channel memory, and then multiply internally by 16, I did away with choose how many channels, because the messages when you needed more channels were annoying.
For retro compatibility the new sample count is in a comment, but the counter effect is that comments are not really ignored anymore, can you share the halscope file? did you write comments manually?

@snowgoer540
Copy link
Contributor

snowgoer540 commented Feb 1, 2026

Need restart linuxcnc to get bigger buffer.

Wow, I feel a bit silly, but that was not apparent to me. I took the message at face value: "The new sample count (512000) will take effect the next time halscope is started." It seems it should be modified to say that linuxcnc needs to be restarted entirely.

I do wonder why we need to restart though. It seems like it's memory allocation, but is there a problem with just setting the necessary memory to a max? In modern PCs this can only be a few Mb, right?

I can ask user to input per channel memory, and then multiply internally by 16, I did away with choose how many channels, because the messages when you needed more channels were annoying.
It was just a bit counter intuitive. I think things might be better if restarting linuxcnc was not necessary.

For retro compatibility the new sample count is in a comment, but the counter effect is that comments are not really ignored anymore, can you share the halscope file? did you write comments manually?

the contents of the file are just:

# SAMPLES 512000
MAXCHAN 16
THREAD servo-thread
HMULT 1
HZOOM 1
HPOS 5.000000e-01
TMODE 0
RMODE 0

I did make a quick modification to read_config_file to ignore lines with comments, and it made the aforementioned errors go away. It's trying to pass the commented line to parse_command() and it does not like it.

@snowgoer540
Copy link
Contributor

I created this pull request that addresses the above:

#3788

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants