Have to share this

How often can you do the same to get to what you need.
pcVar16[10] = (char)uVar10; //Start on 10mns/div
set_fpga_trigger_timebase();
get_short_timebase_data(); //Uses the normal capture system to get the samples and calculate min, max, etc.
if (pcVar16[0x23] == '\0') //Trigger channel
{
calculate_ch1_min_max_avg();
iVar12 = DAT_8000278c; //0x801AC04A channel 1 buffer 4
}
else
{
calculate_ch2_min_max_avg();
iVar12 = DAT_80002788; //0x801AD7BA channel 2 buffer 4
}
uVar13 = 0;
puVar20 = (ushort *)(iVar12 + 0x14);
uVar18 = 0; //max value
uVar19 = uVar5; //0x0000FFFF min value
iVar11 = iVar4;
//Determine min and max value
do
{
uVar17 = (uint)*puVar20; //Active channel sample buffer
puVar20 = puVar20 + 1;
if (uVar18 < uVar17) //Get max
{
uVar18 = uVar17;
}
if (uVar17 < uVar19) //Get min
{
uVar19 = uVar17;
}
iVar11 = iVar11 + -1;
} while (iVar11 != 0);
uVar15 = 10;
uVar17 = uVar18 - uVar19 & 0xffff; //vpp
*(short *)(pcVar16 + 0x26) = (short)(uVar18 + uVar19 >> 1); //center value for trigger level 50%
This is part of the code to set the time base in the auto set routine. It calls the get_short_timebase_data() function to sample the data. Within this function, depending on the enabled channels, the functions calculate_ch1_min_max_avg() and calculate_ch2_min_max_avg() are called. And what did the programmer do after the call of this function, based on the current trigger channel, he calls one of these functions again. But that is not it. No we are not going to use the calculated data, we are going to determine them again, but now in our own "walk through the samples" loop.
So the answer is three

I have to say that this auto set function tops the lot in how not to do things.
Still have to check on how they decide which time base setting to use, and how it can be improved upon.
Once that is done I need to fill in the measurements and FFT bit. Rework the picture and waveform view bit and look into improving the signal representation with either select-able averaging or some sinc function.
The story keeps on going
