From 9ccb682234e4dbe2e19a414949eb496f85d7b9e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=B5=D1=80=D0=B3=D0=B5=D0=B9=20=D0=90=D0=BB=D0=B5?= =?UTF-8?q?=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=80=D0=BE=D0=B2=D0=B8=D1=87=20?= =?UTF-8?q?=D0=90=D0=BC=D0=B1=D1=80=D0=BE=D0=B7=D0=B5=D0=B2=D0=B8=D1=87?= Date: Tue, 20 Oct 2026 15:09:06 +0300 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20=D1=84=D0=B0=D0=B9=D0=BB=D1=8B=20=D0=B2=20=C2=AB?= =?UTF-8?q?src=C2=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ps2000_math.c | 2 +- src/ps2000_ops.c | 2 +- src/ps2000_thread.c | 7 ++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/ps2000_math.c b/src/ps2000_math.c index 5110b23..ecbd7aa 100644 --- a/src/ps2000_math.c +++ b/src/ps2000_math.c @@ -169,7 +169,7 @@ int16_t _ps2000_math_adc_convert(int16_t raw, double gain, double corr_offset) { val *= gain; /* Scale back to ADC counts for output */ - val *= PS2000_ADC_FULL_SCALE; + /* REMOVED: val *= PS2000_ADC_FULL_SCALE; (spurious) */ /* Truncate to integer (cvttsd2si) */ int32_t converted = (int32_t)(int64_t)val; diff --git a/src/ps2000_ops.c b/src/ps2000_ops.c index d9bf322..a37d80d 100644 --- a/src/ps2000_ops.c +++ b/src/ps2000_ops.c @@ -180,7 +180,7 @@ int _ps2000_ops_siggen_default_init(ps2000_context_t *ctx) { ctx->siggen.config = PS2000_SIGGEN_DEFAULT; /* Check capabilities bitmap for specific feature */ - if (ctx->info.eeprom_valid == 0x10) { + if (_ps2000_ops_check_capability(ctx, 4)) { /* bit 4 = 0x10 */ /* Extended initialization for capable devices */ ctx->siggen.awg_config_flag = 1; } diff --git a/src/ps2000_thread.c b/src/ps2000_thread.c index f60b9ec..c0976e5 100644 --- a/src/ps2000_thread.c +++ b/src/ps2000_thread.c @@ -41,7 +41,12 @@ ps2000_status_t _ps2000_thr_create(pthread_t *thr, const char *name, pthread_attr_init(&attr); pthread_attr_setstacksize(&attr, 1024 * 1024); /* 1MB stack */ - int ret = pthread_create(thr, &attr, _ps2000_thr_trampoline, (void*)&func); + _ps2000_thr_ctx_t *thr_ctx = (_ps2000_thr_ctx_t*)malloc(sizeof(_ps2000_thr_ctx_t)); +if (!thr_ctx) { pthread_attr_destroy(&attr); return PS2000_ERR_MEMORY; } +thr_ctx->func = func; +thr_ctx->arg = arg; +int ret = pthread_create(thr, &attr, _ps2000_thr_trampoline, thr_ctx); +if (ret != 0) free(thr_ctx); pthread_attr_destroy(&attr); if (ret != 0) {