/*
Developed by Oliver Gorzellik at Wittig Technologies AG (c) 2005-2007
Review partial by Thomas M. Wittig (TMW) from June 2008
TMW: "Some bugs found, not easy to understand software structure"
TMW: "All to be improved!!!"
-------------------------------------------------------------------------------------------------------------------------
Open source development
-------------------------------------------------------------------------------------------------------------------------
Author	:	Hayo.W (blueflash)
Sign	:	BF
Date	:	05.Nov.2008
version	:	1.2.BF.0.1

-------------------------------------------------------------------------------------------------------------------------
Open source development history
-------------------------------------------------------------------------------------------------------------------------
| 05.Nov.2008 | 1.2.BF.0.1   | New FFT implementation prototype - no function yet
| 06.Nov.2008 | 1.2.BF.0.5   | Changed grid division and size (from 600 x 384 to 600 x 400)
| 09.Nov.2008 | 1.2.BF.0.6   | New grid for XY-Mode, changed offsets and calculating values due to
|             |              | the new grid dimension and divisions. Replaced numeric values with
|             |              | global defined constants for better maintenance.
|             |              | Testing two different grid layouts (standard oszi with solid lines versus
|             |              | proprietary layout with dotted lines). Optional switching via menue maybe an idea.
| 10.Nov.2008 | 1.2.BF.0.7   | Fixed some offsets and test some other rotary timings
| 10.Nov.2008 | 1.2.BF.0.8   | Fixed some offsets and test some other rotary timings
| 10.Nov.2008 | 1.2.BF.0.9   | New Grid for delayed mode with dimension 600 x 400 - takes no effect because of loading
|             |              | the grid from flash
| 11.Nov.2008 | 1.2.BF.0.10  | Fixed some values in the grids and planes, direct draw of delayed grid - no flash load
| 11.Nov.2008 | 1.2.BF.0.11  | Draw new startscreen after setup default values, reactivated UIPlane3 in function
|             |              | ClearMenuItem()
| 12.Nov.2008 | 1.2.BF.0.12  | New button handler functions for function keys 1 - 6 in main button handler for better
|	      |              | readable structure.
|             |              | Test if grids are loaded from flash - switch off grid drawing
| 12.Nov.2008 | 1.2.BF.0.13  | No flashloading for the grids anymore, all grids are drawn directly
| 13.Nov.2008 | 1.2.BF.0.14  | Changed menu structure for switching Main/Delayed/XY mode, fixed failure in delayed grid
| 13.Nov.2008 | 1.2.BF.0.15  | Added LED test in Hardware init routine
| 14.Nov.2008 | 1.2.BF.0.16  | Fixed grid overwriting when popdown is called 
| 14.Nov.2008 | 1.2.BF.0.17  | Changed LED test, change some calculations in Cursor function to fix x-cursor offset,
|             |              | corrected Voltage offset due to new grid dimension,
| 14.Nov.2008 | 1.2.BF.0.18  | Corrected trigger cursor position in delayed window, added comments for better understanding
| 14.Nov.2008 | 1.2.BF.0.19  | Added floatprintf() because printing float values to RS232 with printf causes
|             |              | a systemcrash in open source FW
| 18.Nov.2008 | 1.2.BF.0.20  | Corrected the pre trigger calculating routine and added new time base table 
| 19.Nov.2008 | 1.2.BF.0.21  | Corrected the floating point printing routine. Values are printed with after dot
|             |              | positions now. Fixed overflow and underrun and cleaned up the variable declarations
|             |              | in this routine.
| 20.Nov.2008 | 1.2.BF.0.22  | Renamed global variable Trig_Mem_Pos into MemWinStart. Corrected trigger cursor Y-position
|             |              | 2 Pixels down. Corrected names of signal drawing routines due to vector and non vector 
|             |              | Corrected menu check for vector drawing in DRAWSIGNALS()
| 21.Nov.2008 | 1.2.BF.0.23  | New default values for zero levels, deleted some unused variables
| 23.Nov.2008 | 1.2.BF.0.26  | Fallback from version 0.25 to 0.23 added manual ADC correction to reduce signal noise, which is 
|             |              | generated by poor adjustment of the offsets between the 4 ADCs of each channel
| 03.Dec.2008 | 1.2.BF.0.27  | Changed signal drawing routines, changed ADC-routines and offset calculation, new function
|             |              | for auto ADC correction to reduce signal noise, which is generated by poor adjustment of the
|             |              | offsets between the 4 ADCs of each channel
| 03.Dec.2008 | 1.2.BF.0.28  | Bug in function RenderText() fixed, changed zero correction
| 05.Dec.2008 | 1.2.BF.0.29  | changed complete signal drawing routines
| 07.Dec.2008 | 1.2.BF.0.30  | changed complete signal drawing routines
| 16.Dec.2008 | 1.2.BF.0.31  | changed complete signal drawing routines, implemented some test switches
| 17.Dec.2008 | 1.2.BF.0.32  | optimized interrupt handling, no Signal output when Interrupt occured
| 31.Jan.2009 | 1.2.BF.0.33  | some further changes in the drawing routine, especially in delayed mode and math channel
|	      |              | still buggy: offset in delayed window, spikes on timebase < 50ns produced while interpolation 
| 01.Feb.2009 | 1.2.BF.0.34  | fixed the spike problem in interpolation routine -> complete new simplified (and faster!) interpolation
| 01.Feb.2009 | 1.2.BF.0.35  | deleted old interpolation routine, freed unused resources
| 04.Feb.2009 | 1.2.BF.0.36  | new math calculating due to the new drawing routine, added new level 0 function ProcessSignalData() in 
|             |              | class Display and transferred the math routines from ADC-handler to it. Fixed Pmin - Pmax drawing.
| 07.Feb.2009 | 1.2.BF.0.37  | Changed handling of UI interrupt again. Deleted the unused function ClearFlips(). Added new 
|             |              | level 0 function Transfer_USB_Data() and moved coding from Handle_ADC() to it
| 10.Feb.2009 | 1.2.BF.0.38  | redesigned the math functions with new scaling and offset calculation, changed rotation direction of
|             |              | math menu to direction of the other settings (left -> ascending, right -> descending)
| 27.Feb.2009 | 1.2.BF.0.39  | Second prebeta version, improved math-function, new scaling, offset adjusting has still to be done... 
|             |              | math support for delayed mode added
| 28.Feb.2009 | 1.2.BF.0.40  | deactivated ADC calibration for channel 3 + 4 because of missing test environment, changed some 
|             |              | interpolation parameters and renamed function preinterpolate() into interpolate()
| 03.Mar.2009 | 1.2.BF.0.41  | implemented math offset, fixed problems in 10ns and 20ns timebase, optimized drawing routine (faster)
| 05.Mar.2009 |              | renamed some variables, deleted unused resources, cleaned up sources, corrected point drawing (non vector)
|             |              | added interpolation for math channel
| 20.Mar.2009 | 1.2.BF.0.42  | fixed inversion bug, corrected math zero calculation, corrected drawing Y-offset, reactivated 
|             |              | zero calibration for channel 3 + 4
| 22.Mar.2009 | 1.2.BF.0.43  | capsulated math functions in separate function modules, redesigned processing of drawing routines,
|             |              | optimized coding, added interpolation for 5ns
| 23.Mar.2009 | 1.2.BF.0.44  | added math calculation for delayed signal, fixed drawing offsets, cleaned up main drawing routine,
|             |              | fixed memory overflow in interpolation routine
| 24.Mar.2009 | 1.2.BF.0.45  | redesigned interface of T-Y drawing routine, deleted unused variables, first beta version!
| 26.Mar.2009 | 1.2.BF.0.46  | complete new X-Y drawing routine with new interface and vector function, line drawing is very slow
| 30.Mar.2009 | 1.2.BF.0.47  | complete new (faster) line drawing function under construction, implemented new experimental 
|             |              | interpolation timebase 5ns
| 30.Mar.2009 | 1.2.BF.0.48  | implemented Bresenham line drawing algorithm which is much faster now (about 10 times), deactivated
|             |              | new timebase for the new beta release because of overflow problems -> will be reactivated later,
|             |              | added solid / dotted lines for XY-Grid
| 31.Mar.2009 | 1.2.BF.0.49  | line() drawing is default now because of the new faster line() function which is not slower now
|             |              | than the optimized signal drawing but shows more details, correkted  direction of X-deflection, 
|             |              | storing ZeroLevel, mathvalues, alpha-correction and ADC-correction in config flash,
|             |              | implemented new ground functionality which writes real zero (ADC_ZERO) to the signal buffer instead of 
|             |              | just drawing a line at zerolevel, activated zero adjustment for XY-mode, changed the rotary characteristic
|             |              | to square function, fixed XY-zero adjustment bug
| 05.Apr.2009 | 1.2.BF.0.50  | XY-support for channels 3 + 4, XY-zerolevels are stored in flash now
| 14.Apr.2009 | 1.2.BF.0.51  | deleted some unused variables, changed default for zeroes, changed init routine, switched of zero signs for
|             |              | channel 3 + 4 in XY-Mode, changed menu handling for XY-mode
| 18.Apr.2009 | 1.2.BF.0.52  | reactivated new designed zero shift, calibrated scale factors, calibrated shift factors,
|             |              | new square function characteristic 1/4 * X² + X for zero wheels and triggerlevel, added new interpolated
|             |              | timebase 5ns -> still some problems, corrected trigger time offsets, fixed pixel failure in trigger cursor
|             |              | new square function characteristic 1/2 * X² + X for memory position wheel
| 21.Apr.2009 | 1.2.BF.0.53  | changed square function characteristic to X² + X for memory position wheel, fixed bug in ADC-calibration
|             |              | corrected  timebase selection in timebase wheel handler for new timebase 5ns, new cubic charactistic 
|             |              | X³ + X for position wheel, blocking delayed mode for timebase 5ns, new virtual zero for ground coupling,
|             |              | fixed shifted inversion bug
| 21.Apr.2009 | 1.2.BF.0.54  | new zero calibration
| 08.May.2009 | 1.2.BF.0.55  | new fast integer scaling in drawing routine, added testfunction 1 and 2 written by Guido, pixel connecting 
|             |              | is active for default again to increase speed 
| 08.May.2009 | 1.2.BF.0.56  | fixed bug in XY-drawing routine in single point mode reported by Kurt Bohnen, optimized drawing speed by
|             |              | scaling without any multipliing,complete new calibration unit, new Button for Calibration in the utility menu,
|             |              | fixed bug in SearchZero() for channel 3 + 4
| 11.May.2009 | 1.2.BF.0.57  | changed DAC-calibration, renamed variable Channelx_Zero_Sign_Offset_y into CHx_DAC_Correction_y corresponding
|             |              | to the real function of this variable,
| 12.May.2009 | 1.2.BF.0.58  | searching for freeze-bug, -> got it, 
| 15.May.2009 | 1.2.BF.0.59  | changed ADC start/stop logic to fix freeze bug, detected new timebase bug wich is also present in actual FW 1.4
|             |              | -> timebases greater than 20s are running in 50ns mode, changed config saving in new ADC-calibration routines,
|             |              | changed UI-request handling - flag is deleted in UI-handlers only now,
| 15.May.2009 | 1.2.BF.0.60  | change zero level correction variables to array, renamed VoltageCorrectionfloat to ZeroScaleFactor
|             |              | adjusted ZeroScaleFactors, stored new grid and draw settings into Flash
| 16.May.2009 | 1.2.BF.0.61  | cleaned up sources from obsolete and unused coding (rollmode etc.), DAC-calibration only for active channels,
| 16.May.2009 | 1.2.BF.0.62  | optimized DAC-calibration and adjusted scale factors for zero level, found some register settings for 
|             |              | channel 3 + 4 that must be checked -> SetupADC() -> changed register settings
| 16.May.2009 | 1.2.BF.0.63  | fixed "cut of signal" bug which was found and solved by Guido, repaired trigger problem which occured
|             |              | with version 0.60 because of deletion of some scaling factors, fixed remaining pixel error in TransferPlanes()
|             |              | which was solved by Guido, ADC-assembler routines changed by Stefan to fix correction error in averaging and
|             |              | inversion mode, fixed "undeleted trigger cursor error" which left sometime "dead" cursors on the screen after
|             |              | using default setup.
| 20.May.2009 | 1.2.BF.0.64  | implemented roll and shift mode for ultra slow timebases, new buttons in timebase menu for roll/shift mode,
|             |              | forced auto trigger for USTB-mode,
| 28.May.2009 | 1.2.BF.0.65  | added Stefans fixes for triggering, cleaned up ReadOut_Signal() from obsolete parameter found by Stefan,
|             |              | added Sefans definitions for menu structure, added similar fix like Stefans in USB-Routine,
|             |              | added correction for trigger values
| 28.May.2009 | 1.2.BF.0.66  | missing cursor data fixed by Guido
| 28.May.2009 | 1.2.BF.0.67  | changed USTB timer control from start/stop to continiuos, deactivated all 
|             |              | timer 1 routines -> useless stuff, deleted CopySignal() -> unused, fixed XY-Mode freeze in slow timebases,
|             |              | implemented USTB-support for XY-mode, fixed Menu inconsistency after start, improved "restart memory" -> DSO 
|             |              | "remembers" now about timebase menu settings, fixed interrupt initialisation at starting sequence,
| 01.Jun.2009 | 1.2.BF.0.68  | Changed menu structure for display menu,timebase menu and utility menu
| 03.Jun.2009 | 1.2.BF.0.69  | redesigned USTB timing control -> new ultra slow timebases 2S/1S/500mS, fixed minor bug memory window
|             |              | wrong initialized, 
| 03.Jun.2009 | 1.2.BF.0.70  | optimized USTB-refresh, changed begin of USTB-Range to 1S - 500mS is a normal TB now
| 07.Jun.2009 | 1.2.BF.0.71  | implemented Guidos harware C-routines as testfunction (shift + S) 
| 08.Jun.2009 | 1.2.BF.0.72  | separated C-routines in own new functions to avoid cross effects, C-routines are available via testswitch 1
|             |              | (shift + S) for channel 1 only,
| 09.Jun.2009 | 1.2.BF.0.73  | implemented new FFT routines, new FFT grid, reactivated and changed FFT menu structure, added FFT drawing routine
|             |              | added test signal generator in utility menu, added FFT spectral analysis function, changed trigger offset calculation
|             |              | testet interpolation with low pass filter, but results are worse than simplified routine -> commented coding out
| 13.Jun.2009 | 1.2.BF.0.74  | corrected zoom factor table and zoom index table for correct triggering in 5nS + 2nS TB, changed scroll sensitivity
|             |              | and scroll speed for pretrigger and memory position, in interpolated TB the single point option shows only real
|             |              | values - interpolated values are dropped (for Bruno), when switching drawing mode a popup is shown (for Bruno),
|             |              | added signal coupling support for test signal generator,
| 15.Jun.2009 | 1.2.BF.0.75  | fixed bug in test signal generator
| 15.Jun.2009 | 1.2.BF.0.76  | FFT is running with floating point calculation now, implemented FFT with 512 and 1024 points
| 20.Jun.2009 | 1.2.BF.0.77  | implemented integer calculation for FFT - performance increased by factor 8 - 10!
| 25.Jun.2009 | 1.2.BF.0.78  | implemented fast table based prescaled integer logarithm for FFT, new functions for centering and
|             |              | restoring zero levels, fixed channel number display bug and changed status bar update, changed Math and FFT menu logic,
|             |              | repared menu update logic, repaired math zero level correction,
| 28.Jun.2009 | 1.2.BF.0.79  | added new c-coding from Guido for readadc_all(), added new screenshot function from Niklas
| 28.Jun.2009 | 1.2.BF.0.80  | new FFT-scaling,
| 28.Jun.2009 | 1.2.BF.0.81  | fixed channel 3 + 4 restore settings when coming back from FFT, placed Niklas screenshot() function directly on 
|             |              | Quick Print button and deactivated QP-Menu, popuptimer is deactivated when screenshot is active,
|             |              | cleaned up UART ISR
| 03.Jul.2009 | 1.2.BF.0.82  | added complete redesigned QM function -> credits to Stefan
| 04.Jul.2009 | 1.2.BF.0.83  | redesined and improved FFT functions, redesigned and optimized zero sign drawing, redesigned pretrigger calculation, 
|             |		     | adjusted vertical cursor data, fixed single shot and start/stop problem when changing timebase, 
|             |		     | corrected Y-position of memory window, fixed dimension bug in floatstr.cpp, repaired button drawing,
|             |		     | added two step logic for delta cursor data,
| 12.Jul.2009 | 1.2.BF.0.84  | added Falks screenshot improvements, added two step logic for QP-button,
| 14.Jul.2009 | 1.2.BF.0.85  | added new noise suppression in ACQUIRE menu, added display layout switch in FFT menu
| 14.Jul.2009 | 1.2.BF.0.86  | fixed button logic in acquire menu, fixed double shot problem at QP, fixed error in FFT-windows selection,
|             |              | new direct FFT source selection via channel buttons,
| 19.Jul.2009 | 1.2.BF.0.87  | new class and file structure, changed main program from object processing to static calls
| 21.Jul.2009 | 1.2.BF.0.88  | changed refresh control of signal drawing for better zerolevel adjustment, added new screenshot version from Falk,
|             |              | optimized rotary characteristic for pretrigger adjustment, 
| 22.Jul.2009 | 1.2.BF.0.89  | fall back to screenshot version 0.4 because of problems,
| 24.Jul.2009 | 1.2.BF.0.90  | modified screenshot version 0.4 to 13 Planes (without memory planes) -> 0.4BF, fixed QM active after direct screenshot,
|             |              | new QP menu structure,
| 24.Jul.2009 | 1.2.BF.0.91  | improved noise filter, added noise filter support for interpolated timebases,
| 03.Aug.2009 | 1.2.BF.0.92  | Holiday Edition - new adc_change-register setting inspired by Falk, register settings are not loaded from protected 
|             |              | flash any more, implemented USTB-support for auto scale (ticket 3), switched of the forced AC-coupling at autoscaling
|             |              | changed signal drawing in accurate drawing mode (with line() function) to suppress screen output when the line segment
|             |              | is out of range (ticket 7), repaired and improved save/recall function, solved trigger mode problem after recalling
|             |              | signals (ticket 5), added full USTB support for save/recall function, fixed channel active LEDs error,
|             |              | found spike problem at end of signal buffers, implemented solution for the spike problem (new adc_change-register setting), 
|             |              | fixed Math-LED error (ticket 26), fixed text layer problem -> fixed delta cursor text deletion problem (ticket 8), 
| 09.Sep.2009 | 1.2.BF.0.93  | fixed text layer deletion problem while screen-refresh (no text in popup-menu), fixed undo autoscale bug,
|             |              | fixed grid intensity bug, reorganized main led control for all menus, fixed cursordata deletion bug, implemented new
|             |              | startup logic with new restoring from flash, implemented new trigger source change logic when switching on/off the channels,
|             |              | repaired first display line of background in top area (layer 3)
| 28.Sep.2009 | 1.2.BF.0.94  | updated Falks remote interface to actual version,
| 29.Sep.2009 | 1.2.BF.0.95  | updated UART-ISR to actual version, 
| 30.Sep.2009 | 1.2.BF.0.96  | fixed "shifting signal" problem in stop mode and noise filter active (same problem as in ticket 39), implemented new 
|             |              | single shot logic, changed UI-request handling for rotary interface, cleaned up sources and unused variables
| 05.Oct.2009 | 1.2.BF.0.97  | fixed auto scale trigger restore, new rotary handling in stop mode, shifted startup sequence from rotary interface
|             |              | to own function module, fixed freeze problem when turning zerolevel of inactive channel,
|             |              | corrected and optimized zero sign drawing, updated Falks remoteinterface from OS, updated QM-function from OS,
|             |              | optimized UI_request handling for zero level adjustment,
| 20.Mar.2010 | 1.2.BF.0.98  | added #001 channel delay compensation, fixed splash freeze which appeared with 0.97, new utility submenu, 
|             |              | added #002 new variable register setting in utility submenu, added new function to get
|             |              | register factory setting from protected flash, fixed some minor bugs, optimized Startup(),
|             |              | made remote interface and screenshot compatible to actual OS-version (92a), implemented Stefans new combi-trigger,
|             |              | redesigned DAC-calibration, transferred DAC-correction values from config to protected flash,
| 28.Mar.2010 | 1.2.BF.0.99  | with gain switch (shift + G) the hardware amplification for the 2er and 1er voltage ranges can be switched between
|             |              | 1 (standard) and 1.25 -> this reduces the noise in the 1er and 2er ranges, with the third gain index there
|             |              | is a compensated scale factor available for devices with modified resistances in the preamp output, added new
|             |              | test value in ADC-Setting
| 16.Apr.2010 | 1.2.BF.0.100 | #003 redesigned delayed mode -> ticket #34
| 20.Apr.2010 | 1.2.BF.0.101 | #004 new utility menu structure with settings for preamp gain 
| 20.Apr.2010 | 1.2.BF.0.102 | fixed Auto trigger bug in USTB-Mode and Single-Mode which occured because of the new Combi trigger, fixed Continiuos Bug
|             |              | in "About Oscilloscope" menu
| 21.Apr.2010 | 1.2.BF.1.0   | first stable release! Cleaned up coding from unused functions and variables, added new menu init function #005,
|             |              | freed unused memory area, checked ticket #48 -> seems ok, Ticket #50 fixed, checked Ticket #24 -> seems ok,
|             |              | Ticket #37 fixed, fixed double writing to flash at timebase change, checked ticket #35 -> seems to be ok,
|             |              | added button in Quick Print menu to choose screenshot version #006, added menu popup init function #007
| 23.Apr.2010 | 1.2.BF.1.1   | recalculated and adjusted all scaling factors, new scaling for 33 Ohm setting and gain 1.25 #008, fixed exchanged entries in 
|             |              | ADC-Setup menu, made screenshot function work more stable,
| 27.Apr.2010 | 1.2.BF.1.2   | solved ticket #31 -> implemented QM support for interpolated Tb #009, corrected menu entries in QM selection,
|             |              | added QM support for ultra slow timebases, 
| 01.May.2010 | 1.2.BF.1.3   | fixed channel bug at switching FFT, reorganized flash routines and fixed several problems #010, stabilized startup routine,
|             |              | added new flash backup areas in unused sectors, fixed switching logic in math menu, added special flash load logic,
|             |              | new FFT-grid frequency division which is switchable via multiple pushing grid switch in the display menu, 
|             |              | stabilized channel switch logic,fixed some bugs in the FFT-prepare sequence,
| 08.May.2010 | 1.2.BF.1.4   | added Save/Recall support for FFT, new restore button in Save/Recall menu, fixed USTB timer 2 bug which was caused by
|             |              | the new flash routines, made grid switching logic more stable, improved the Run/Stop function for FFT and for switching
|             |              | between FFT and time mode,
| 10.May.2010 | 1.2.BF.1.5   | changed flash writing logic to make it faster but also save, implemented new overlay function but let the menu inactive #013,
|             |              | new RMS calculation for quick measure #014, 
| 26.May.2010 | 1.2.BF.1.6   | reorganized Save/Recall #016, new USB routines under construction #017, repaired WELEC USB interface, communication with
|             |              | PC-software works partly - some bugs are in the PC-sofware and can't be fixed, WELEC USB-Firmware update works but needs
|             |              | 1 hour and twenty minutes -> not usable, fixed signal freeze at lower timebases caused by ISR of timer 3 (browswer window) #018,
|             |              | zero signs are displayed in USTB-Mode now,
| 10.Jun.2010 | 1.2.BF.1.7   | deactivated the browse function for USTB mode, deleted pretrigger sign in USTB mode, corrected and reorganized external
|             |              | trigger settings and level #019, deactivated Reject Button in Trigger Mode/Coupling menu #020 because of no function,
|             |              | repaired source channel setting for puls width triggering #021,
| 10.Jun.2010 | 1.2.BF.1.8   | set new values for external trigger default setup, changed register settings for ext. LF Reject / HF Reject / Line (-> Jürgen)
| 10.Jun.2010 | 1.2.BF.1.9   | tried to correct the channel 3+4 problem at external triggering (signal only every second time) #022 but found no solution
| 10.Aug.2010 | 1.2.BF.1.10HE| activated and completed the overlay function for trace recall, repaired Save/Recall bug depending on wrong sector offset 
|             |              | which produced data trash on channel 3 + 4, fixed menu bug in trigger mode popup when switching between normal and USTB-mode,
|             |              | improved menu logic for USTB <-> normal switching,
| 19.Aug.2010 | 1.2.BF.1.11  | fixed trigger mode menu bug in timebase logic, new improved timebase logic for stop/recall/overlay #023,
|             |              | changed Run/Stop/Single logic, several little improvements, 
| 28.Aug.2010 | 1.2.BF.2.0   | New lookup table scaling in all drawing routines, fixed XY-mode startvalue bug, added math inline functions from Rolf
|             |              | speed up RMS calculation, adjusted FFT-scaling, fixed FFT source channel status display, fixed pulse width bug, 
|             |              | added new toggle function in trigger mode menu #025, added support for additional LEDs, corrected pulswidth symbol
|             |              | in status area, fixed single trigger bug, redesigned DAC calibration, deleted bad working original calibration routine,
|             |              | improved ADC calibration, redesigned DAC-control for zeroline adjustment, changed start/stop logic to avoid channel 3 + 4
|             |              | blinking problem, adjusted scaling factors, added persistent display reset for TB changes, homgenized button design
|             |              | with checkbox in menus math/timebase/acquire, changed (pre) trigger logic for channel 3 + 4, added pulse width trigger 
|             |              | correction from Jürgen (JK), set external pulse width trigger inactive because of malfunction, implemented new trigger
|             |              | Auto Level function, implemented timer controlled trigger line #026, new scaling factors für 24,9 Ohm resistor modification
|             |              | from Jürgen, fixed noise filter bug in interpolated TB, calibrated ultra slow timebases, 
| 02.Nov.2010 | 1.2.BF.2.1   | corrected sample rate display on status bar, implemented new two stage noise filter, new menu popups in the acquire menu, 
| 03.Nov.2010 | 1.2.BF.2.2   | implemented IIR filter with 1 - 3 stages, complete redesigned vertical cursor control, corrected XY-cursor implementation,
|             |              | fixed MenuPopupInit() bug, filter switching in stop mode is supported now, filter scrolling bug in stop mode is fixed,
|             |              | fixed bug in FFT cursor calculating, 
| 03.Nov.2010 | 1.2.BF.2.3   | corrected signal reprocessing bug in stop mode, new memory control,
| 07.Nov.2010 | 1.2.BF.2.4   | new rotation characterisic for memory scrolling, added new function Auto Pretrigger to the pretrigger button in the edge menu,,
|             |              | fixed signal error at 4K memory end, pretrigger position at TB-change is constant now 
| 11.Nov.2010 | 1.2.BF.2.5   | improved overlay mode -> filter setting can be changed and shows direct effect now, cleaned signal from data trash at
|             |              | signal start and end, new average pulldown menu in Acqire settings,corrected cursor offset values for interpolated delayed TB 
| 11.Nov.2010 | 1.2.BF.2.6   | deleted average section in ADC assembler routine -> all ADC operations are running faster now, new C-coded average routine
|             |              | which is running much faster than the old assembler routine, corrected delayed memory error in smooth/strong filter mode,
| 16.Nov.2010 | 1.2.BF.2.7   | new C-coded inversion routine, deleted inversion section in ADC assembler routine, deletet unused parameters in 
|             |              | assembler routine -> speed increased oncemore, corrected pretrigger compensation, corrected trigger on inverted signal,
| 26.Jan.2011 | 1.2.BF.2.8   | limitetd holdoff to 150ms, improved complete holdoff logic, modified startup sequence, corrected sinus table, 
|             |              | improved floatstr() class, added two new USTB ranges 500Sa/div and 1000Sa/div,
| 30.Jan.2011 | 1.2.BF.2.9   | fixed little stop/single bug, changed logic for trigger event LEDs, added manual trigger in Mode/Coupling menu,
| 31.Jan.2011 | 1.2.BF.2.9 C2| fixed Run/Sop bug which came with the new function in 2.9
| 31.Jan.2011 | 1.2.BF.2.10  | added 16 Bit DAC (LTC2602) support -> function is not tested yet, limited holdoff to 134ms, added manual trigger function to 
|             |              | single button, fixed signal freezing at TB-change when trigger source is channel 3 / 4, added empty function for Kurts
|             |              | hardware project to save screenshot on SD-cards, splitted Quick Print menu into two different parts for BF and OS version,
|             |              | fixed memory error at the end of the 4K memory (reported by Charly),
| 18.Feb.2011 | 1.2.BF.2.11  | fixed bug in Quick Print double push logic, added new functions from Kurt (KB) for screenshot export to SD-card,
|             |              | extended Quick Print menu, repaired pretrigger display at TB change, improved 16 Bit DAC support,
| 19.Feb.2011 | 1.2.BF.2.12  | automatic support for 12/14/16 bit DAC, deleted DAC-switch in hardware menu, new offset calibration which was adopted to
|             |              | the new DAC-control and works much more accuratly, combined DAC-calibration and ADC-calibration to one function with the
|             |              | new button "Calibrate Offsets", the old calibration buttons where replaced by the new calibration button and a popup menu
|             |              | for different calibration sets, fixed default setup menu refresh, added main wheel support for channel delay in extended
|             |              | utility menu, added main wheel support for average and noide filter selection in acquire menu, cleaned source from unused stuff
| 23.Feb.2011 | 1.2.BF.2.13  | re-engineered print functions, same functions for OS and BF versions, deleted OS Quick Print menu,
| 02.Mar.2011 | 1.2.BF.2.14  | fixed inversion bug in stop mode, added multiple push functionality for Edge button, Puls Width button and Main button
|             |              | provided by Niklas, created new extended trigger menu for trigger LED settings, corrected places afterdot calculating in
|             |              | floatstring class, new stable working manual trigger, new wheel characteristic for pretrigger and memory browser, 
|             |              | new popup menu for pre trigger settings, corrected config saving, added new screenshot improvements from Niklas,
| 07.Mar.2011 | 1.2.BF.2.15  | fixed signal loss after restarting with inactive channels, fixed freezing manual trigger problem,
| 16.Mar.2011 | 1.2.BF.2.16  | tested 16 Bit DAC support -> ok, added new auto pretrigger setting, implemented new zeroline adjustment with step width 
|             | beta         | grid division inspired by Niklas, fixed triggerlevel bug at switching between XY-mode and TY-mode, corrected CenterTrace(),
|             |              | corrected DispatchTraces(), corrected SetupTrigger(), cleaned sources from useless stuff, redesigned Autoscale(),
|             |              | fixed pre trigger bug in stop mode, redesigned timebase control, added screenshot improvements created by Niklas,
|             |              | fixed wrong character drawing on math scale button,
| 25.Mar.2011 | 1.2.BF.2.17  | redesigned autoscale again, implemented autoscale double push feature for slow tb, added progress indicator for
|             | beta         | autoscale and screenshot,
| 25.Mar.2011 | 1.2.BF.2.18  | added 10 new grid colour palettes,
|             | beta         |
| 25.Mar.2011 | 1.2.BF.2.19  | fixed several bugs, added DC offset detection for dispatch and autoscale, optimized autoscale,
|             | beta         |
| 25.Mar.2011 | 1.2.BF.2.20  | autoscale searches for trigger signal on the channels now, added Flat Top window for FFT, added autoscale setup for
|             | beta         | TB search strategy,
| 31.Mar.2011 | 1.2.BF.3.0   | new major relase, corrected plane order for screenshot, corrected format of hardware version string for screenshot,
|             | C2           | fixed menu initialization for 2 channel scopes, fixed data acquisition in calibration subroutine, added new plane order
|             |              | for B/W screenshots and USB-Host export, added progress indicator for B/W screenshot and USB-Host export,
|             | C3           | fixed B/W screenshot plane transfer
|             | C4           | fixed inversion Bug -> reported by Rainer
|             | C5           | fixed pixel failure at signal end in inversion mode, fixed .csv header format,
| 14.Jul.2011 | 1.2.BF.3.1   | Thailand holiday edition, fixed ADC-start sequence which causes USTB-error, implemented new USTB-engine V2.0,
|             | beta         | improved popup coding structure, added full inversion support, added support for memory browsing, 
|             |              | added full zero level change support, new drawing mode popup menu in the display menu, optimized drawing routines
|             |              | for better performance, new function "Center Window" in display menu,
| 03.Aug.2011 | 1.2.BF.3.2   | fixed math functions (add, subtract, multiply), implemented math support for USTB, improved USTB-engine 2.1,
|             | beta         | increased drawing speed with inline functions and modified pixel routines, changed startup sequence,
| 07.Aug.2011 | 1.2.BF.3.3   | new menu structure, changed display menu, new USTB menu, new FFT-display menu, changed FFT menu, changed timebase menu,
|             | beta         | changed math menu, 
| 09.Aug.2011 | 1.2.BF.3.4   | USTB-engine V2.2 - changed shift mode using smaller buffer sizes depending on TB, added trigger LED support for USTB,
|             | beta         | shift support only for TB > 2s, improved USTB-inversion, 
| 10.Aug.2011 | 1.2.BF.3.5   | USTB-engine V2.3 - roll mode supports 32KByte signal buffer now, new shift logic for shift mode with floating memory pointers, 
|             | beta         | shift mode supports 16KByte signal buffer with 80kByte shift range, shift mode is also supported for 1s / 2s TB now,
|             |              | changed memory mapping for signal buffers, added USTB math recalc function for stop mode, added Save/Recall support for 
|             |              | 16K Signals, no X/Y suport at this time, 
| 15.Aug.2011 | 1.2.BF.3.6   | fixed draw start problem which causes freezing signals when filter are active, exchanged browse button and USTB-submenu 
|             | beta         | button in timebase menu, added buffer refresh at USTB single shot start, fixed FFT display menu bug,
| 15.Aug.2011 | 1.2.BF.3.7   | changed cursor value output because of missing or slow refresh - the new output is much faster now, 
|             | beta         | improved pretrigger value output, improved pulswidth value output, optimized assembler code for building menu and deleteted
|             |              | a lot of useless stuff that works as performance killer, 
| 17.Aug.2011 | 1.2.BF.3.8   | fixed pretrigger refresh bug, fixed delayed cursor position calculation which was totally crap, deleted tons of now 
|             | beta         | unused vars, fixed QM-delayed cursor which where calculated also totally wrong,
| 19.Aug.2011 | 1.2.BF.3.9   | improved pretrigger sign drawing, addded Joergs new input stage support which will be activated when choosing item
|             | beta         | Add-On in the hardware gain menu,
| 21.Aug.2011 | 1.2.BF.4.0 HE| new major release, corrected math plane overwriting when menu popup is active, fixed delayed window overflow -> reported by Rainer,
|             |              | fixed buffer overflow which caused freezing FFT at slow TB, corrected, redisigned and added bitmaps for zero signs beside the grid,
|             |              | suppressed wrong button drawing in status area, improved rotary interface for faster TB-change and voltage change,
| 26.Aug.2011 | 1.2.BF.4.1 HE| fixed cursor data remove bug, added ground coupling for USTB, fixed QM signal pointer, added USTB support for quick print,
|             |              | fixed math plane overwriting in popups,
| 26.Aug.2011 | 1.2.BF.4.2   | repaired initial screen drawing, improved startup sequence, fixed FFT restart problem, improved statusbar drawing,
|             |              | new status bar design, redesigned statusbar switch logic, fixed round/dimension error in float value render routine,
|             |              | fixed QM-cursor removing bug, fixed rounding bug in value rendering routine, added monochrome status bar,
| 02.Sep.2011 | 1.2.BF.4.2   | added pulse width triger modification made by Juergen (JK), 
| 03.Sep.2011 | 1.2.BF.4.3   | changed menu structure, added new display setup menu, changed trigger menus, repaired puls width triggering with fix from Juergen,
|             |              | fixed floatstr() value rendering bug found by Juergen, new function "No Display" to force channels to background operating 
|             |              | (for triggering), added "adjust window" instead of "center Window" which positions the memory window due to the pretrigger settings,
|             |              | in Single Shot mode timebase can be changed now (special wish from Charly),
| 06.Sep.2011 | 1.2.BF.4.4   | some minor fixes, changed startup sequence and splash drawing/removing, redesigned button pushed mimic, changed button logic for
|             |              | FFT and XY-mode, improved autoscale, changed amplitude values to scaled screen values, adjusted amplitude threshholds for 
|             |              | auto scale, fixed menu buttons overwriting at QP caused by using UI2 buffer plane, added popup copying to screenshot, 
|             |              | added Juergens changes for external trigger, fixed recall trace problems with old channel and QM settings,
| 10.Sep.2011 | 1.2.BF.4.5   | save QM menu to flash, repaired QM delay and phase measurement, added QM settings menus for delay and phase, changed wheel direction
|             |              | for zerolevels, fixed FFT status removing bug, 
| 13.Sep.2011 | 1.2.BF.4.6   | implemented separated thresholds for every channel, set absolute threshold to not available, 
| 15.Sep.2011 | 1.2.BF.4.7   | new math implementation with accelerated calculation, multiplying works with correct sign now, adjusted math scaling, added
|             |              | math offset, added QM-support for math channel, improved QM-slot dispatching, added cursor support for math offset,
|             |              | fixed source channels update logic,
| 21.Sep.2011 | 1.2.BF.4.8   | new popup item logic to blank out not available entries, fixed math channel bug on 2 channel devices, improved channel update logic,
|             |              | optimized QM slot assignment at channel switching,
| 26.Sep.2011 | 1.2.BF.4.9   | added Joergs newest changes for the addon input stage, fixed problem with memory browser after default setup, fixed problems with
|             |              | rotation interface while splash is active, fixed QM cursor problem which occured at voltage and timebase changes,
| 28.Sep.2011 | 1.2.BF.5.0   | new logic module, added Kurts new rle routine for the vinculum, corrected pulswidth trigger button text, fixed some minor bugs,
|             |              | repaired Autoscale Undo, improved Autoscale, 
| 05.Oct.2011 | 1.2.BF.5.1   | implemented FIR filter routines, adjusted scaling for 24.9Ohm and deleted entry for 33Ohm, quick start (like suggested by Jörg),
|             | Xmas Edition | fine adjustment for the standard ranges, fast MSTEP multiplication option for the compiler added (thanks to Jörg) -> integer  
|             |              | multiplication is much faster now, corrected excalibur entry for CPU speed to 12.5 -> nr_delay() is running correct now
|             |              | (also thanks to Jörg), added LED test in the hardware menue, implemented 10:1 probe support for logic analyzer,
| 11.Jan.2012 | C2           | corrected CPU speed caused timing problems at writing to flash -> fixed, corrected USB-Host interface timing,
|             | C3           | fixed missing pretrigger sign at startup, fixed missing timeout at autopretrigger, fixed missing cursors after info screen,
|             |              | corrected button double push timing,
| 17.Jan.2012 | C4           | corrected interface timing for USB-host encoder,
| 22.Jan.2012 | 1.2.BF.5.2   | Added Jörgs turbo loader skribt to the make file, implemented new µs delay funktion in nios library, implemented the new
|             |              | nr_delay_us() in the flash writing method, added new QM-Cursor on/off button in display setup (suggested by Luc),
| 23.Jan.2012 | C2           | corrected LED initialization at Default Setup
| 27.Jan.2012 | 1.2.BF.5.3   | Optimized flash driver, implemented config slot writing (thanks to Bjoern for the idea and the prototype), corrected overlay,
| 16.Feb.2012 | 1.2.BF.5.4   | changed config sector, implemented new fast c-coded ADC readout function, added clipping in lookup table,
|             |              | fixed pretrigger setting after calibration, replaced WRITEADC() and READADC() assembler functions with C-coded OSOZ versions,
| 25.Feb.2012 | 1.2.BF.5.5   | optimized ADC_readout() and increased speed once more, implemented alternating trigger, implemented new flash function to read out 
|             |              | the manufacturer ID and Device ID, fixed single trigger,
| 01.Mar.2012 | 1.2.BF.5.6   | Added ADC driver selection in hardwaremenu which offers a driver with byte overflow protection and a incredibly fast but
|             |              | quick and dirty driver without byte overflow protection, fixed USTB inverted mode,
|             | C2           | corrected ext. trigger,
| 05.Mar.2012 | 1.2.BF.5.7   | added 16bit low level multiplication routines from OSOZ, changed pixel drawing to OSOZ coding, added new hand optimized 
|             |              | assembler ADC-driver, added new inverting assembler ADC-driver, added new averaging assembler ADC-driver, deleted obsolete
|             |              | inverting and averageing routines in signal processing,
|             | C2           | fixed external trigger level adjustment, fixed ADC-offset adjustment, changed status drawing at startup,
| 08.Dec.2012 | 1.2.BF.5.8   | deletetd hard coded trigonometric tables and window tables from FFT to save RAM memory, new generation routines
|             | Xmas Edition | for trigonometric functions and window functions, added three new window functions, new routine for burning FFT tables
|             |              | into flash, improved FFT algorithm, reading tables from flash, added amplitude correction factor for window functions,
|             |              | FFT ist working with up to 4096 points now,
| 07.Jan.2013 | 1.2.BF.5.9   | fixed browse-bug at switching to FFT - thanks to Andi, repaired XY pixeldrawing, added menu scrolling for FFT, 
|             |              | improved menu button focusing, some minor fixes,
| 16.Jan.2013 | 1.2.BF.5.10  | new scaling factors for preamp resistances 24.9 Ohm / 180 Ohm (174 Ohm) in the hardware menu
| 19.Jan.2013 | 1.2.BF.6.0   | added new OSOZ capture trigger hardware API, reengineered the trigger control, added new trigger mode "Free Run",
|             |              | new trigger level correction for more precise trigger level, repaired pulsewidth trigger, all trigger modes are available 
|             |              | for pulsewidth trigger also now, 
| 26.Jan.2013 | C2           | fixed wrong source channel entry in edge trigger source menu after default setup,
| 28.Jan.2013 | 1.2.BF.6.1   | changed external trigger API to actual OSOZ API, reengineered and corrected TV trigger,
| 01.Feb.2013 | 1.2.BF.6.2   | added new onscreen status to display logic/average/filter status on the screen, changed menu function for channel coupling
|             |              | from AC/DC/GND to AC/DC by simple button push. No Popup menu is available anymore. implemented execution queue to execute 
|             |              | functions and methods via handle, implemented delayed loader function via VSync interrupt to execute methods delayed,
|             |              | exec queue is used only by a few methods at this time but it is planned to use it as central control unit,
| 09.Feb.2013 | 1.2.BF.6.3   | rollback execution handling to old endless loop, reactivated GND coupling for the channels, coupling popup menu is available again,
|             |              | changed button control to direct switching between AC/DC when pushing once and also GND when pushing more times,
|             |              | logic analyser is executed now by delayed VSync() loader, optimized some function calls, splitted memory browser function
|             |              | into three parts to avoid executing superfluous code, optimized some if branches for better performance, fixed trigger level
|             |              | value display -> failure caused by VSync call (reported by Luc), fixed logic analyser problems with QM, fixed Save/Recall Trace
|             |              | problem with QM,
| 15.Feb.2013 | 1.2.BF.6.4   | changed flash sector mapping, new calibration sector, protected config is read only now - no values are stored there anymore,
|             |              | new variable gain adjusting in hardware menu, corrected IIR cutoff frequencies in OSS, optimized ADC readout for FFT, 
|             |              | added fast 16x16 bit MSTEP multiplacation inline functions, increased speed in the fast timebases including interpolated tb,
|             |              | 200ns - 2ns are two times faster now because of reading only the needed data for the screen output, the speed of 500ns + 1µs 
|             |              | increased by 1.3, the slower timebases don't have much more speed because the acquisition needs more time than the reading,
|             |              | reengineered string calculation for trigger level and voltage range, probe divider supports amplification (0.5:1, 0.2:1, 0,1:1) now,
|             |              | reengineered hardware driver for the relay settings, changed AC/DC button logic again, reengineered QM measuring, corrected
|             |              | QM voltage measuring,
| 24.Feb.2013 | C2           | fixed bug in calibration routine
| 24.Feb.2013 | C3           | fixed bug in calibration routine -> corrected channel index
| 25.Feb.2013 | C4           | fixed bug in Run/Stop and Save/Recall procedure, saving channel 4 delay fixed, saving calibration set fixed,
| 26.Feb.2013 | C5           | fixed bug in Single Shot at interpolated timebases (20ns - 2ns), fixed saving channel delay using main wheel,
|             |              | fixed FFT memory bug, added Single Shot for FFT,
| 27.Feb.2013 | C6           | fixed bug in calibration which deletes the delay settings in flash
| 15.Mar.2013 | 1.2.BF.6.5   | reengineered assembler drivers for ADC readout, corrected average drivers, added new C-coded drivers, new peak detect driver,
|	      |              | optimized lowpass filter algorithm with partial loop rollout, reengineered QM routine, increased QM calculating speed,
|             |              | added highly optimized peak detect assembler driver, stabilized trigger offset correction, optimized all other assembler 
|             |              | capture drivers, increased signal drawing speed, corrected readout length,
| 28.Mar.2013 | C2           | fixed bug in logik analyser timebase routine,
| 31.Mar.2013 | C3           | added new register setting "High Freq 2" in Hardware Menu with value 0x28000,      
| 05.May.2013 | 1.2.BF.6.6   | added support for Low Budget Mod, corrected clipping in scale factor table, fixed freeze bug in calibration routine,
|             |              | set readout length back to full length,
| 07.May.2013 | 1.2.BF.6.7   | optimized XY-drawing, minor changes in signal acquisition and stop/single mode, corrected FFT grid div calculating,
|             |              | added support for OPA653 Mod, changed average mode back to old functionality but with speed optimization,
| 02.Apr.2014 | 1.2.BF.6.8   | fixed single trigger problem in tb slower than 10µs, 
| 29.Sep.2014 | 1.2.BF.6.9   | added some changes for pulse trigger improvement suggested by Jürgen, fixed pulse trigger freezing in "Normal" mode
|             |              | and "><" between range by work around in ADC handler, fixed single trigger for peak detect
| 05.Oct.2014 | 1.2.BF.6.10  | some changes in the startup routine, fixed the wrong pretrigger after DSO restart, fixed the pretrigger value
|             |              | display in the trigger menus when changing the timebase,
| 07.Oct.2014 | 1.2.BF.7.0   | added new VSync timer functions (delay timer, periodic timer), extended asynchron execution handler, improved flash
|             |              | reload function, added new persistent functions with variable fade out time in display menu, fixed minor bug menu popup
|             |              | timeout in trigger menu
| 09.Oct.2014 | 1.2.BF.7.1   | optimized Run/Stop/Single control, fixed bug in trigger mode popup menu when changing to Stop mode and back,
|             |              | changed "Force Trigger" popup in trigger submenu, fixed status overwriting in Stop mode and Free Run, added hidden function
|             |              | for changing model lable in protected flash -> reachable with a serial terminal and the keys shift + O, 
| 20.Oct.2014 | 1.2.BF.7.2   | improved timer functions, assigned each timer to its own execution handler, added stop watch function, improved
|             |              | handler for zerolevel adjustment (rotary interface), added scaling trigger level instead of constant trigger level,
|             |              | close any open popup menu when using rotary interface - except main wheel, added hidden function (shift + P) to set back the
|             |              | model to 100MHz, added hidden functions (shift + K/shift + L) for frame measuring, hidden function for trigo table refresh (shift + N)
|             |              | improved font letters -, +, * (for math menu etc.), optimized text output on screen (performance), fixed threshold types menu, 
|             |              | hidden function (shift + F) to display flash ID and description of the result, fixed Save/Recall signal pointer bug,
|             |              | fixed some minor menu bugs,
| 26.Oct.2014 | 1.2.BF.7.3   | set QM source popup menu inactive for Delay/Phase measurment, fixed Calibration Set popup menu, improved voltage range handler,
|             |              | added popup menu for trigger level setting "Fix Position/Constant Level", improved timebase handler, improved test signal generator,
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
Further developers working on this project:

Falk (FW)
Guido
Rolf (rowue)
Niklas (nevm)
Kurt (KB)
Joerg 
Juergen (JK)
*/
