From d25822d4350edacd71ee2f16f92f69ab4ba94f70 Mon Sep 17 00:00:00 2001 From: Martin Date: Mon, 6 Mar 2023 17:20:11 +0100 Subject: [PATCH] correct ini file offset sign (same value as in EEPROM), fix comments see: https://github.com/OpenHantek/OpenHantek6022/pull/352 Signed-off-by: Martin --- CHANGELOG | 1 + PyHT6022/Firmware/DSO6022BE/scope6022.inc | 12 ++++++------ examples/calibrate_6022.py | 6 ++++-- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index f06ed79..429ad8d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,4 @@ +2022-10-18: update build process, create OpenHantek6022 header file with FW version [01b82fd] 2022-07-29: update README, add status badges [00a965f] 2022-07-29: upversion to 2.10.4 [6737826] 2022-07-29: fix for #17 provided by guerby [b5fbe7b] diff --git a/PyHT6022/Firmware/DSO6022BE/scope6022.inc b/PyHT6022/Firmware/DSO6022BE/scope6022.inc index d72011d..bc00409 100644 --- a/PyHT6022/Firmware/DSO6022BE/scope6022.inc +++ b/PyHT6022/Firmware/DSO6022BE/scope6022.inc @@ -258,18 +258,18 @@ static BOOL set_samplerate( BYTE rate ) { } // new functon to set the calibration pulse frequency that allows -// to set all possible frequencies between 40 Hz and 100 kHz -// integer dividers of 2MHz Hz will be exact +// to set all possible frequencies between 32 Hz and 100 kHz +// integer dividers of 2MHz will be exact // frequencies between 40 Hz and 1000 Hz can be multiples of 10 Hz -// frequencies between 100 Hz to 10 kHz can be multiples of 100 Hz -// frequencies between 1 kHz to 100 kHz can be multiples of 1 kHz +// frequencies between 100 Hz and 5500 Hz can be multiples of 100 Hz +// frequencies between 1 kHz and 100 kHz can be multiples of 1 kHz // calibration frequency is coded into one byte parameter freq: // freq == 0 -> 100 Hz (compatibility to old sigrok coding) // freq 1..100 -> freq in kHz // freq 101, 102 -> not possible // freq == 103 -> 32 Hz (lowest possible frequency due to 16bit HW timer2) -// freq 104..200 -> (value-100)*10 is freq in Hz -// freq 201..255 -> (value-200)*100 is freq in Hz +// freq 104..200 -> (value-100)*10 is freq in Hz (40, 50, ... 1000) +// freq 201..255 -> (value-200)*100 is freq in Hz (100, 200, ... 5500) // e.g. 105 -> 50 Hz, 216 -> 1600 Hz, 20 -> 20 kHz // static BOOL set_calibration_pulse( BYTE freq ) { diff --git a/examples/calibrate_6022.py b/examples/calibrate_6022.py index 93f8c9f..773eb2b 100755 --- a/examples/calibrate_6022.py +++ b/examples/calibrate_6022.py @@ -184,21 +184,23 @@ def read_avg( voltage_range, sample_rate=110, repeat = 1, samples = 12 * 1024 ): config.write( calFile ) config.write( "\n;Created by tool 'calibrate_6022.py'\n\n" ) + # offset as measured: values > 0 correct downwards, values < 0 correct upwards config.write( "[offset]\n" ) for index, gainID in enumerate( gains ): voltID = V_div[ index ] if ( abs( offset1[ gainID ] ) <= 25 ): # offset too high -> skip - config.write( "ch0\\%dmV=%6.2f\n" % ( voltID, -offset1[ gainID ] ) ) + config.write( "ch0\\%dmV=%6.2f\n" % ( voltID, offset1[ gainID ] ) ) for index, gainID in enumerate( gains ): voltID = V_div[ index ] if ( abs( offset2[ gainID ] ) <= 25 ): # offset too high -> skip - config.write( "ch1\\%dmV=%6.2f\n" % ( voltID, -offset2[ gainID ] ) ) + config.write( "ch1\\%dmV=%6.2f\n" % ( voltID, offset2[ gainID ] ) ) for index, gainID in enumerate( gains ): # print( gains[index], offlo1[gainID], offlo2[gainID], offhi1[gainID], offhi2[gainID], ) # prepare eeprom content # store values in offset binary format (zero = 0x80, as in factory setup) + # offset as measured: values > 0x80 correct downwards, values < 0x80 correct upwards if ( abs( offlo1[ gainID ] ) <= 25 ): # offset too high -> skip ee_calibration[ 2 * index ] = 0x80 + offlo1[ gainID ] # CH1 offset integer part if ( abs( offlo_1[ gainID ] ) <= 125 ): # frac part not plausible