Skip to content

Commit d25822d

Browse files
committed
correct ini file offset sign (same value as in EEPROM), fix comments
see: OpenHantek/OpenHantek6022#352 Signed-off-by: Martin <[email protected]>
1 parent 01b82fd commit d25822d

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
2022-10-18: update build process, create OpenHantek6022 header file with FW version [01b82fd]
12
2022-07-29: update README, add status badges [00a965f]
23
2022-07-29: upversion to 2.10.4 [6737826]
34
2022-07-29: fix for #17 provided by guerby [b5fbe7b]

PyHT6022/Firmware/DSO6022BE/scope6022.inc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -258,18 +258,18 @@ static BOOL set_samplerate( BYTE rate ) {
258258
}
259259

260260
// new functon to set the calibration pulse frequency that allows
261-
// to set all possible frequencies between 40 Hz and 100 kHz
262-
// integer dividers of 2MHz Hz will be exact
261+
// to set all possible frequencies between 32 Hz and 100 kHz
262+
// integer dividers of 2MHz will be exact
263263
// frequencies between 40 Hz and 1000 Hz can be multiples of 10 Hz
264-
// frequencies between 100 Hz to 10 kHz can be multiples of 100 Hz
265-
// frequencies between 1 kHz to 100 kHz can be multiples of 1 kHz
264+
// frequencies between 100 Hz and 5500 Hz can be multiples of 100 Hz
265+
// frequencies between 1 kHz and 100 kHz can be multiples of 1 kHz
266266
// calibration frequency is coded into one byte parameter freq:
267267
// freq == 0 -> 100 Hz (compatibility to old sigrok coding)
268268
// freq 1..100 -> freq in kHz
269269
// freq 101, 102 -> not possible
270270
// freq == 103 -> 32 Hz (lowest possible frequency due to 16bit HW timer2)
271-
// freq 104..200 -> (value-100)*10 is freq in Hz
272-
// freq 201..255 -> (value-200)*100 is freq in Hz
271+
// freq 104..200 -> (value-100)*10 is freq in Hz (40, 50, ... 1000)
272+
// freq 201..255 -> (value-200)*100 is freq in Hz (100, 200, ... 5500)
273273
// e.g. 105 -> 50 Hz, 216 -> 1600 Hz, 20 -> 20 kHz
274274
//
275275
static BOOL set_calibration_pulse( BYTE freq ) {

examples/calibrate_6022.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,21 +184,23 @@ def read_avg( voltage_range, sample_rate=110, repeat = 1, samples = 12 * 1024 ):
184184
config.write( calFile )
185185
config.write( "\n;Created by tool 'calibrate_6022.py'\n\n" )
186186

187+
# offset as measured: values > 0 correct downwards, values < 0 correct upwards
187188
config.write( "[offset]\n" )
188189
for index, gainID in enumerate( gains ):
189190
voltID = V_div[ index ]
190191
if ( abs( offset1[ gainID ] ) <= 25 ): # offset too high -> skip
191-
config.write( "ch0\\%dmV=%6.2f\n" % ( voltID, -offset1[ gainID ] ) )
192+
config.write( "ch0\\%dmV=%6.2f\n" % ( voltID, offset1[ gainID ] ) )
192193
for index, gainID in enumerate( gains ):
193194
voltID = V_div[ index ]
194195
if ( abs( offset2[ gainID ] ) <= 25 ): # offset too high -> skip
195-
config.write( "ch1\\%dmV=%6.2f\n" % ( voltID, -offset2[ gainID ] ) )
196+
config.write( "ch1\\%dmV=%6.2f\n" % ( voltID, offset2[ gainID ] ) )
196197

197198

198199
for index, gainID in enumerate( gains ):
199200
# print( gains[index], offlo1[gainID], offlo2[gainID], offhi1[gainID], offhi2[gainID], )
200201
# prepare eeprom content
201202
# store values in offset binary format (zero = 0x80, as in factory setup)
203+
# offset as measured: values > 0x80 correct downwards, values < 0x80 correct upwards
202204
if ( abs( offlo1[ gainID ] ) <= 25 ): # offset too high -> skip
203205
ee_calibration[ 2 * index ] = 0x80 + offlo1[ gainID ] # CH1 offset integer part
204206
if ( abs( offlo_1[ gainID ] ) <= 125 ): # frac part not plausible

0 commit comments

Comments
 (0)