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) {